4

I want to get a notification whenever a new process is created.

I've tried to use inotify on /proc, but it didn't report any event even though a new directory appeared in /proc.

I could list the /proc directory in a loop and check if one more directory appeared, but I'm looking for a better solution.

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
linuser
  • 126
  • 1
  • 8
  • 2
    WRT why inotify won't necessarily work on procfs or sysfs nodes: http://raspberrypi.stackexchange.com/a/26377/5538 <- Substitute "procfs" for "sysfs" in the explanation. They are the same in this context, namely, they don't *contain* information, they supply it when read. So if you are just watching for a change in meta-information associated with the a node (which inotify does), there won't be one. – goldilocks Jan 06 '15 at 15:50
  • Is your program running as root? What do you want to do with the notifications? – Gilles 'SO- stop being evil' Jan 06 '15 at 23:03
  • No, it's not under root. My program just notify me if new process is created. I even don't know for what need root in /proc. There is not way to write ( even under root ) but read you can do from ordinary user. NOTE: root needs only in root's processes. – linuser Jan 06 '15 at 23:58

0 Answers0