summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/login/logind-user-dbus.c22
-rw-r--r--src/login/logind-user.c2
-rw-r--r--src/login/logind-user.h1
3 files changed, 24 insertions, 1 deletions
diff --git a/src/login/logind-user-dbus.c b/src/login/logind-user-dbus.c
index fc71fcf22e..dbd617f7ac 100644
--- a/src/login/logind-user-dbus.c
+++ b/src/login/logind-user-dbus.c
@@ -151,6 +151,27 @@ static int property_get_idle_since_hint(
return sd_bus_message_append(reply, "t", k);
}
+static int property_get_linger(
+ sd_bus *bus,
+ const char *path,
+ const char *interface,
+ const char *property,
+ sd_bus_message *reply,
+ sd_bus_error *error,
+ void *userdata) {
+
+ User *u = userdata;
+ int r;
+
+ assert(bus);
+ assert(reply);
+ assert(u);
+
+ r = user_check_linger_file(u);
+
+ return sd_bus_message_append(reply, "b", r > 0);
+}
+
static int method_terminate(sd_bus *bus, sd_bus_message *message, void *userdata) {
User *u = userdata;
int r;
@@ -206,6 +227,7 @@ const sd_bus_vtable user_vtable[] = {
SD_BUS_PROPERTY("IdleHint", "b", property_get_idle_hint, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
SD_BUS_PROPERTY("IdleSinceHint", "t", property_get_idle_since_hint, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
SD_BUS_PROPERTY("IdleSinceHintMonotonic", "t", property_get_idle_since_hint, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
+ SD_BUS_PROPERTY("Linger", "b", property_get_linger, 0, 0),
SD_BUS_METHOD("Terminate", NULL, NULL, method_terminate, 0),
SD_BUS_METHOD("Kill", "i", NULL, method_kill, 0),
diff --git a/src/login/logind-user.c b/src/login/logind-user.c
index bfbdfaf547..6ba8d9807b 100644
--- a/src/login/logind-user.c
+++ b/src/login/logind-user.c
@@ -587,7 +587,7 @@ int user_get_idle_hint(User *u, dual_timestamp *t) {
return idle_hint;
}
-static int user_check_linger_file(User *u) {
+int user_check_linger_file(User *u) {
_cleanup_free_ char *cc = NULL;
char *p = NULL;
diff --git a/src/login/logind-user.h b/src/login/logind-user.h
index de7ba6d57e..8d396c681d 100644
--- a/src/login/logind-user.h
+++ b/src/login/logind-user.h
@@ -79,6 +79,7 @@ int user_get_idle_hint(User *u, dual_timestamp *t);
int user_save(User *u);
int user_load(User *u);
int user_kill(User *u, int signo);
+int user_check_linger_file(User *u);
extern const sd_bus_vtable user_vtable[];
int user_node_enumerator(sd_bus *bus, const char *path, char ***nodes, void *userdata);