How to watch and read a file that another process is appending to?

Carlo Wood carlo at alinoe.com
Wed Jul 25 20:06:39 CEST 2018


Hi,

can you please answer this question that I posted on
Stack Overflow: 

https://stackoverflow.com/questions/51524848/how-to-read-a-nonblocking-filedescriptor-of-a-file-that-is-appended-to-aka-lik


Quote:
	 When I add a watcher to read a file and all data has been read
then I do get a call back that there is data to read, but read(2)
returns 0 (EOF). At that point I have to stop the watcher or else it
will continue to tell me that there is something to read. However, if I
stop the watcher and then some other process appends data to that file
then I'll never see it.

What is the correct way to get notified that there is
additional/appended data in a file that can be read when before I
already read till the end?

-- 
Carlo Wood <carlo at alinoe.com>



More information about the libev mailing list