Skip to content

Instantly share code, notes, and snippets.

View dirkfeytons's full-sized avatar

Dirk Feytons dirkfeytons

View GitHub Profile
@dirkfeytons
dirkfeytons / inotify.c
Last active February 25, 2021 21:17
Seeing which inotify watches are being created
/*
* If you want to see which inotify watches are being created by an application then you can
* use this simple piece of code, compile it to a shared library and LD_PRELOAD it when starting
* the application. Keep an eye on syslog to see the list of watches.
* **NOTE**: this only logs the watches, it won't actually create the watch and thus watching
* for changes WON'T actually WORK!
*
* More details (adjust as needed for your environment/distribution):
* - Save this file in e.g. $HOME/inotify.c
* - Compile: gcc -shared -o inotify.so inotify.c