November 24, 2024, 05:18:31 PM

News : LinuxSolved.com Linux Help Community Forum..


Author Topic: inotify_rm_watch returns EINVAL on legitimate call  (Read 6986 times)

Offline intcwrtr

  • New Member
  • Posts: 1
inotify_rm_watch returns EINVAL on legitimate call
« on: July 30, 2011, 03:01:25 PM »
I am working on software that is to run on a variety of different linux machines where changing the os/version is not an option.

My software uses the inotify_rm_watch call, and this is occasionally failing.
In every case the operands are both valid, yet the result is EINVAL.

This appears to only occur when a watched file is deleted, AND  the read command on the inotify yields two events IN_DELETE_SELF AND IN_IGNORE (at the same time).

On occasion, my software works fine, on other occasions, the inotify_rm_watch fails, and after the file is re-created, I get no further events on that file and I can not re-add it to the inotify_watch.   

People have said I do not need to use inotify_rm_watch when the file is deleted .. it is done automatically.  The results I have seen are NOT consistent AND in the end it just does not work.  To be clearer, the inotify_rm_watch call fails about 20% after the watched file is deleted.


I have seen a few messages detailing this same scenario - but no workarounds. Any suggestions ?



Thanks
 ???