From: Markos Chandras <markos.chand...@imgtec.com> Signed-off-by: Markos Chandras <markos.chand...@imgtec.com> --- ldso/include/dl-syscall.h | 33 ++++++++++++++++++++++++++++++++- ldso/include/ldso.h | 4 ++++ 2 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/ldso/include/dl-syscall.h b/ldso/include/dl-syscall.h index acfef52..b383f48 100644 --- a/ldso/include/dl-syscall.h +++ b/ldso/include/dl-syscall.h @@ -23,7 +23,7 @@ extern int _dl_errno; /* Pull in whatever this particular arch's kernel thinks the kernel version of * struct stat should look like. It turns out that each arch has a different * opinion on the subject, and different kernel revs use different names... */ -#if defined(__sparc_v9__) && (__WORDSIZE == 64) +#if !defined(__NR_stat) || (defined(__sparc_v9__) && (__WORDSIZE == 64)) #define kernel_stat64 stat #else #define kernel_stat stat @@ -48,9 +48,18 @@ static __always_inline _syscall1(void, _dl_exit, int, status) #define __NR__dl_close __NR_close static __always_inline _syscall1(int, _dl_close, int, fd) +#if defined(__NR_openat) && !defined(__NR_open) +static __always_inline int _dl_open(const char *fn, + int flags, __kernel_mode_t mode) +{ + return INLINE_SYSCALL(openat, 4, AT_FDCWD, fn, flags, mode); +} + +#elif defined(__NR_open) #define __NR__dl_open __NR_open static __always_inline _syscall3(int, _dl_open, const char *, fn, int, flags, __kernel_mode_t, mode) +#endif #define __NR__dl_write __NR_write static __always_inline _syscall3(unsigned long, _dl_write, int, fd, @@ -64,11 +73,27 @@ static __always_inline _syscall3(unsigned long, _dl_read, int, fd, static __always_inline _syscall3(int, _dl_mprotect, const void *, addr, unsigned long, len, int, prot) +#if defined(__NR_fstatat64) && !defined(__NR_stat) +#define __NR__dl_fstatat64 __NR_fstatat64 +static __always_inline _syscall4(int, _dl_fstatat64, int, fd, const char *, + fn, struct stat *, stat, int, flags) + +static __always_inline int _dl_stat(const char *file_name, + struct stat *buf) +{ + return _dl_fstatat64(AT_FDCWD, file_name, buf, 0); +} +#elif defined(__NR_stat) #define __NR__dl_stat __NR_stat static __always_inline _syscall2(int, _dl_stat, const char *, file_name, struct stat *, buf) +#endif +#if defined(__NR_fstat64) && !defined(__NR_fstat) +#define __NR__dl_fstat __NR_fstat64 +#elif defined(__NR_fstat) #define __NR__dl_fstat __NR_fstat +#endif static __always_inline _syscall2(int, _dl_fstat, int, fd, struct stat *, buf) #define __NR__dl_munmap __NR_munmap @@ -104,9 +129,15 @@ static __always_inline _syscall0(gid_t, _dl_getegid) #define __NR__dl_getpid __NR_getpid static __always_inline _syscall0(gid_t, _dl_getpid) +#if defined(__NR_readlinkat) && !defined(__NR_readlink) +#define __NR__dl_readlink __NR_readlinkat +static __always_inline _syscall4(int, _dl_readlink, int, id, const char *, path, + char *, buf, size_t, bufsiz) +#elif defined(__NR_readlink) #define __NR__dl_readlink __NR_readlink static __always_inline _syscall3(int, _dl_readlink, const char *, path, char *, buf, size_t, bufsiz) +#endif #ifdef __NR_pread64 #define __NR___syscall_pread __NR_pread64 diff --git a/ldso/include/ldso.h b/ldso/include/ldso.h index e0671f7..1e04653 100644 --- a/ldso/include/ldso.h +++ b/ldso/include/ldso.h @@ -30,6 +30,10 @@ #include <stddef.h> /* for ptrdiff_t */ #include <stdbool.h> #define _FCNTL_H +/* We need this if arch has only new syscalls defined */ +#ifndef AT_FDCWD +#define AT_FDCWD -100 +#endif /* AT_FDCWD */ #include <bits/fcntl.h> #include <bits/wordsize.h> /* Pull in the arch specific type information */ -- 1.8.1.1 _______________________________________________ uClibc mailing list uClibc@uclibc.org http://lists.busybox.net/mailman/listinfo/uclibc