X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fcgroup.c;h=76a3d2d2513bdea4752581ff6e1ca00608ee3b94;hb=076d998b73bf53e6652ea3ae4bed169e57423741;hp=792f0d9119936402f2a178980c4504b84f5601e2;hpb=5e183226554ec5812cd3753581d9dbdeba525330;p=elogind.git diff --git a/src/core/cgroup.c b/src/core/cgroup.c index 792f0d911..76a3d2d25 100644 --- a/src/core/cgroup.c +++ b/src/core/cgroup.c @@ -22,17 +22,22 @@ #include #include +#include "alloc-util.h" #include "cgroup-util.h" +#include "cgroup.h" +#include "fd-util.h" +#include "fileio.h" +#include "fs-util.h" +#include "parse-util.h" #include "path-util.h" #include "process-util.h" //#include "special.h" - -#include "cgroup.h" +#include "string-table.h" +#include "string-util.h" #define CGROUP_CPU_QUOTA_PERIOD_USEC ((usec_t) 100 * USEC_PER_MSEC) -// UNNEEDED by elogind -#if 0 +#if 0 /// UNNEEDED by elogind void cgroup_context_init(CGroupContext *c) { assert(c); @@ -1205,7 +1210,7 @@ int unit_search_main_pid(Unit *u, pid_t *ret) { continue; /* Ignore processes that aren't our kids */ - if (get_parent_of_pid(npid, &ppid) >= 0 && ppid != mypid) + if (get_process_ppid(npid, &ppid) >= 0 && ppid != mypid) continue; if (pid != 0) @@ -1370,8 +1375,7 @@ int manager_setup_cgroup(Manager *m) { if (r < 0) return log_error_errno(r, "Cannot determine cgroup we are running in: %m"); -/// elogind does not support systemd scopes and slices -#if 0 +#if 0 /// elogind does not support systemd scopes and slices /* Chop off the init scope, if we are already located in it */ e = endswith(m->cgroup_root, "/" SPECIAL_INIT_SCOPE); @@ -1418,8 +1422,7 @@ int manager_setup_cgroup(Manager *m) { /* In the unified hierarchy we can can get * cgroup empty notifications via inotify. */ -/// elogind does not support the unified hierarchy, yet. -#if 0 +#if 0 /// elogind does not support the unified hierarchy, yet. m->cgroup_inotify_event_source = sd_event_source_unref(m->cgroup_inotify_event_source); safe_close(m->cgroup_inotify_fd); @@ -1457,8 +1460,7 @@ int manager_setup_cgroup(Manager *m) { log_debug("Release agent already installed."); } -/// elogind is not meant to run in systemd init scope -#if 0 +#if 0 /// elogind is not meant to run in systemd init scope /* 4. Make sure we are in the special "init.scope" unit in the root slice. */ scope_path = strjoina(m->cgroup_root, "/" SPECIAL_INIT_SCOPE); r = cg_create_and_attach(SYSTEMD_CGROUP_CONTROLLER, scope_path, 0); @@ -1516,8 +1518,7 @@ void manager_shutdown_cgroup(Manager *m, bool delete) { if (delete && m->cgroup_root) (void) cg_trim(SYSTEMD_CGROUP_CONTROLLER, m->cgroup_root, false); -/// elogind does not support the unified hierarchy, yet. -#if 0 +#if 0 /// elogind does not support the unified hierarchy, yet. m->cgroup_inotify_wd_unit = hashmap_free(m->cgroup_inotify_wd_unit); m->cgroup_inotify_event_source = sd_event_source_unref(m->cgroup_inotify_event_source); @@ -1529,8 +1530,7 @@ void manager_shutdown_cgroup(Manager *m, bool delete) { m->cgroup_root = mfree(m->cgroup_root); } -/// UNNEEDED by elogind -#if 0 +#if 0 /// UNNEEDED by elogind Unit* manager_get_unit_by_cgroup(Manager *m, const char *cgroup) { char *p; Unit *u;