Frage

I am initializing INOTIFY by using inotify_init() and I call read with no mask flags. When I want to use the watch descriptor wd I can see that it is returned with value -1. Reading the man page I can see that this value is set only when the even queue overflowed, BUT only if the call to read has the mas bit IN_Q_OVERFLOW set so It is not my case.

What the reason could be to have a wd set to -1? On top of that I don't have -1 returned by read so this means NO ERROR during this process.

War es hilfreich?

Lösung

Then you misread the manual, inotify_init(2) clearly says:

On success, these system calls return a new file descriptor. On error, -1 is returned, and errno is set to indicate the error.

So look in errono, to see what you are doing wrong.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top