in reply to nonblocking I/O - testing whether file has more data to read

If there's a version of FAM available for your target OS you might look into SGI::FAM which sits on top of the fam(3X) routines and has shims in the kernel notify a userland daemon when specified files are changed (and the daemon then passes that info back to your program).

  • Comment on Re: nonblocking I/O - testing whether file has more data to read

Replies are listed 'Best First'.
Re: Re: nonblocking I/O - testing whether file has more data to read
by hv (Prior) on Apr 08, 2004 at 22:32 UTC

    Interesting - I noticed this in /usr/include/bits/fcntl.h the other day (as one does), and wondered whether any of them might be useful:

    #ifdef __USE_GNU # define F_SETLEASE 1024 /* Set a lease. */ # define F_GETLEASE 1025 /* Enquire what lease is active. */ # define F_NOTIFY 1026 /* Request notfications on a directory. * +/ #endif

    Prompted by your suggestion, I found that these are actually documented in more recent versions of the fcntl(2) manpage than I have, such as in this HTML version.

    Unfortunately it notifies only of processes opening or truncating a file, and you have to be the owner of the file (or root), which means it isn't very useful for my current needs.

    I see also that there is a fam rpm for my O/S - but while I wasn't able to Google any docs on how to use it, I did find a number of threads about how insecure it was (due to its dependency on portmapper), which makes me reluctant to try it.

    Hugo