#include "hashmap.h"
#include "fileio.h"
#include "path-util.h"
-#include "special.h"
+// #include "special.h"
#include "unit-name.h"
#include "bus-util.h"
#include "bus-error.h"
char lu[DECIMAL_STR_MAX(uid_t) + 1], *slice;
sprintf(lu, UID_FMT, u->uid);
- r = slice_build_subslice(SPECIAL_USER_SLICE, lu, &slice);
+ r = slice_build_subslice("user.slice", lu, &slice);
if (r < 0)
return r;
/// elogind : Do not try to use dbus to ask systemd
#if 0
r = manager_start_unit(u->manager, slice, &error, &job);
-#endif // 0
if (r < 0) {
log_error("Failed to start user slice: %s", bus_error_message(&error, r));
free(slice);
} else {
+#endif // 0
u->slice = slice;
/// elogind does not support slice jobs
#if 0
free(u->slice_job);
u->slice_job = job;
-#endif // 0
}
+#endif // 0
}
if (u->slice)
if (r < 0)
log_error_errno(r, "Failed to remove runtime directory %s: %m", u->runtime_path);
- free(u->runtime_path);
- u->runtime_path = NULL;
+ u->runtime_path = mfree(u->runtime_path);
return r;
}
}
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
}