Linux.com

intcwrtr

intcwrtr

  • Linux.com Member
  • Posts: 1
  • Member Since: 30 Jul 11
  • Last Logged In: 01 Aug 11

Latest Posts

Posted by
Topic
Post Preview
Posted
  • intcwrtr
    inotify_rm_watch returns EINVAL on legitimate call
    inotify_rm_watch returns EINVAL on legitimate call 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 ? This happens on a few machines, including one with kernel 2.6.27. Thanks
    Link to this post 01 Aug 11

    inotify_rm_watch returns EINVAL on legitimate call

    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 ?

    This happens on a few machines, including one with kernel 2.6.27.


    Thanks

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board