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

Karl Vogel karl.vogel at gmail.com
Sat Oct 4 17:24:38 BST 2014


On Sat, Oct 4, 2014 at 6:10 PM, Karl Vogel <karl.vogel at gmail.com> wrote:
> On Fri, Oct 3, 2014 at 10:08 PM, Simon Kelley <simon at thekelleys.org.uk> wrote:
>> On 30/09/14 15:02, Karl Vogel wrote:
>>> First version of the patch generated a compiler warning due
>>> to improper initialization of a variable.
>>>
>>> Karl Vogel (1):
>>>   Use nanosecond granularity when checking for file changes.
>>>
>>>  src/dnsmasq.c |   20 +++++++++++---------
>>>  src/dnsmasq.h |    7 ++++++-
>>>  src/option.c  |    3 ++-
>>>  3 files changed, 19 insertions(+), 11 deletions(-)
>>>
>>>
>>
>> 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? This Ubuntu 14.04 system has the
>> nanosecond fields in the headers, but not in  the stat(3) manpage :(
>
> According to the linux man page, "nanosecond timestamps are nowadays
> standardized, starting with POSIX.1-2008". (supported since kernel 2.5.48)
>
>   http://man7.org/linux/man-pages/man2/stat.2.html
>
> It is also present in uClibC (I actually needed the patch for my OpenWRT
> gateway, which uses uclibc).
>
> I'm not sure what the status is of the BSD's.

Checked in FreeBSD:

 https://svnweb.freebsd.org/base?view=revision&revision=205792

Date: Sun Mar 28 13:13:22 2010 UTC (4 years, 6 months ago)

"
Rename st_*timespec fields to st_*tim for POSIX 2008 compliance.

A nice thing about POSIX 2008 is that it finally standardizes a way to
obtain file access/modification/change times in sub-second precision,
namely using struct timespec, which we already have for a very long
time. Unfortunately POSIX uses different names.

This commit adds compatibility macros, so existing code should still
build properly. Also change all source code in the kernel to work
without any of the compatibility macros. This makes it all a less
ambiguous.

I am also renaming st_birthtime to st_birthtim, even though it was a
local extension anyway. It seems Cygwin also has a st_birthtim.
"



More information about the Dnsmasq-discuss mailing list