]> granicus.if.org Git - strace/commitdiff
tests: call newfstatat and fstatat64 syscalls directly
authorDmitry V. Levin <ldv@altlinux.org>
Fri, 13 Jan 2017 19:54:57 +0000 (19:54 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Fri, 13 Jan 2017 19:54:57 +0000 (19:54 +0000)
Do not use glibc wrappers to call newfstatat and fstatat64.
These wrappers have various problems, e.g. they segfault on sparc64
and mips64 if BOGUS_STRUCT_STAT is not disabled, and they do wrong
conversion of timestamps on mips64.

* tests/fstatat.c (TEST_SYSCALL_INVOKE): Invoke the relevant syscall
directly.
(USE_ASM_STAT): Define.
* tests/fstatat64.c (TEST_BOGUS_STRUCT_STAT): Remove.
(STRUCT_STAT, STRUCT_STAT_STR, STRUCT_STAT_IS_STAT64): Define.

Based on patch by James Cowgill <james410@cowgill.org.uk>.

tests/fstatat.c
tests/fstatat64.c

index ec55ca04dd7eb96a48f86e2d857929ad7e70322a..3981b4ecbc7b9e2645e13f2c30b3b6da6103ed47 100644 (file)
@@ -28,7 +28,7 @@
 #ifdef HAVE_FSTATAT
 
 # define TEST_SYSCALL_INVOKE(sample, pst) \
-       fstatat(AT_FDCWD, sample, pst, AT_SYMLINK_NOFOLLOW)
+       syscall(TEST_SYSCALL_NR, AT_FDCWD, sample, pst, AT_SYMLINK_NOFOLLOW)
 # define PRINT_SYSCALL_HEADER(sample) \
        do { \
                int saved_errno = errno; \
@@ -38,6 +38,8 @@
                printf(", AT_SYMLINK_NOFOLLOW) = %s\n", sprintrc(rc)); \
        } while (0)
 
+# define USE_ASM_STAT
+
 # include "xstatx.c"
 
 #else
index 96786412806d6e2a9d976d7595087d8495c82a1c..03082a8fbb516143fceb83ca66bc00739835a991 100644 (file)
@@ -32,9 +32,9 @@
 
 # define TEST_SYSCALL_NR __NR_fstatat64
 # define TEST_SYSCALL_STR "fstatat64"
-# if defined __GLIBC__ && defined __sparc__ && defined __arch64__
-#  define TEST_BOGUS_STRUCT_STAT 0
-# endif
+# define STRUCT_STAT struct stat64
+# define STRUCT_STAT_STR "struct stat64"
+# define STRUCT_STAT_IS_STAT64 1
 # include "fstatat.c"
 
 #else