Add sigtimedwait and sigprocmask wrappers
The existing sigprocmask wrappers are consolidated into a single
definition using rt_sigprocmask and no longer checks for ENOSYS.
These system calls should exist on Linux 2.2+. Support for older
kernels will require callers to handle ENOSYS themselves.
Bug: crashpad:265
Change-Id: I25bc8c811c2f93aa20ff64fe3bacdcd017ff10c6
Reviewed-on: https://chromium-review.googlesource.com/c/linux-syscall-support/+/1914504
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/linux_syscall_support.h b/linux_syscall_support.h
index 9276f56..8e0cc38 100644
--- a/linux_syscall_support.h
+++ b/linux_syscall_support.h
@@ -3509,6 +3509,8 @@
struct kernel_sigset_t*, o, size_t, c)
LSS_INLINE _syscall2(int, rt_sigsuspend,
const struct kernel_sigset_t*, s, size_t, c)
+ LSS_INLINE _syscall4(int, rt_sigtimedwait, const struct kernel_sigset_t*, s,
+ siginfo_t*, i, const struct timespec*, t, size_t, c)
LSS_INLINE _syscall3(int, sched_getaffinity,pid_t, p,
unsigned int, l, unsigned long *, m)
LSS_INLINE _syscall3(int, sched_setaffinity,pid_t, p,
@@ -3704,14 +3706,22 @@
return LSS_NAME(rt_sigpending)(set, (KERNEL_NSIG+7)/8);
}
+ LSS_INLINE int LSS_NAME(sigsuspend)(const struct kernel_sigset_t *set) {
+ return LSS_NAME(rt_sigsuspend)(set, (KERNEL_NSIG+7)/8);
+ }
+ #endif
+ #if defined(__NR_rt_sigprocmask)
LSS_INLINE int LSS_NAME(sigprocmask)(int how,
const struct kernel_sigset_t *set,
struct kernel_sigset_t *oldset) {
return LSS_NAME(rt_sigprocmask)(how, set, oldset, (KERNEL_NSIG+7)/8);
}
-
- LSS_INLINE int LSS_NAME(sigsuspend)(const struct kernel_sigset_t *set) {
- return LSS_NAME(rt_sigsuspend)(set, (KERNEL_NSIG+7)/8);
+ #endif
+ #if defined(__NR_rt_sigtimedwait)
+ LSS_INLINE int LSS_NAME(sigtimedwait)(const struct kernel_sigset_t *set,
+ siginfo_t *info,
+ const struct timespec *timeout) {
+ return LSS_NAME(rt_sigtimedwait)(set, info, timeout, (KERNEL_NSIG+7)/8);
}
#endif
#if defined(__NR_wait4)
@@ -3887,7 +3897,6 @@
(defined(__s390__) && !defined(__s390x__))
#define __NR__sigaction __NR_sigaction
#define __NR__sigpending __NR_sigpending
- #define __NR__sigprocmask __NR_sigprocmask
#define __NR__sigsuspend __NR_sigsuspend
#define __NR__socketcall __NR_socketcall
LSS_INLINE _syscall2(int, fstat64, int, f,
@@ -3916,9 +3925,6 @@
const struct kernel_old_sigaction*, a,
struct kernel_old_sigaction*, o)
LSS_INLINE _syscall1(int, _sigpending, unsigned long*, s)
- LSS_INLINE _syscall3(int, _sigprocmask, int, h,
- const unsigned long*, s,
- unsigned long*, o)
#ifdef __PPC__
LSS_INLINE _syscall1(int, _sigsuspend, unsigned long, s)
#else
@@ -4002,23 +4008,6 @@
return rc;
}
- LSS_INLINE int LSS_NAME(sigprocmask)(int how,
- const struct kernel_sigset_t *set,
- struct kernel_sigset_t *oldset) {
- int olderrno = LSS_ERRNO;
- int rc = LSS_NAME(rt_sigprocmask)(how, set, oldset, (KERNEL_NSIG+7)/8);
- if (rc < 0 && LSS_ERRNO == ENOSYS) {
- LSS_ERRNO = olderrno;
- if (oldset) {
- LSS_NAME(sigemptyset)(oldset);
- }
- rc = LSS_NAME(_sigprocmask)(how,
- set ? &set->sig[0] : NULL,
- oldset ? &oldset->sig[0] : NULL);
- }
- return rc;
- }
-
LSS_INLINE int LSS_NAME(sigsuspend)(const struct kernel_sigset_t *set) {
int olderrno = LSS_ERRNO;
int rc = LSS_NAME(rt_sigsuspend)(set, (KERNEL_NSIG+7)/8);