Can you use `inotify` with `/sys/fs/cgroup/pids.peak`?
0
votes
1
answer
66
views
I am trying to implement a program that would run as PID1 in a Podman container and would wait for the the user to
podman exec
into the container at least once before exiting. /sys/fs/cgroup/pids.peak
inside the container seems to expose this info, but how do I query it efficiently? man 7 cgroup
has the following to say:
> The cgroup.events file can be monitored, in order to receive notification when the value of one of its keys changes. Such monitoring can be done using inotify(7), which notifies changes as IN_MODIFY events, or poll(2), which notifies changes by returning the POLLPRI and POLLERR bits in the revents field.
However, the cgroup.events
isn't suitable for my purposes because my PID1 prevents the container cgroup from ever being empty and thus the file never changes. I've tried running inotifywait -m /sys/fs/cgroup/pids.peak
to rule out bugs in my code but even then IN_MODIFY
events are never triggered.
Asked by user11589013
(1 rep)
Mar 29, 2025, 02:52 PM
Last activity: Mar 29, 2025, 05:01 PM
Last activity: Mar 29, 2025, 05:01 PM