X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flogin%2Flogind-session.c;h=3a77b833f53b5d1e8ea5fa9e8a308acbc202e162;hb=8331cb6e143dc261fd22af9a2a679196822326a9;hp=61d34d1a9bcb69a0a8bda1718b79908b6becb797;hpb=451a2b7a44f3624b15bbf960e338791e0b0a4210;p=elogind.git diff --git a/src/login/logind-session.c b/src/login/logind-session.c index 61d34d1a9..3a77b833f 100644 --- a/src/login/logind-session.c +++ b/src/login/logind-session.c @@ -46,7 +46,7 @@ #include "user-util.h" #include "util.h" -// #define RELEASE_USEC (20*USEC_PER_SEC) +#define RELEASE_USEC (20*USEC_PER_SEC) static void session_remove_fifo(Session *s); @@ -550,8 +550,7 @@ static int session_start_scope(Session *s) { return 0; } -#endif // 0 - +#else static int session_start_cgroup(Session *s) { int r; @@ -570,7 +569,7 @@ static int session_start_cgroup(Session *s) { return 0; } - +#endif // 0 int session_start(Session *s) { int r; @@ -588,9 +587,7 @@ int session_start(Session *s) { return r; /* Create cgroup */ -/// elogind does its own session management without systemd units, -/// slices and scopes -#if 0 +#if 0 /// elogind does its own session management r = session_start_scope(s); #else r = session_start_cgroup(s); @@ -665,8 +662,7 @@ static int session_stop_scope(Session *s, bool force) { return 0; } -#endif // 0 - +#else static int session_stop_cgroup(Session *s, bool force) { _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL; int r; @@ -681,6 +677,7 @@ static int session_stop_cgroup(Session *s, bool force) { return 0; } +#endif // 0 int session_stop(Session *s, bool force) { int r; @@ -785,17 +782,16 @@ int session_release(Session *s) { if (s->timer_event_source) return 0; - /* In systemd, session release is triggered by user jobs - dying. In elogind we don't have that so go ahead and stop - now. */ -#if 0 +#if 0 /// UNNEEDED by elogind return sd_event_add_time(s->manager->event, &s->timer_event_source, CLOCK_MONOTONIC, now(CLOCK_MONOTONIC) + RELEASE_USEC, 0, release_timeout_callback, s); - #else + /* In systemd, session release is triggered by user jobs + dying. In elogind we don't have that so go ahead and stop + now. */ return session_stop(s, false); #endif // 0 } @@ -917,6 +913,23 @@ void session_set_idle_hint(Session *s, bool b) { manager_send_changed(s->manager, "IdleHint", "IdleSinceHint", "IdleSinceHintMonotonic", NULL); } +int session_get_locked_hint(Session *s) { + assert(s); + + return s->locked_hint; +} + +void session_set_locked_hint(Session *s, bool b) { + assert(s); + + if (s->locked_hint == b) + return; + + s->locked_hint = b; + + session_send_changed(s, "LockedHint", NULL); +} + static int session_dispatch_fifo(sd_event_source *es, int fd, uint32_t revents, void *userdata) { Session *s = userdata; @@ -1011,10 +1024,6 @@ bool session_check_gc(Session *s, bool drop_not_started) { return true; #endif // 0 - if ( s->user->manager - && (cg_is_empty_recursive (SYSTEMD_CGROUP_CONTROLLER, s->user->manager->cgroup_root) > 0) ) - return true; - return false; }