diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2021-06-16 09:58:29 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2021-06-22 12:09:52 -0300 |
commit | dafab287b4d5dea1918f6471dc8bf74bff029133 (patch) | |
tree | eacd79430abf83bd758d75f3712b0602d2766460 /sysdeps/unix/sysv/linux/tst-sigtimedwait.c | |
parent | 1faff2701163c76bad9bce76d644d13bce3e290a (diff) | |
download | glibc-dafab287b4d5dea1918f6471dc8bf74bff029133.zip glibc-dafab287b4d5dea1918f6471dc8bf74bff029133.tar.gz glibc-dafab287b4d5dea1918f6471dc8bf74bff029133.tar.bz2 |
linux: Only use 64-bit syscall if required for sigtimedwait
For !__ASSUME_TIME64_SYSCALLS there is no need to issue a 64-bit syscall
if the provided timeout fits in a 32-bit one. The 64-bit usage should
be rare since the timeout is a relative one.
Checked on i686-linux-gnu on a 4.15 kernel and on a 5.11 kernel
(with and without --enable-kernel=5.1) and on x86_64-linux-gnu.
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Diffstat (limited to 'sysdeps/unix/sysv/linux/tst-sigtimedwait.c')
-rw-r--r-- | sysdeps/unix/sysv/linux/tst-sigtimedwait.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/tst-sigtimedwait.c b/sysdeps/unix/sysv/linux/tst-sigtimedwait.c index 973fb5d..a8b9893c 100644 --- a/sysdeps/unix/sysv/linux/tst-sigtimedwait.c +++ b/sysdeps/unix/sysv/linux/tst-sigtimedwait.c @@ -17,11 +17,13 @@ <https://www.gnu.org/licenses/>. */ #include <time.h> +#include <intprops.h> #include <errno.h> #include <signal.h> #include <support/check.h> #include <support/xtime.h> #include <support/timespec.h> +#include <support/support.h> #include <stdbool.h> static int @@ -47,6 +49,20 @@ test_sigtimedwait_timeout (bool zero_tmo) return 0; } +static void +test_sigtimedwait_large_timeout (void) +{ + support_create_timer (0, 100000000, false, NULL); + struct timespec ts = { TYPE_MAXIMUM (time_t), 0 }; + + sigset_t ss_usr1; + sigemptyset (&ss_usr1); + sigaddset (&ss_usr1, SIGUSR1); + + TEST_COMPARE (sigtimedwait (&ss_usr1, NULL, &ts), -1); + TEST_VERIFY (errno == EINTR || errno == EOVERFLOW); +} + static int do_test (void) { @@ -56,6 +72,8 @@ do_test (void) /* Check if sigtimedwait exits after specified timeout. */ test_sigtimedwait_timeout (false); + test_sigtimedwait_large_timeout (); + return 0; } |