[PATCH] Use syscall instead of the glibc wrapper to call fstatat

Dmitry V. Levin ldv at altlinux.org
Fri Jan 13 20:38:06 UTC 2017


On Fri, Jan 13, 2017 at 05:33:07AM +0300, Dmitry V. Levin wrote:
> On Wed, Jan 11, 2017 at 02:25:56PM +0000, James Cowgill wrote:
> > The newfstatat testcase on mips64 currently fails because:
> > - The BOGUS_STRUCT_STAT test segfaults inside glibc.
> > - The result of the fstatat call gives incorrect dates because the
> >   kernel struct stat uses unsigned int timestamps.
> > 
> > Fix by using avoiding the glibc wrapper and using the relevant syscall
> > directly. This obviously avoids the first problem, and avoids the second
> > problem because print_stat always sign extends dates (unlike glibc which
> > will zero extend them).
> 
> Unfortunately, this makes fstatat64.test fail on x86
> because of struct stat mismatch.
> 
> If tests/fstatat.c is changed to define USE_ASM_STAT, then
> tests/fstatat64.c would need more stat64 related definitions
> (like in tests/fstat64.c), and I cannot tell off-hand whether
> fstatat64 takes struct stat64 on all platforms like it's declared
> in kernel's include/linux/syscalls.h file.
> 
> btw, tests/fstatat.c is the last user of tests/xstatx.c that
> does not define USE_ASM_STAT yet.

OK, I've changed both newfstatat and fstatat64 tests to invoke syscalls
directly.


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20170113/42cf78a4/attachment.bin>


More information about the Strace-devel mailing list