diff options
Diffstat (limited to 'libc/sysdeps/linux/common')
-rw-r--r-- | libc/sysdeps/linux/common/__rt_sigtimedwait.c | 10 | ||||
-rw-r--r-- | libc/sysdeps/linux/common/__rt_sigwaitinfo.c | 2 | ||||
-rw-r--r-- | libc/sysdeps/linux/common/alarm.c | 2 | ||||
-rw-r--r-- | libc/sysdeps/linux/common/clock_getres.c | 15 | ||||
-rw-r--r-- | libc/sysdeps/linux/common/clock_gettime.c | 14 | ||||
-rw-r--r-- | libc/sysdeps/linux/common/clock_settime.c | 7 | ||||
-rw-r--r-- | libc/sysdeps/linux/common/ppoll.c | 6 | ||||
-rw-r--r-- | libc/sysdeps/linux/common/pselect.c | 6 | ||||
-rw-r--r-- | libc/sysdeps/linux/common/select.c | 16 | ||||
-rw-r--r-- | libc/sysdeps/linux/common/time.c | 2 | ||||
-rw-r--r-- | libc/sysdeps/linux/common/timerfd.c | 9 | ||||
-rw-r--r-- | libc/sysdeps/linux/common/utimensat.c | 20 |
12 files changed, 91 insertions, 18 deletions
diff --git a/libc/sysdeps/linux/common/__rt_sigtimedwait.c b/libc/sysdeps/linux/common/__rt_sigtimedwait.c index bd82ca6d5..aff5299a1 100644 --- a/libc/sysdeps/linux/common/__rt_sigtimedwait.c +++ b/libc/sysdeps/linux/common/__rt_sigtimedwait.c @@ -9,7 +9,7 @@ #include <sys/syscall.h> -#ifdef __NR_rt_sigtimedwait +#if defined(__NR_rt_sigtimedwait) || (defined(__NR_rt_sigtimedwait_time64) && defined(__UCLIBC_USE_TIME64__)) # include <signal.h> # include <cancel.h> # ifdef __UCLIBC_HAS_THREADS_NATIVE__ @@ -21,6 +21,10 @@ # include <string.h> # endif +#if defined(__UCLIBC_USE_TIME64__) +#include "internal/time64_helpers.h" +#endif + int __NC(sigtimedwait)(const sigset_t *set, siginfo_t *info, const struct timespec *timeout) { @@ -54,7 +58,7 @@ int __NC(sigtimedwait)(const sigset_t *set, siginfo_t *info, /* on uClibc we use the kernel sigset_t size */ # if defined(__UCLIBC_USE_TIME64__) && defined(__NR_rt_sigtimedwait_time64) result = INLINE_SYSCALL(rt_sigtimedwait_time64, 4, set, info, - timeout, __SYSCALL_SIGSET_T_SIZE); + TO_TS64_P(timeout), __SYSCALL_SIGSET_T_SIZE); # else result = INLINE_SYSCALL(rt_sigtimedwait, 4, set, info, timeout, __SYSCALL_SIGSET_T_SIZE); @@ -72,7 +76,7 @@ int __NC(sigtimedwait)(const sigset_t *set, siginfo_t *info, /* on uClibc we use the kernel sigset_t size */ # if defined(__UCLIBC_USE_TIME64__) && defined(__NR_rt_sigtimedwait_time64) return INLINE_SYSCALL(rt_sigtimedwait_time64, 4, set, info, - timeout, __SYSCALL_SIGSET_T_SIZE); + TO_TS64_P(timeout), __SYSCALL_SIGSET_T_SIZE); # else return INLINE_SYSCALL(rt_sigtimedwait, 4, set, info, timeout, __SYSCALL_SIGSET_T_SIZE); diff --git a/libc/sysdeps/linux/common/__rt_sigwaitinfo.c b/libc/sysdeps/linux/common/__rt_sigwaitinfo.c index d2d176a64..7830b2e2c 100644 --- a/libc/sysdeps/linux/common/__rt_sigwaitinfo.c +++ b/libc/sysdeps/linux/common/__rt_sigwaitinfo.c @@ -9,7 +9,7 @@ #include <sys/syscall.h> -#ifdef __NR_rt_sigtimedwait +#if defined(__NR_rt_sigtimedwait) || (defined(__UCLIBC_USE_TIME64__) && defined(__NR_rt_sigtimedwait_time64)) # define __need_NULL # include <stddef.h> # include <signal.h> diff --git a/libc/sysdeps/linux/common/alarm.c b/libc/sysdeps/linux/common/alarm.c index 4e6e2215b..861f6ad8e 100644 --- a/libc/sysdeps/linux/common/alarm.c +++ b/libc/sysdeps/linux/common/alarm.c @@ -9,7 +9,7 @@ #include <sys/syscall.h> #include <unistd.h> -#ifdef __NR_alarm && !defined(__UCLIBC_USE_TIME64__) +#if defined(__NR_alarm) && !defined(__UCLIBC_USE_TIME64__) _syscall1(unsigned int, alarm, unsigned int, seconds) #else # include <sys/time.h> diff --git a/libc/sysdeps/linux/common/clock_getres.c b/libc/sysdeps/linux/common/clock_getres.c index d4b989958..fd0f8c14c 100644 --- a/libc/sysdeps/linux/common/clock_getres.c +++ b/libc/sysdeps/linux/common/clock_getres.c @@ -10,9 +10,20 @@ #include <sys/syscall.h> #include <time.h> - #if defined(__UCLIBC_USE_TIME64__) && defined(__NR_clock_getres_time64) -_syscall2_time64(int, clock_getres, clockid_t, clock_id, struct timespec*, res) +#include "internal/time64_helpers.h" + +int clock_getres(clockid_t clock_id, struct timespec *res) +{ + struct __ts64_struct __ts64; + int __ret = INLINE_SYSCALL(clock_getres_time64, 2, clock_id, &__ts64); + if (__ret == 0 && res) { + res->tv_sec = __ts64.tv_sec; + res->tv_nsec = __ts64.tv_nsec; + }; + + return __ret; +} #elif defined(__NR_clock_getres) _syscall2(int, clock_getres, clockid_t, clock_id, struct timespec*, res) #else diff --git a/libc/sysdeps/linux/common/clock_gettime.c b/libc/sysdeps/linux/common/clock_gettime.c index a595bd691..4d787b9b7 100644 --- a/libc/sysdeps/linux/common/clock_gettime.c +++ b/libc/sysdeps/linux/common/clock_gettime.c @@ -12,7 +12,19 @@ #include <time.h> #if defined(__UCLIBC_USE_TIME64__) && defined(__NR_clock_gettime64) -_syscall2_64(int, clock_gettime, clockid_t, clock_id, struct timespec*, tp) +#include "internal/time64_helpers.h" + +int clock_gettime(clockid_t clock_id, struct timespec *tp) +{ + struct __ts64_struct __ts64; + int __ret = INLINE_SYSCALL(clock_gettime64, 2, clock_id, &__ts64); + if (tp) { + tp->tv_sec = __ts64.tv_sec; + tp->tv_nsec = __ts64.tv_nsec; + } + + return __ret; +} #elif defined(__NR_clock_gettime) _syscall2(int, clock_gettime, clockid_t, clock_id, struct timespec*, tp) #else diff --git a/libc/sysdeps/linux/common/clock_settime.c b/libc/sysdeps/linux/common/clock_settime.c index 89550af5a..3abc5f49b 100644 --- a/libc/sysdeps/linux/common/clock_settime.c +++ b/libc/sysdeps/linux/common/clock_settime.c @@ -12,7 +12,12 @@ #if defined(__UCLIBC_USE_TIME64__) && defined(__NR_clock_settime64) -_syscall2_64(int, clock_settime, clockid_t, clock_id, const struct timespec*, tp) +#include "internal/time64_helpers.h" + +int clock_settime(clockid_t clock_id, const struct timespec *tp) +{ + return INLINE_SYSCALL(clock_settime64, 2, clock_id, TO_TS64_P(tp)); +} #elif defined(__NR_clock_settime) _syscall2(int, clock_settime, clockid_t, clock_id, const struct timespec*, tp) #else diff --git a/libc/sysdeps/linux/common/ppoll.c b/libc/sysdeps/linux/common/ppoll.c index cb36149c5..870717bd7 100644 --- a/libc/sysdeps/linux/common/ppoll.c +++ b/libc/sysdeps/linux/common/ppoll.c @@ -26,6 +26,10 @@ #include <sys/poll.h> #include <cancel.h> +#if defined(__UCLIBC_USE_TIME64__) +#include "internal/time64_helpers.h" +#endif + static int __NC(ppoll)(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout, const sigset_t *sigmask) @@ -38,7 +42,7 @@ __NC(ppoll)(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout, timeout = &tval; } #if defined(__UCLIBC_USE_TIME64__) && defined(__NR_ppoll_time64) - return INLINE_SYSCALL(ppoll_time64, 5, fds, nfds, timeout, sigmask, __SYSCALL_SIGSET_T_SIZE); + return INLINE_SYSCALL(ppoll_time64, 5, fds, nfds, TO_TS64_P(timeout), sigmask, __SYSCALL_SIGSET_T_SIZE); #else return INLINE_SYSCALL(ppoll, 5, fds, nfds, timeout, sigmask, __SYSCALL_SIGSET_T_SIZE); #endif diff --git a/libc/sysdeps/linux/common/pselect.c b/libc/sysdeps/linux/common/pselect.c index 23bdab5cf..7a446a589 100644 --- a/libc/sysdeps/linux/common/pselect.c +++ b/libc/sysdeps/linux/common/pselect.c @@ -26,6 +26,10 @@ #include <signal.h> #include <cancel.h> +#if defined(__UCLIBC_USE_TIME64__) +#include "internal/time64_helpers.h" +#endif + static int __NC(pselect)(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, const struct timespec *timeout, const sigset_t *sigmask) @@ -57,7 +61,7 @@ static int __NC(pselect)(int nfds, fd_set *readfds, fd_set *writefds, sigmask = (void *)&data; } #if defined(__UCLIBC_USE_TIME64__) && defined(__NR_pselect6_time64) - return INLINE_SYSCALL(pselect6_time64, 6, nfds, readfds, writefds, exceptfds, timeout, sigmask); + return INLINE_SYSCALL(pselect6_time64, 6, nfds, readfds, writefds, exceptfds, TO_TS64_P(timeout), sigmask); #else return INLINE_SYSCALL(pselect6, 6, nfds, readfds, writefds, exceptfds, timeout, sigmask); #endif diff --git a/libc/sysdeps/linux/common/select.c b/libc/sysdeps/linux/common/select.c index 3132a109c..84016dd0b 100644 --- a/libc/sysdeps/linux/common/select.c +++ b/libc/sysdeps/linux/common/select.c @@ -15,17 +15,19 @@ # define __NR_select __NR__newselect #endif -#if !defined __NR_select && defined __NR_pselect6 +#if defined(__NR_pselect6) || defined(__NR_pselect6_time64) # include <stdint.h> # define USEC_PER_SEC 1000000L #endif +#if defined(__UCLIBC_USE_TIME64__) +#include "internal/time64_helpers.h" +#endif + int __NC(select)(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout) { -#ifdef __NR_select - return INLINE_SYSCALL(select, 5, n, readfds, writefds, exceptfds, timeout); -#elif defined __NR_pselect6 +#if defined(__NR_pselect6) || defined(__NR_pselect6_time64) struct timespec _ts, *ts = 0; if (timeout) { uint32_t usec; @@ -47,8 +49,14 @@ int __NC(select)(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, ts = &_ts; } +#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_pselect6_time64) + return INLINE_SYSCALL(pselect6_time64, 6, n, readfds, writefds, exceptfds, TO_TS64_P(ts), 0); +#else return INLINE_SYSCALL(pselect6, 6, n, readfds, writefds, exceptfds, ts, 0); #endif +#elif defined(__NR_select) + return INLINE_SYSCALL(select, 5, n, readfds, writefds, exceptfds, ts); +#endif } /* we should guard it, but we need it in other files, so let it fail * if we miss any of the syscalls */ diff --git a/libc/sysdeps/linux/common/time.c b/libc/sysdeps/linux/common/time.c index 22403f174..d084ffaad 100644 --- a/libc/sysdeps/linux/common/time.c +++ b/libc/sysdeps/linux/common/time.c @@ -9,7 +9,7 @@ #include <sys/syscall.h> #include <time.h> -#ifdef __NR_time +#if defined(__NR_time) && !defined(__UCLIBC_USE_TIME64__) _syscall_noerr1(time_t, time, time_t *, t) #else # include <sys/time.h> diff --git a/libc/sysdeps/linux/common/timerfd.c b/libc/sysdeps/linux/common/timerfd.c index 0f19b44ed..b4a9e1a93 100644 --- a/libc/sysdeps/linux/common/timerfd.c +++ b/libc/sysdeps/linux/common/timerfd.c @@ -9,6 +9,10 @@ #include <sys/syscall.h> #include <sys/timerfd.h> +#if defined(__UCLIBC_USE_TIME64__) +#include "internal/time64_helpers.h" +#endif + /* * timerfd_create() */ @@ -21,7 +25,10 @@ _syscall2(int, timerfd_create, int, clockid, int, flags) */ #if defined(__NR_timerfd_settime) || defined(__NR_timerfd_settime64) #if defined(__UCLIBC_USE_TIME64__) && defined(__NR_timerfd_settime64) -_syscall4_64(int, timerfd_settime, int, ufd, int, flags, const struct itimerspec *, utmr, struct itimerspec *, otmr) +int timerfd_settime(int ufd, int flags, const struct itimerspec *utmr, struct itimerspec *otmr) +{ + return INLINE_SYSCALL(timerfd_settime64, 4, ufd, flags, TO_ITS64_P(utmr), otmr); +} #else _syscall4(int, timerfd_settime, int, ufd, int, flags, const struct itimerspec *, utmr, struct itimerspec *, otmr) #endif diff --git a/libc/sysdeps/linux/common/utimensat.c b/libc/sysdeps/linux/common/utimensat.c index 6a78ebb4f..fa6f90e55 100644 --- a/libc/sysdeps/linux/common/utimensat.c +++ b/libc/sysdeps/linux/common/utimensat.c @@ -9,9 +9,27 @@ #include <sys/syscall.h> #include <sys/stat.h> +#if defined(__UCLIBC_USE_TIME64__) +#include "internal/time64_helpers.h" +#endif + #if defined(__NR_utimensat) || defined(__NR_utimensat_time64) #if defined(__UCLIBC_USE_TIME64__) && defined(__NR_utimensat_time64) -_syscall4_time64(int, utimensat, int, fd, const char *, path, const struct timespec *, times, int, flags) +int utimensat(int fd, const char *path, const struct timespec times[2], int flags) +{ + struct __ts64_struct __times64[2] = { + { + .tv_sec = times ? times[0].tv_sec : 0, + .tv_nsec = times ? times[0].tv_nsec : 0 + }, + { + .tv_sec = times ? times[1].tv_sec : 0, + .tv_nsec = times ? times[1].tv_nsec : 0 + } + }; + + return INLINE_SYSCALL(utimensat_time64, 4, fd, path, times ? &__times64 : 0, flags); +} #else _syscall4(int, utimensat, int, fd, const char *, path, const struct timespec *, times, int, flags) #endif |