summaryrefslogtreecommitdiff
path: root/src/login/logind.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-08-07 12:08:24 +0200
committerSven Eden <sven.eden@prydeworx.com>2018-10-29 10:18:37 +0100
commit729a2fa913640bea3376d9afc73a9b4bff371085 (patch)
treed232e32f5d9d5a7ca3b9c7b71785ffb39a1575aa /src/login/logind.c
parent11fb2bd433c0f2f4aa9705a4d5327b6fab7daa07 (diff)
logind: add hashtable for finding session by leader PID
This is useful later on, when we quickly want to find the session for a leader PID. (cherry picked from commit 238794b15082e6f61d0ce2943d39205289fff7f0)
Diffstat (limited to 'src/login/logind.c')
-rw-r--r--src/login/logind.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/login/logind.c b/src/login/logind.c
index 7a9f5c577..5320820a5 100644
--- a/src/login/logind.c
+++ b/src/login/logind.c
@@ -61,6 +61,7 @@ static int manager_new(Manager **ret) {
m->devices = hashmap_new(&string_hash_ops);
m->seats = hashmap_new(&string_hash_ops);
m->sessions = hashmap_new(&string_hash_ops);
+ m->sessions_by_leader = hashmap_new(NULL);
m->users = hashmap_new(NULL);
m->inhibitors = hashmap_new(&string_hash_ops);
m->buttons = hashmap_new(&string_hash_ops);
@@ -68,7 +69,7 @@ static int manager_new(Manager **ret) {
m->user_units = hashmap_new(&string_hash_ops);
m->session_units = hashmap_new(&string_hash_ops);
- if (!m->devices || !m->seats || !m->sessions || !m->users || !m->inhibitors || !m->buttons || !m->user_units || !m->session_units)
+ if (!m->devices || !m->seats || !m->sessions || !m->sessions_by_leader || !m->users || !m->inhibitors || !m->buttons || !m->user_units || !m->session_units)
return -ENOMEM;
#if 1 /// elogind needs some more data
@@ -132,6 +133,7 @@ static Manager* manager_unref(Manager *m) {
hashmap_free(m->devices);
hashmap_free(m->seats);
hashmap_free(m->sessions);
+ hashmap_free(m->sessions_by_leader);
hashmap_free(m->users);
hashmap_free(m->inhibitors);
hashmap_free(m->buttons);