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)
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)
return cg_path_get_unit(t, ret);
}
-/// UNNEDED by elogind
-#if 0
int cg_pid_get_user_unit(pid_t pid, char **unit) {
_cleanup_free_ char *cgroup = NULL;
int r;
return cg_path_get_user_unit(cgroup, unit);
}
-#endif // 0
int cg_path_get_machine_name(const char *path, char **machine) {
_cleanup_free_ char *u = NULL, *sl = NULL;
return readlink_malloc(sl, machine);
}
-/// UNNEDED by elogind
-#if 0
int cg_pid_get_machine_name(pid_t pid, char **machine) {
_cleanup_free_ char *cgroup = NULL;
int r;
return cg_path_get_machine_name(cgroup, machine);
}
-#endif // 0
int cg_path_get_session(const char *path, char **session) {
_cleanup_free_ char *unit = NULL;
return 0;
}
-/// UNNEDED by elogind
-#if 0
int cg_pid_get_owner_uid(pid_t pid, uid_t *uid) {
_cleanup_free_ char *cgroup = NULL;
int r;
return cg_path_get_owner_uid(cgroup, uid);
}
-#endif // 0
int cg_path_get_slice(const char *p, char **slice) {
const char *e = NULL;