Skip to content

Commit d436a96

Browse files
committed
Check memory.events file exists before adding inotify watch
Fixes #620 Signed-off-by: Jindrich Novy <[email protected]>
1 parent 9952ef5 commit d436a96

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/cgroup.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,11 @@ static void setup_oom_handling_cgroup_v2(int pid)
124124
}
125125

126126
if (inotify_add_watch(ifd, memory_events_file_path, IN_MODIFY) < 0) {
127-
nwarnf("Failed to add inotify watch for %s", memory_events_file_path);
127+
if (errno == ENOENT) {
128+
ndebugf("memory.events file does not exist at %s, skipping OOM monitoring", memory_events_file_path);
129+
} else {
130+
nwarnf("Failed to add inotify watch for %s", memory_events_file_path);
131+
}
128132
return;
129133
}
130134

0 commit comments

Comments
 (0)