summaryrefslogtreecommitdiff
path: root/src/login/logind-user.c
diff options
context:
space:
mode:
authorSven Eden <yamakuzure@gmx.net>2017-02-10 14:09:39 +0100
committerSven Eden <yamakuzure@gmx.net>2017-03-14 10:23:13 +0100
commit9eb822a5a6b67eb82909f0d68213afbfcee6e93e (patch)
tree2a1ef0029f5d480065b62a3e72309b553b327d8a /src/login/logind-user.c
parent2055a4de39bdf062645a7a58b50aae029df80857 (diff)
Classify processes from sessions into cgroups
Create a private cgroup tree associated with no controllers, and use it to map PIDs to sessions. Since we use our own path structure, remove internal cgroup-related helpers that interpret the cgroup path structure to pull out users, slices, and scopes.
Diffstat (limited to 'src/login/logind-user.c')
-rw-r--r--src/login/logind-user.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/login/logind-user.c b/src/login/logind-user.c
index 54c210835..ccabe3d47 100644
--- a/src/login/logind-user.c
+++ b/src/login/logind-user.c
@@ -793,16 +793,27 @@ UserState user_get_state(User *u) {
}
int user_kill(User *u, int signo) {
+/// Without systemd unit support, elogind has to rely on its session system
+#if 0
assert(u);
-/// FIXME: Without direct cgroup support, elogind can not kill users
-#if 0
if (!u->slice)
return -ESRCH;
return manager_kill_unit(u->manager, u->slice, KILL_ALL, signo, NULL);
#else
- return -ESRCH;
+ Session *s;
+ int res = 0;
+
+ assert(u);
+
+ LIST_FOREACH(sessions_by_user, s, u->sessions) {
+ int r = session_kill(s, KILL_ALL, signo);
+ if (res == 0 && r < 0)
+ res = r;
+ }
+
+ return res;
#endif // 0
}