From: Dmitry V. Levin Date: Tue, 23 Aug 2016 14:27:45 +0000 (+0000) Subject: Do not check for struct stat.st_{a,c}time_nsec X-Git-Tag: v4.14~175 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=788939b4a736663d0489930b6027b239c344865f;p=strace Do not check for struct stat.st_{a,c}time_nsec 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. --- diff --git a/configure.ac b/configure.ac index bbd41109..59a6ec24 100644 --- a/configure.ac +++ b/configure.ac @@ -325,6 +325,12 @@ AC_CHECK_TYPES([struct stat64, struct __old_kernel_stat],,, [#include #include ]) +AC_CHECK_MEMBERS([struct stat.st_mtime_nsec],,, +[#include +#include ]) + +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 #include ]) -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 ]) AC_CHECK_MEMBERS([struct utsname.domainname],,, [#include ]) -AC_CHECK_MEMBERS(m4_normalize([ - struct stat.st_atime_nsec, - struct stat.st_ctime_nsec, - struct stat.st_mtime_nsec -]),,, [#include -#include ]) - AC_CHECK_MEMBERS(m4_normalize([ siginfo_t.si_syscall, siginfo_t.si_timerid, diff --git a/file.c b/file.c index 40f64060..30c2c239 100644 --- a/file.c +++ b/file.c @@ -88,10 +88,6 @@ #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 diff --git a/printstat.h b/printstat.h index 5786b61b..f643fd0c 100644 --- a/printstat.h +++ b/printstat.h @@ -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 diff --git a/tests/xstatx.c b/tests/xstatx.c index f23d0cd7..76b0ffb1 100644 --- a/tests/xstatx.c +++ b/tests/xstatx.c @@ -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