diff options
author | Dmitry Chestnykh <dm.chestnykh@gmail.com> | 2024-07-20 17:23:45 +0300 |
---|---|---|
committer | Waldemar Brodkorb <wbx@openadk.org> | 2024-07-21 09:09:19 +0200 |
commit | 839bae66a376631ee7d5b1f5b2f5b4094c519ea8 (patch) | |
tree | 3441b2d2c5c70d2180d24855272cd826e1108c09 /libc | |
parent | 1d8ade50e8c5d9727a1f5a8d5af2f5d643a812d3 (diff) |
Fix compilation with 4.x kernel headers
- Fallback to __NR_stat syscall in ld.so if we use 4.x kernel headers.
4.x kernel doesn't support 64-bit time so we can use old syscall
- Add preprocessor conditions to have fstat64 and fstatat64 in libc
with old kernel headers
Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
Diffstat (limited to 'libc')
-rw-r--r-- | libc/sysdeps/linux/common/fstat64.c | 3 | ||||
-rw-r--r-- | libc/sysdeps/linux/common/fstatat64.c | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/libc/sysdeps/linux/common/fstat64.c b/libc/sysdeps/linux/common/fstat64.c index 359c22af6..121b21fc8 100644 --- a/libc/sysdeps/linux/common/fstat64.c +++ b/libc/sysdeps/linux/common/fstat64.c @@ -8,8 +8,9 @@ #include <_lfs_64.h> #include <sys/syscall.h> +#include <linux/version.h> -#if defined(__NR_fstat64) && !defined(__UCLIBC_USE_TIME64__) +#if defined(__NR_fstat64) && (!defined(__UCLIBC_USE_TIME64__) || LINUX_VERSION_CODE <= KERNEL_VERSION(5,1,0)) # include <unistd.h> # include <sys/stat.h> # include "xstatconv.h" diff --git a/libc/sysdeps/linux/common/fstatat64.c b/libc/sysdeps/linux/common/fstatat64.c index 16dbf9215..739e84081 100644 --- a/libc/sysdeps/linux/common/fstatat64.c +++ b/libc/sysdeps/linux/common/fstatat64.c @@ -9,6 +9,7 @@ #include <_lfs_64.h> #include <bits/wordsize.h> #include <sys/syscall.h> +#include <linux/version.h> #if defined __mips__ # include <sgidefs.h> @@ -23,7 +24,7 @@ # define __NR_fstatat64 __NR_newfstatat #endif -#if defined(__NR_fstatat64) && !defined(__UCLIBC_USE_TIME64__) +#if defined(__NR_fstatat64) && (!defined(__UCLIBC_USE_TIME64__) || LINUX_VERSION_CODE <= KERNEL_VERSION(5,1,0)) # include <sys/stat.h> # include "xstatconv.h" int fstatat64(int fd, const char *file, struct stat64 *buf, int flag) |