Support syscalls ftruncate64, stat64, lstat64, fstat64, and fcntl64
rick-masters opened this issue · 1 comments
These syscalls are needed for musl support because musl defaults to using 64-bit versions of these system calls.
The definition of the stat64 structure is derived from here:
https://git.musl-libc.org/cgit/musl/tree/arch/i386/bits/stat.h
The size of underlying types are determined from here:
https://git.musl-libc.org/cgit/musl/tree/include/alltypes.h.in
https://git.musl-libc.org/cgit/musl/tree/arch/i386/bits/alltypes.h.in
Test programs are attached. The first test program uses ftruncate64 to truncate a file to 100 bytes and then calls the three new stat calls to get the size. The second program calls fcntl64 to set close-on-exec for a file handle, then spawns checkfd to verify that the handle is closed.
This is the expected output:
[(root) ~]# tar xf test64.tar.gz
[(root) ~]# ./runtest.sh
1000+0 records in
1000+0 records out
1000 bytes (1.0 kB) copied, 0.003208 s, 312 kB/s
stat64: file size is 100
lstat64: file size is 100
fstat64: file size is 100
-rw-r--r-- 1 root root 100 Nov 28 16:48 testfile.bin
myfile = 3
mydupfd = 4
mycheck result = -1
Thank you very much.