mirror of
https://github.com/troglobit/finit.git
synced 2026-11-10 16:31:21 +00:00
Silence cgroup warnings for non-existing PIDs
When the kernel manages to reap a child process before we've moved it to its proper cgroup it will return ESRCH (No such process), we can safely ignore such errors for short-lived processes. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 file changed
+4
-2
+4
-2
@@ -190,7 +190,8 @@ int cgroup_move_pid(const char *group, const char *name, int pid, int delegate)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (rc) {
|
if (rc) {
|
||||||
warn("Failed moving pid %d to cgroup %s", pid, path);
|
if (errno != ESRCH)
|
||||||
|
warn("Failed moving pid %d to cgroup %s", pid, path);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -379,7 +380,8 @@ static int cgroup_leaf_init(const char *group, const char *name, int pid, const
|
|||||||
if (!strcmp(group, "root"))
|
if (!strcmp(group, "root"))
|
||||||
return fnwrite(str("%d", pid), FINIT_CGPATH "/cgroup.procs");
|
return fnwrite(str("%d", pid), FINIT_CGPATH "/cgroup.procs");
|
||||||
|
|
||||||
if (cgroup_move_pid(group, name, pid, delegate))
|
/* Error if error is not "No such process" */
|
||||||
|
if (cgroup_move_pid(group, name, pid, delegate) && errno != ESRCH)
|
||||||
err(1, "Failed moving pid %d to group %s/%s", pid, group, name);
|
err(1, "Failed moving pid %d to group %s/%s", pid, group, name);
|
||||||
|
|
||||||
/* Set up inotify watch for cgroup cleanup */
|
/* Set up inotify watch for cgroup cleanup */
|
||||||
|
|||||||
Reference in new issue
Block a user