comparison m4/stat-time.m4 @ 8567:f7fc3652bfc5

* lib/stat-time.h (USE_BIRTHTIME): Remove. (get_stat_atime_ns, get_stat_ctime_ns, get_stat_mtime_ns): (get_stat_birthtime_ns): Do not try to use "spare" fields. (get_stat_birthtime_ns): Simplify compile-time tests. (get_stat_birthtime): Change the API to look like get_stat_mtime etc., except return a negative tv_nsec on error. * m4/stat-time.m4 (gl_STAT_TIME, gl_STAT_BIRTHTIME): Don't check for "spare" fields. (gl_STAT_BIRTHTIME): Don't check for struct stat.st_birthtimespec.tv_sec or for struct stat.st_birthtime, as these tests aren't used. * tests/test-stat-time.c (test_birthtime): Adjust to new API.
author Paul Eggert <eggert@cs.ucla.edu>
date Tue, 27 Mar 2007 18:51:17 +0000
parents c49cf515502f
children 392970b32717
comparison
equal deleted inserted replaced
8566:47ac12cd6649 8567:f7fc3652bfc5
11 11
12 # st_atim.tv_nsec - Linux, Solaris 12 # st_atim.tv_nsec - Linux, Solaris
13 # st_atimespec.tv_nsec - FreeBSD, NetBSD, if ! defined _POSIX_SOURCE 13 # st_atimespec.tv_nsec - FreeBSD, NetBSD, if ! defined _POSIX_SOURCE
14 # st_atimensec - FreeBSD, NetBSD, if defined _POSIX_SOURCE 14 # st_atimensec - FreeBSD, NetBSD, if defined _POSIX_SOURCE
15 # st_atim.st__tim.tv_nsec - UnixWare (at least 2.1.2 through 7.1) 15 # st_atim.st__tim.tv_nsec - UnixWare (at least 2.1.2 through 7.1)
16 # st_spare1 - Cygwin?
17 16
18 # st_birthtimespec present on NetBSD (probably also FreBSD, OpenBSD) 17 # st_birthtimespec - FreeBSD, NetBSD (hidden on OpenBSD 3.9, anyway)
19 18
20 AC_DEFUN([gl_STAT_TIME], 19 AC_DEFUN([gl_STAT_TIME],
21 [ 20 [
22 AC_REQUIRE([AC_C_INLINE]) 21 AC_REQUIRE([AC_C_INLINE])
23 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) 22 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
47 [Define to 1 if the type of the st_atim member of a struct stat is 46 [Define to 1 if the type of the st_atim member of a struct stat is
48 struct timespec.]) 47 struct timespec.])
49 fi], 48 fi],
50 [AC_CHECK_MEMBERS([struct stat.st_atimespec.tv_nsec], [], 49 [AC_CHECK_MEMBERS([struct stat.st_atimespec.tv_nsec], [],
51 [AC_CHECK_MEMBERS([struct stat.st_atimensec], [], 50 [AC_CHECK_MEMBERS([struct stat.st_atimensec], [],
52 [AC_CHECK_MEMBERS([struct stat.st_atim.st__tim.tv_nsec], [], 51 [AC_CHECK_MEMBERS([struct stat.st_atim.st__tim.tv_nsec], [], [],
53 [AC_CHECK_MEMBERS([struct stat.st_spare1], [],
54 [],
55 [#include <sys/types.h>
56 #include <sys/stat.h>])],
57 [#include <sys/types.h> 52 [#include <sys/types.h>
58 #include <sys/stat.h>])], 53 #include <sys/stat.h>])],
59 [#include <sys/types.h> 54 [#include <sys/types.h>
60 #include <sys/stat.h>])], 55 #include <sys/stat.h>])],
61 [#include <sys/types.h> 56 [#include <sys/types.h>
62 #include <sys/stat.h>])], 57 #include <sys/stat.h>])],
63 [#include <sys/types.h> 58 [#include <sys/types.h>
64 #include <sys/stat.h>]) 59 #include <sys/stat.h>])
65 ]) 60 ])
66 61
67 # Checks for st_birthtime, which is a feature from UFS2 (FreeBSD, NetBSD, OpenBSD, etc.) 62 # Check for st_birthtime, a feature from UFS2 (FreeBSD, NetBSD, OpenBSD, etc.).
68 # There was a time when this field was named st_createtime (21 June 2002 to 16 July 2002) 63 # There was a time when this field was named st_createtime (21 June
69 # But that window is very small and applied only to development code, so systems still 64 # 2002 to 16 July 2002) But that window is very small and applied only
70 # using that configuration are not a realistic development target. 65 # to development code, so systems still using that configuration are
71 # See revisions 1.10 and 1.11 of FreeBSD's src/sys/ufs/ufs/dinode.h. 66 # not supported. See revisions 1.10 and 1.11 of FreeBSD's
67 # src/sys/ufs/ufs/dinode.h.
72 # 68 #
73 AC_DEFUN([gl_STAT_BIRTHTIME], 69 AC_DEFUN([gl_STAT_BIRTHTIME],
74 [ 70 [
75 AC_REQUIRE([AC_C_INLINE]) 71 AC_REQUIRE([AC_C_INLINE])
76 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) 72 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
77 AC_CHECK_HEADERS_ONCE([sys/time.h]) 73 AC_CHECK_HEADERS_ONCE([sys/time.h])
78 AC_CHECK_MEMBERS([struct stat.st_birthtimespec.tv_sec, struct stat.st_birthtimespec.tv_nsec], [], 74 AC_CHECK_MEMBERS([struct stat.st_birthtimespec.tv_nsec], [],
79 [AC_CHECK_MEMBERS([struct stat.st_birthtime, struct stat.st_birthtimensec], [], 75 [AC_CHECK_MEMBERS([struct stat.st_birthtimensec], [], [],
80 [AC_CHECK_MEMBERS([struct stat.st_spare4], [],
81 [],
82 [#include <sys/types.h>
83 #include <sys/stat.h>])],
84 [#include <sys/types.h> 76 [#include <sys/types.h>
85 #include <sys/stat.h>])], 77 #include <sys/stat.h>])],
86 [#include <sys/types.h> 78 [#include <sys/types.h>
87 #include <sys/stat.h>]) 79 #include <sys/stat.h>])
88 ]) 80 ])