Detect when a file has been recreated using a stat watcher

Graham Leggett minfrin at
Thu Dec 11 00:01:00 CET 2008

Marc Lehmann wrote:

>> I would have thought that st_ino would change if the file is recreated,
>> but it doesn't seem to do so.
> Then your filesystem reuses the same inode number.
>> Can anyone confirm what the correct way is to handle this?
> What do you perceive as incorrect? If you are concerned about races, when
> you are not looking fast enough, then there is no way to avoid those.

I want to find a way to detect logfile rotation, so the file gets 
rotated out the way and a new file is created.

I have an fd open to the file, which will never increase in size because 
the file has been deleted, but my app doesn't yet know that.

Is there a way to detect this?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3287 bytes
Desc: S/MIME Cryptographic Signature
URL: <>

More information about the libev mailing list