]> granicus.if.org Git - strace/commitdiff
Do not check for struct stat.st_{a,c}time_nsec
authorDmitry V. Levin <ldv@altlinux.org>
Tue, 23 Aug 2016 14:27:45 +0000 (14:27 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 23 Aug 2016 15:06:34 +0000 (15:06 +0000)
Assume that the check for struct stat.st_mtime_nsec is enough.
Likewise, do not check for struct stat.st_{a,c}tim.tv_nsec.

* configure.ac (AC_CHECK_MEMBERS): Remove struct stat.st_atime_nsec,
struct stat.st_ctime_nsec, struct stat.st_atim.tv_nsec,
and struct stat.st_ctim.tv_nsec.
* file.c (HAVE_STRUCT_STAT_ST_ATIME_NSEC,
HAVE_STRUCT_STAT_ST_CTIME_NSEC): Remove.
* printstat.h (HAVE_STRUCT_STAT_ST_ATIME_NSEC,
HAVE_STRUCT_STAT_ST_CTIME_NSEC): Replace with
HAVE_STRUCT_STAT_ST_MTIME_NSEC.
* tests/xstatx.c: Likewise.

configure.ac
file.c
printstat.h
tests/xstatx.c

index bbd411090206f4d472d4af6b5ad96e495a71fde9..59a6ec24631072489fa5bb767043c365ee61e636 100644 (file)
@@ -325,6 +325,12 @@ AC_CHECK_TYPES([struct stat64, struct __old_kernel_stat],,,
 [#include <sys/types.h>
 #include <asm/stat.h>])
 
+AC_CHECK_MEMBERS([struct stat.st_mtime_nsec],,,
+[#include <sys/types.h>
+#include <asm/stat.h>])
+
+AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec])
+
 AC_CHECK_TYPES(m4_normalize([
        struct pt_all_user_regs,
        struct ia64_fpreg,
@@ -340,23 +346,10 @@ AC_CHECK_TYPES(m4_normalize([
 [#include <sys/types.h>
 #include <linux/fcntl.h>])
 
-AC_CHECK_MEMBERS(m4_normalize([
-       struct stat.st_atim.tv_nsec,
-       struct stat.st_ctim.tv_nsec,
-       struct stat.st_mtim.tv_nsec
-]))
-
 AC_CHECK_MEMBERS([struct timex.tai],,, [#include <sys/timex.h>])
 
 AC_CHECK_MEMBERS([struct utsname.domainname],,, [#include <sys/utsname.h>])
 
-AC_CHECK_MEMBERS(m4_normalize([
-       struct stat.st_atime_nsec,
-       struct stat.st_ctime_nsec,
-       struct stat.st_mtime_nsec
-]),,, [#include <sys/types.h>
-#include <asm/stat.h>])
-
 AC_CHECK_MEMBERS(m4_normalize([
        siginfo_t.si_syscall,
        siginfo_t.si_timerid,
diff --git a/file.c b/file.c
index 40f640607bb087de0c1c4fa3c303c53ea825df34..30c2c239b9c20adaca2cb0aa2e6093becfea9d49 100644 (file)
--- a/file.c
+++ b/file.c
 #include "printstat.h"
 
 /* all locally defined structures provide these fields */
-#undef HAVE_STRUCT_STAT_ST_ATIME_NSEC
-#define HAVE_STRUCT_STAT_ST_ATIME_NSEC 1
-#undef HAVE_STRUCT_STAT_ST_CTIME_NSEC
-#define HAVE_STRUCT_STAT_ST_CTIME_NSEC 1
 #undef HAVE_STRUCT_STAT_ST_MTIME_NSEC
 #define HAVE_STRUCT_STAT_ST_MTIME_NSEC 1
 
index 5786b61b80a5ddacb05eca36c27bc527db42afa8..f643fd0cfe777a6868e76d82eb7a34e1d41cea8a 100644 (file)
@@ -88,7 +88,7 @@ DO_PRINTSTAT(struct tcb *tcp, const STRUCT_STAT *statbuf)
                tprints(", st_atime=");
                tprints(sprinttime(cast ? (time_t) (int) statbuf->st_atime:
                                          (time_t) statbuf->st_atime));
-#ifdef HAVE_STRUCT_STAT_ST_ATIME_NSEC
+#ifdef HAVE_STRUCT_STAT_ST_MTIME_NSEC
                if (statbuf->st_atime_nsec)
                        tprintf(".%09lu", (unsigned long) statbuf->st_atime_nsec);
 #endif
@@ -102,7 +102,7 @@ DO_PRINTSTAT(struct tcb *tcp, const STRUCT_STAT *statbuf)
                tprints(", st_ctime=");
                tprints(sprinttime(cast ? (time_t) (int) statbuf->st_ctime:
                                          (time_t) statbuf->st_ctime));
-#ifdef HAVE_STRUCT_STAT_ST_CTIME_NSEC
+#ifdef HAVE_STRUCT_STAT_ST_MTIME_NSEC
                if (statbuf->st_ctime_nsec)
                        tprintf(".%09lu", (unsigned long) statbuf->st_ctime_nsec);
 #endif
index f23d0cd715d1ba757da4f18a84064cb417feb145..76b0ffb1171e56bf0de2ad73420b5fe7aa06bc5f 100644 (file)
@@ -119,32 +119,20 @@ typedef off_t libc_off_t;
 #  define uid_t __kernel_uid_t
 #  include "asm_stat.h"
 #  if STRUCT_STAT_IS_STAT64
-#   undef HAVE_STRUCT_STAT_ST_ATIME_NSEC
-#   define HAVE_STRUCT_STAT_ST_ATIME_NSEC 1
-#   undef HAVE_STRUCT_STAT_ST_CTIME_NSEC
-#   define HAVE_STRUCT_STAT_ST_CTIME_NSEC 1
 #   undef HAVE_STRUCT_STAT_ST_MTIME_NSEC
 #   define HAVE_STRUCT_STAT_ST_MTIME_NSEC 1
 #  endif /* STRUCT_STAT_IS_STAT64 */
-# else
-#  undef HAVE_STRUCT_STAT_ST_ATIME_NSEC
-#  ifdef HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC
-#   define HAVE_STRUCT_STAT_ST_ATIME_NSEC 1
-#   undef st_atime_nsec
-#   define st_atime_nsec st_atim.tv_nsec
-#  endif
+# else /* !USE_ASM_STAT */
 #  undef HAVE_STRUCT_STAT_ST_MTIME_NSEC
 #  ifdef HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
 #   define HAVE_STRUCT_STAT_ST_MTIME_NSEC 1
-#   undef st_mtime_nsec
-#   define st_mtime_nsec st_mtim.tv_nsec
-#  endif
-#  undef HAVE_STRUCT_STAT_ST_CTIME_NSEC
-#  ifdef HAVE_STRUCT_STAT_ST_CTIM_TV_NSEC
-#   define HAVE_STRUCT_STAT_ST_CTIME_NSEC 1
+#   undef st_atime_nsec
+#   define st_atime_nsec st_atim.tv_nsec
 #   undef st_ctime_nsec
 #   define st_ctime_nsec st_ctim.tv_nsec
-#  endif
+#   undef st_mtime_nsec
+#   define st_mtime_nsec st_mtim.tv_nsec
+#  endif /* HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC */
 # endif
 
 static void
@@ -197,7 +185,7 @@ print_stat(const STRUCT_STAT *st)
 
        printf(", st_atime=");
        print_time(st->st_atime);
-# ifdef HAVE_STRUCT_STAT_ST_ATIME_NSEC
+# ifdef HAVE_STRUCT_STAT_ST_MTIME_NSEC
        if (st->st_atime_nsec)
                printf(".%09lu", (unsigned long) st->st_atime_nsec);
 # endif
@@ -209,7 +197,7 @@ print_stat(const STRUCT_STAT *st)
 # endif
        printf(", st_ctime=");
        print_time(st->st_ctime);
-# ifdef HAVE_STRUCT_STAT_ST_CTIME_NSEC
+# ifdef HAVE_STRUCT_STAT_ST_MTIME_NSEC
        if (st->st_ctime_nsec)
                printf(".%09lu", (unsigned long) st->st_ctime_nsec);
 # endif