inotify 的 sysctl setting

最後更新: 2020-04-06





# Defaut: 8192



echo "fs.inotify.max_user_watches=81920" >> /etc/sysctl.conf

sysctl -p


cat /proc/sys/fs/inotify/max_user_watches


Open file descriptors can by listed via procfs:

ls -al /proc/<application process number>/fd/




# Defaut: 128


An "instance" is single file descriptor, returned by inotify_init().

A single inotify file descriptor can be used by one process or shared by multiple processes,

so they are rationed per-user instead of per-process.

If an application creates too many instances,

it either starts too many processes (and does not share inotify file descriptors between processes),

or it is just plain buggy — for example, it may leak open inotify descriptors (open and then forget about them without closing).