From 7b9bc44e63a24fd1d569b2bd56c1fe3b42a9ffce Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Thu, 8 Jan 2015 04:06:06 +0000 Subject: [PATCH] Use AC_CHECK_TYPES to check for struct stat64 * m4/stat.m4: Remove. * configure.ac (AC_STAT64): Remove. (AC_CHECK_TYPES): Add struct stat64. * file.c: Replace HAVE_STAT64 with HAVE_STRUCT_STAT64. --- configure.ac | 3 ++- file.c | 14 +++++++------- m4/stat.m4 | 16 ---------------- 3 files changed, 9 insertions(+), 24 deletions(-) delete mode 100644 m4/stat.m4 diff --git a/configure.ac b/configure.ac index 5b0a38ff..055b2583 100644 --- a/configure.ac +++ b/configure.ac @@ -191,7 +191,6 @@ AC_CHECK_MEMBERS(m4_normalize([ struct stat.st_gen, struct stat.st_rdev ])) -AC_STAT64 AC_STATFS64 AC_TYPE_SIGNAL @@ -260,6 +259,8 @@ AC_CHECK_HEADERS([netinet/tcp.h netinet/udp.h],,, [#include ]) AC_CHECK_TYPES([struct mmsghdr],,, [#include ]) AC_CHECK_MEMBERS([struct msghdr.msg_control],,, [#include ]) +AC_CHECK_TYPES([struct stat64],,, [#include +#include ]) AC_CHECK_TYPES([struct __old_kernel_stat],,, [#include ]) AC_CHECK_TYPES([struct pt_all_user_regs, struct ia64_fpreg, struct ptrace_peeksiginfo_args],,, diff --git a/file.c b/file.c index 92ebcd6c..ae74d5ab 100644 --- a/file.c +++ b/file.c @@ -299,7 +299,7 @@ sys_fstat(struct tcb *tcp) return 0; } -#if defined STAT32_PERSONALITY && !defined HAVE_STAT64 +#if defined STAT32_PERSONALITY && !defined HAVE_STRUCT_STAT64 # if defined AARCH64 || defined X86_64 || defined X32 /* * Linux x86_64 and x32 have unified `struct stat' but their i386 personality @@ -338,13 +338,13 @@ struct stat64 { # define STAT64_SIZE 104 # endif ; -# define HAVE_STAT64 1 +# define HAVE_STRUCT_STAT64 1 # else /* !(AARCH64 || X86_64 || X32) */ # warning FIXME: check whether struct stat64 definition is needed for this architecture! # endif -#endif /* STAT32_PERSONALITY && !HAVE_STAT64 */ +#endif /* STAT32_PERSONALITY && !HAVE_STRUCT_STAT64 */ -#ifdef HAVE_STAT64 +#ifdef HAVE_STRUCT_STAT64 # define DO_PRINTSTAT do_printstat64 # define STRUCT_STAT struct stat64 @@ -424,7 +424,7 @@ sys_fstat64(struct tcb *tcp) return sys_fstat(tcp); } -#endif /* HAVE_STAT64 */ +#endif /* HAVE_STRUCT_STAT64 */ int sys_newfstatat(struct tcb *tcp) @@ -439,11 +439,11 @@ sys_newfstatat(struct tcb *tcp) printstat64(tcp, tcp->u_arg[2]); else printstat(tcp, tcp->u_arg[2]); -#elif defined HAVE_STAT64 +#elif defined HAVE_STRUCT_STAT64 printstat64(tcp, tcp->u_arg[2]); #else printstat(tcp, tcp->u_arg[2]); -#endif /* STAT32_PERSONALITY || HAVE_STAT64 */ +#endif /* STAT32_PERSONALITY || HAVE_STRUCT_STAT64 */ tprints(", "); printflags(at_flags, tcp->u_arg[3], "AT_???"); } diff --git a/m4/stat.m4 b/m4/stat.m4 deleted file mode 100644 index bf0e480e..00000000 --- a/m4/stat.m4 +++ /dev/null @@ -1,16 +0,0 @@ -dnl ### A macro to determine whether stat64 is defined. -AC_DEFUN([AC_STAT64], -[AC_MSG_CHECKING(for stat64 in (asm|sys)/stat.h) -AC_CACHE_VAL(ac_cv_type_stat64, -[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#include -#include -#include -]], [[struct stat64 st;]])],[ac_cv_type_stat64=yes],[ac_cv_type_stat64=no])]) -AC_MSG_RESULT($ac_cv_type_stat64) -if test "$ac_cv_type_stat64" = yes -then - AC_DEFINE([HAVE_STAT64], 1, -[Define if stat64 is available in asm/stat.h.]) -fi -]) -- 2.40.0