logind: expose linger state on User object
This commit is contained in:
parent
b8358bce14
commit
3a9f7a30ce
|
@ -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),
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue