X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flogind-user.c;h=206064f1039224339330627be7f7128bab6c6edf;hb=a185c5aa2d8bef98716f8cf160da263c17e588b2;hp=7d6df8db7a8d6989be36b4b70a44db5d6c0fc7d2;hpb=91f9dcaf9270fe465525638cc08bd94590273349;p=elogind.git diff --git a/src/logind-user.c b/src/logind-user.c index 7d6df8db7..206064f10 100644 --- a/src/logind-user.c +++ b/src/logind-user.c @@ -156,7 +156,7 @@ int user_load(User *u) { assert(u); - r = parse_env_file(u->state_file, "r", + r = parse_env_file(u->state_file, NEWLINE, "CGROUP", &u->cgroup_path, "RUNTIME", &u->runtime_path, "SERVICE", &u->service, @@ -386,6 +386,42 @@ int user_stop(User *u) { return r; } +int user_get_idle_hint(User *u, dual_timestamp *t) { + Session *s; + bool idle_hint = true; + dual_timestamp ts = { 0, 0 }; + + assert(u); + + LIST_FOREACH(sessions_by_user, s, u->sessions) { + dual_timestamp k; + int ih; + + ih = session_get_idle_hint(s, &k); + if (ih < 0) + return ih; + + if (!ih) { + if (!idle_hint) { + if (k.monotonic < ts.monotonic) + ts = k; + } else { + idle_hint = false; + ts = k; + } + } else if (idle_hint) { + + if (k.monotonic > ts.monotonic) + ts = k; + } + } + + if (t) + *t = ts; + + return idle_hint; +} + int user_check_gc(User *u) { int r; char *p;