[Dnsmasq-discuss] [PATCH v2 0/1] Use nanosecond granularity when checking for file changes.

Roy Marples roy at marples.name
Fri Oct 3 22:47:19 BST 2014


On 2014-10-03 22:13, Roy Marples wrote:
> On 2014-10-03 21:08, Simon Kelley wrote:
>> This looks fine, but I have a vague worry about breaking the build on
>> old C libraries that don't define the st_mtim field. Does anyone know
>> when this entered the standard?
> 
> It's not in *any* accepted standard other than glibc.
> http://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/stat.h.html
> 
> Please #define accordingly, for OS's other than Linux w glibc.

Or tackle the problem a different way:

Store st_mtime, add a 2 second timeout to the event loop to look again 
at the file
If the st_mtime is the same as stored read it, otherwise timeout for 
another 2 seconds.
Once read, poll at normal intervals (whatever they are).

Or go the proper way and use inotify for linux and kevent for BSD and 
get file change notifications rather than the inefficient polling.

Roy



More information about the Dnsmasq-discuss mailing list