summaryrefslogtreecommitdiff
path: root/ldso/include/dl-syscall.h
diff options
context:
space:
mode:
authorDmitry Chestnykh <dm.chestnykh@gmail.com>2024-07-20 17:23:45 +0300
committerWaldemar Brodkorb <wbx@openadk.org>2024-07-21 09:09:19 +0200
commit839bae66a376631ee7d5b1f5b2f5b4094c519ea8 (patch)
tree3441b2d2c5c70d2180d24855272cd826e1108c09 /ldso/include/dl-syscall.h
parent1d8ade50e8c5d9727a1f5a8d5af2f5d643a812d3 (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 'ldso/include/dl-syscall.h')
-rw-r--r--ldso/include/dl-syscall.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/ldso/include/dl-syscall.h b/ldso/include/dl-syscall.h
index 4f41034ad..9ec0eac60 100644
--- a/ldso/include/dl-syscall.h
+++ b/ldso/include/dl-syscall.h
@@ -17,6 +17,8 @@ extern int _dl_errno;
#define __set_errno(X) {(_dl_errno) = (X);}
#endif
+#include <linux/version.h>
+
/* Pull in the arch specific syscall implementation */
#include <dl-syscalls.h>
/* For MAP_ANONYMOUS -- differs between platforms */
@@ -139,7 +141,7 @@ static __always_inline int _dl_stat(const char *file_name,
{
return _dl_newfstatat(AT_FDCWD, file_name, buf, 0);
}
-#elif defined __NR_stat && (!defined(__UCLIBC_USE_TIME64__) || defined(__sparc__))
+#elif defined __NR_stat && (!defined(__UCLIBC_USE_TIME64__) || defined(__sparc__)) || (LINUX_VERSION_CODE <= KERNEL_VERSION(5,1,0))
# define __NR__dl_stat __NR_stat
static __always_inline _syscall2(int, _dl_stat, const char *, file_name,
struct stat *, buf)