summaryrefslogtreecommitdiff
path: root/src/logind-user.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-07-22 21:01:15 +0200
committerLennart Poettering <lennart@poettering.net>2011-07-22 21:01:15 +0200
commit034a2a52ac0ec83e0229941d635d310b23eb04df (patch)
tree37cca83098579cc56d30b1bab1a4c48134586796 /src/logind-user.c
parentbccc1d8859175f0927652d694796892c9e9c21d6 (diff)
sd-login: beef up login api, to add monitoring and enumerating
Diffstat (limited to 'src/logind-user.c')
-rw-r--r--src/logind-user.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/logind-user.c b/src/logind-user.c
index 3a677ff707..3c245c0927 100644
--- a/src/logind-user.c
+++ b/src/logind-user.c
@@ -134,6 +134,44 @@ int user_save(User *u) {
"DISPLAY=%s\n",
u->display->id);
+ if (u->sessions) {
+ Session *i;
+
+ fputs("SESSIONS=", f);
+ LIST_FOREACH(sessions_by_user, i, u->sessions) {
+ fprintf(f,
+ "%s%c",
+ i->id,
+ i->sessions_by_seat_next ? ' ' : '\n');
+ }
+
+ fputs("SEATS=", f);
+ LIST_FOREACH(sessions_by_user, i, u->sessions) {
+ if (i->seat)
+ fprintf(f,
+ "%s%c",
+ i->seat->id,
+ i->sessions_by_seat_next ? ' ' : '\n');
+ }
+
+ fputs("ACTIVE_SESSIONS=", f);
+ LIST_FOREACH(sessions_by_user, i, u->sessions)
+ if (session_is_active(i))
+ fprintf(f,
+ "%lu%c",
+ (unsigned long) i->user->uid,
+ i->sessions_by_seat_next ? ' ' : '\n');
+
+ fputs("ACTIVE_SEATS=", f);
+ LIST_FOREACH(sessions_by_user, i, u->sessions) {
+ if (session_is_active(i) && i->seat)
+ fprintf(f,
+ "%s%c",
+ i->seat->id,
+ i->sessions_by_seat_next ? ' ' : '\n');
+ }
+ }
+
fflush(f);
if (ferror(f) || rename(temp_path, u->state_file) < 0) {