X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fbasic%2Fcgroup-util.c;h=8fbbd30429d93452e74e078cdabac7fffb357a73;hp=b3e92763cde20ca9526f83b2dfce79319f51f1d0;hb=656742ab12b5ba1b08234cece6da7f555354d768;hpb=903ff64069e63a831ad1036182d4e56421e0dc86 diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c index b3e92763c..8fbbd3042 100644 --- a/src/basic/cgroup-util.c +++ b/src/basic/cgroup-util.c @@ -113,7 +113,7 @@ int cg_read_subgroup(DIR *d, char **fn) { assert(d); assert(fn); - FOREACH_DIRENT(de, d, return -errno) { + FOREACH_DIRENT_ALL(de, d, return -errno) { char *b; if (de->d_type != DT_DIR) @@ -321,6 +321,14 @@ int cg_migrate(const char *cfrom, const char *pfrom, const char *cto, const char if (set_get(s, LONG_TO_PTR(pid)) == LONG_TO_PTR(pid)) continue; + /* Ignore kernel threads. Since they can only + * exist in the root cgroup, we only check for + * them there. */ + if (cfrom && + (isempty(pfrom) || path_equal(pfrom, "/")) && + is_kernel_thread(pid) > 0) + continue; + r = cg_attach(cto, pto, pid); if (r < 0) { if (ret >= 0 && r != -ESRCH)