mirror of
https://github.com/troglobit/finit.git
synced 2026-10-01 05:22:48 +07:00
cgroup: don't warn on cgroup.events EINVAL for top-level groups
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
+17
-1
@@ -94,8 +94,24 @@ int iwatch_add(struct iwatch *iw, char *file, uint32_t mask)
|
|||||||
|
|
||||||
wd = inotify_add_watch(iw->fd, path, IWATCH_MASK | mask);
|
wd = inotify_add_watch(iw->fd, path, IWATCH_MASK | mask);
|
||||||
if (wd < 0) {
|
if (wd < 0) {
|
||||||
if (errno != EEXIST)
|
switch (errno) {
|
||||||
|
case EEXIST:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EINVAL:
|
||||||
|
/*
|
||||||
|
* some older kernels, notably 4.19, don't like
|
||||||
|
* inotify on top-level cgroups in cgroup v2
|
||||||
|
*/
|
||||||
|
if (!strncmp(path, "/sys/fs/cgroup", 14))
|
||||||
|
break; /* ignore error */
|
||||||
|
/* fallthrough */
|
||||||
|
|
||||||
|
default:
|
||||||
_pe("Failed adding watcher for %s", path);
|
_pe("Failed adding watcher for %s", path);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
free(path);
|
free(path);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user