While using inotif function in C language to watch a directory, is it possible to get the pid of the process causing an event on the watched folder? I have tried searching but did not get any break through. Or any suggestion. like is there a way using some external function of any other module to get the pid whenever inotif generates an alert. A different module which will compare the event.
Further explaining, inotif will watch the directory for any Create/Modify events. During any events, at the same time we want to identify the process maybe get the PID.
You might not have to install any separate kernel modules for that
You might be aware of the
pscommand in linux which lists all processes there along with ps you cangrepwith your filenameTry using the above command in terminal