summaryrefslogtreecommitdiff
path: root/src/basic/cgroup-util.c
diff options
context:
space:
mode:
authorSven Eden <yamakuzure@gmx.net>2018-01-09 18:52:14 +0100
committerSven Eden <yamakuzure@gmx.net>2018-01-09 18:52:14 +0100
commit1355c7e45cd8ac0f4053ae00111a4d2e49795812 (patch)
tree8426874e5e6d1198b916be7a22119251c0db560d /src/basic/cgroup-util.c
parent99d9de1cc82e021be12d85352ee57e81860b282f (diff)
Prep 235: Enabled sd_bus_creds_get_slice(), sd_bus_creds_get_user_slice(), sd_peer_get_user_slice() and sd_pid_get_user_slice() to try to work with eloginds session id to user mapping.
Diffstat (limited to 'src/basic/cgroup-util.c')
-rw-r--r--src/basic/cgroup-util.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
index d909e2990..41a33899f 100644
--- a/src/basic/cgroup-util.c
+++ b/src/basic/cgroup-util.c
@@ -1936,19 +1936,29 @@ int cg_pid_get_slice(pid_t pid, char **slice) {
return cg_path_get_slice(cgroup, slice);
}
-#if 0 /// UNNEEDED by elogind
int cg_path_get_user_slice(const char *p, char **slice) {
+#if 0 /// UNNEEDED by elogind
const char *t;
+#endif // 0
assert(p);
assert(slice);
+#if 0 // nothing to skip in elogind
t = skip_user_prefix(p);
if (!t)
return -ENXIO;
+#endif // 0
+#if 0 /// UNNEEDED by elogind
/* And now it looks pretty much the same as for a system
* slice, so let's just use the same parser from here on. */
return cg_path_get_slice(t, slice);
+#else
+ /* In elogind there is nothing to skip, we can use the path
+ * directly. Generally speaking this is always a session id
+ * to user mapping. */
+ return cg_path_get_slice(p, slice);
+#endif // 0
}
int cg_pid_get_user_slice(pid_t pid, char **slice) {
@@ -1963,7 +1973,6 @@ int cg_pid_get_user_slice(pid_t pid, char **slice) {
return cg_path_get_user_slice(cgroup, slice);
}
-#endif // 0
char *cg_escape(const char *p) {
bool need_prefix = false;