mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-14 01:39:59 -04:00
[v9_10] nanosecond-accurate file modification times
4361. [cleanup] Where supported, file modification times returned by isc_file_getmodtime() are now accurate to the nanosecond. [RT #41968]
This commit is contained in:
parent
525dc475ee
commit
19a4cb16fc
5 changed files with 53 additions and 4 deletions
4
CHANGES
4
CHANGES
|
|
@ -1,3 +1,7 @@
|
|||
4361. [cleanup] Where supported, file modification times returned
|
||||
by isc_file_getmodtime() are now accurate to the
|
||||
nanosecond. [RT #41968]
|
||||
|
||||
4360. [bug] Silence spurious 'bad key type' message when there is
|
||||
a existing TSIG key. [RT #42195]
|
||||
|
||||
|
|
|
|||
29
configure
vendored
29
configure
vendored
|
|
@ -722,6 +722,7 @@ IRS_PLATFORM_USEDECLSPEC
|
|||
LWRES_PLATFORM_USEDECLSPEC
|
||||
ISC_PLATFORM_USEDECLSPEC
|
||||
ISC_PLATFORM_RLIMITTYPE
|
||||
ISC_PLATFORM_HAVESTATNSEC
|
||||
ISC_PLATFORM_HAVESYSUNH
|
||||
LWRES_PLATFORM_QUADFORMAT
|
||||
ISC_PLATFORM_QUADFORMAT
|
||||
|
|
@ -19096,6 +19097,34 @@ $as_echo "#define NEED_OPTARG 1" >>confdefs.h
|
|||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
|
||||
#
|
||||
# Check for nanoseconds in file stats
|
||||
#
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking st_mtim.tv_nsec" >&5
|
||||
$as_echo_n "checking st_mtim.tv_nsec... " >&6; }
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#include <sys/fcntl.h>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
struct stat s; return(s.st_mtim.tv_nsec);
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
ISC_PLATFORM_HAVESTATNSEC="#define ISC_PLATFORM_HAVESTATNSEC 1"
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
ISC_PLATFORM_HAVESTATNSEC="#undef ISC_PLATFORM_HAVESTATNSEC"
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
|
||||
|
||||
#
|
||||
# BSD/OS, and perhaps some others, don't define rlim_t.
|
||||
#
|
||||
|
|
|
|||
11
configure.in
11
configure.in
|
|
@ -3485,6 +3485,17 @@ AC_TRY_COMPILE([
|
|||
GEN_NEED_OPTARG="-DNEED_OPTARG=1"
|
||||
AC_DEFINE(NEED_OPTARG, 1, [Defined if extern char *optarg is not declared.])])
|
||||
|
||||
#
|
||||
# Check for nanoseconds in file stats
|
||||
#
|
||||
AC_MSG_CHECKING(st_mtim.tv_nsec)
|
||||
AC_TRY_COMPILE([#include <sys/fcntl.h>],[struct stat s; return(s.st_mtim.tv_nsec);],
|
||||
[AC_MSG_RESULT(yes)
|
||||
ISC_PLATFORM_HAVESTATNSEC="#define ISC_PLATFORM_HAVESTATNSEC 1"],
|
||||
[AC_MSG_RESULT(no)
|
||||
ISC_PLATFORM_HAVESTATNSEC="#undef ISC_PLATFORM_HAVESTATNSEC"])
|
||||
AC_SUBST(ISC_PLATFORM_HAVESTATNSEC)
|
||||
|
||||
#
|
||||
# BSD/OS, and perhaps some others, don't define rlim_t.
|
||||
#
|
||||
|
|
|
|||
|
|
@ -249,6 +249,11 @@
|
|||
*/
|
||||
@ISC_PLATFORM_KRB5HEADER@
|
||||
|
||||
/*
|
||||
* Define if the system has nanosecond-level accuracy in file stats.
|
||||
*/
|
||||
@ISC_PLATFORM_HAVESTATNSEC@
|
||||
|
||||
/*
|
||||
* Type used for resource limits.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -149,11 +149,11 @@ isc_file_getmodtime(const char *file, isc_time_t *modtime) {
|
|||
result = file_stats(file, &stats);
|
||||
|
||||
if (result == ISC_R_SUCCESS)
|
||||
/*
|
||||
* XXXDCL some operating systems provide nanoseconds, too,
|
||||
* such as BSD/OS via st_mtimespec.
|
||||
*/
|
||||
#ifdef ISC_PLATFORM_HAVESTATNSEC
|
||||
isc_time_set(modtime, stats.st_mtime, stats.st_mtim.tv_nsec);
|
||||
#else
|
||||
isc_time_set(modtime, stats.st_mtime, 0);
|
||||
#endif
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue