summaryrefslogtreecommitdiff
path: root/src/libelogind/sd-bus/bus-creds.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2016-03-06 16:02:31 +0100
committerAndy Wingo <wingo@pobox.com>2016-03-06 16:02:31 +0100
commit162255186046fa7a5e82859b7dba5a7909ce6fc4 (patch)
tree8b81f2e7afac4df45ebca6e662d4d2b1d8635e5a /src/libelogind/sd-bus/bus-creds.c
parent6f5035f2db6ab7b4beae46c44b95e6a8b6d956b5 (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/libelogind/sd-bus/bus-creds.c')
-rw-r--r--src/libelogind/sd-bus/bus-creds.c47
1 files changed, 7 insertions, 40 deletions
diff --git a/src/libelogind/sd-bus/bus-creds.c b/src/libelogind/sd-bus/bus-creds.c
index cd1c5e232..aea379d66 100644
--- a/src/libelogind/sd-bus/bus-creds.c
+++ b/src/libelogind/sd-bus/bus-creds.c
@@ -358,8 +358,6 @@ _public_ int sd_bus_creds_get_cgroup(sd_bus_creds *c, const char **ret) {
}
_public_ int sd_bus_creds_get_unit(sd_bus_creds *c, const char **ret) {
- int r;
-
assert_return(c, -EINVAL);
assert_return(ret, -EINVAL);
@@ -368,25 +366,14 @@ _public_ int sd_bus_creds_get_unit(sd_bus_creds *c, const char **ret) {
assert(c->cgroup);
- if (!c->unit) {
- const char *shifted;
-
- r = cg_shift_path(c->cgroup, c->cgroup_root, &shifted);
- if (r < 0)
- return r;
-
- r = cg_path_get_unit(shifted, (char**) &c->unit);
- if (r < 0)
- return r;
- }
+ if (!c->unit)
+ return -ESRCH;
*ret = c->unit;
return 0;
}
_public_ int sd_bus_creds_get_user_unit(sd_bus_creds *c, const char **ret) {
- int r;
-
assert_return(c, -EINVAL);
assert_return(ret, -EINVAL);
@@ -395,25 +382,14 @@ _public_ int sd_bus_creds_get_user_unit(sd_bus_creds *c, const char **ret) {
assert(c->cgroup);
- if (!c->user_unit) {
- const char *shifted;
-
- r = cg_shift_path(c->cgroup, c->cgroup_root, &shifted);
- if (r < 0)
- return r;
-
- r = cg_path_get_user_unit(shifted, (char**) &c->user_unit);
- if (r < 0)
- return r;
- }
+ if (!c->user_unit)
+ return -ESRCH;
*ret = c->user_unit;
return 0;
}
_public_ int sd_bus_creds_get_slice(sd_bus_creds *c, const char **ret) {
- int r;
-
assert_return(c, -EINVAL);
assert_return(ret, -EINVAL);
@@ -422,17 +398,8 @@ _public_ int sd_bus_creds_get_slice(sd_bus_creds *c, const char **ret) {
assert(c->cgroup);
- if (!c->slice) {
- const char *shifted;
-
- r = cg_shift_path(c->cgroup, c->cgroup_root, &shifted);
- if (r < 0)
- return r;
-
- r = cg_path_get_slice(shifted, (char**) &c->slice);
- if (r < 0)
- return r;
- }
+ if (!c->slice)
+ return -ESRCH;
*ret = c->slice;
return 0;
@@ -481,7 +448,7 @@ _public_ int sd_bus_creds_get_owner_uid(sd_bus_creds *c, uid_t *uid) {
if (r < 0)
return r;
- return cg_path_get_owner_uid(shifted, uid);
+ return -ESRCH;
}
_public_ int sd_bus_creds_get_cmdline(sd_bus_creds *c, char ***cmdline) {