I want my code to be notified when any file under (either directly or indirectly) a given directory is modified. By \"modified\", I mean I want my code to be notified whenever
You might want to check out man fs_usage, though it's not specific to a directory and requires root privileges.
man fs_usage