tests: call newfstatat and fstatat64 syscalls directly

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>.
This commit is contained in:
Дмитрий Левин 2017-01-13 19:54:57 +00:00
parent 3fb78d7305
commit e72b9262eb
2 changed files with 6 additions and 4 deletions

View 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

View 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