summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-06-24 23:50:39 +0200
committerLennart Poettering <lennart@poettering.net>2011-06-24 23:50:39 +0200
commita91e4e5337a46db3f0a4f1415c1b60285e5c33a3 (patch)
treed8df9c3fea7dd98dac7fb20b7c78ea33c949b9ce /src
parent31b79c2b4a34961eefc3b3680704124d8490d105 (diff)
logind: save/restore session type
Diffstat (limited to 'src')
-rw-r--r--src/logind-session.c19
-rw-r--r--src/logind-session.h2
2 files changed, 18 insertions, 3 deletions
diff --git a/src/logind-session.c b/src/logind-session.c
index 16d6c177d2..e71ff4f14e 100644
--- a/src/logind-session.c
+++ b/src/logind-session.c
@@ -136,6 +136,11 @@ int session_save(Session *s) {
s->remote,
s->kill_processes);
+ if (s->type >= 0)
+ fprintf(f,
+ "TYPE=%s\n",
+ session_type_to_string(s->type));
+
if (s->cgroup_path)
fprintf(f,
"CGROUP=%s\n",
@@ -210,7 +215,8 @@ int session_load(Session *s) {
*seat = NULL,
*vtnr = NULL,
*leader = NULL,
- *audit_id = NULL;
+ *audit_id = NULL,
+ *type = NULL;
int k, r;
@@ -228,6 +234,7 @@ int session_load(Session *s) {
"SERVICE", &s->service,
"VTNR", &vtnr,
"LEADER", &leader,
+ "TYPE", &type,
NULL);
if (r < 0)
@@ -272,6 +279,14 @@ int session_load(Session *s) {
}
}
+ if (type) {
+ SessionType t;
+
+ t = session_type_from_string(type);
+ if (t >= 0)
+ s->type = t;
+ }
+
finish:
free(remote);
free(kill_processes);
@@ -809,7 +824,7 @@ void session_add_to_gc_queue(Session *s) {
static const char* const session_type_table[_SESSION_TYPE_MAX] = {
[SESSION_TTY] = "tty",
[SESSION_X11] = "x11",
- [SESSION_OTHER] = "other"
+ [SESSION_UNSPECIFIED] = "unspecified"
};
DEFINE_STRING_TABLE_LOOKUP(session_type, SessionType);
diff --git a/src/logind-session.h b/src/logind-session.h
index 7a8001eca6..72f85caaaf 100644
--- a/src/logind-session.h
+++ b/src/logind-session.h
@@ -31,9 +31,9 @@ typedef struct Session Session;
#include "logind-user.h"
typedef enum SessionType {
+ SESSION_UNSPECIFIED,
SESSION_TTY,
SESSION_X11,
- SESSION_OTHER,
_SESSION_TYPE_MAX,
_SESSION_TYPE_INVALID = -1
} SessionType;