The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 The Android Open Source Project |
| 3 | * All rights reserved. |
| 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions |
| 7 | * are met: |
| 8 | * * Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * * Redistributions in binary form must reproduce the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer in |
| 12 | * the documentation and/or other materials provided with the |
| 13 | * distribution. |
| 14 | * |
| 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 16 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 17 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 18 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
| 19 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
| 21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS |
| 22 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
| 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
| 25 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 26 | * SUCH DAMAGE. |
| 27 | */ |
Elliott Hughes | c7e9b23 | 2013-10-16 22:27:54 -0700 | [diff] [blame] | 28 | |
Elliott Hughes | 6dafb4a | 2018-01-26 17:47:56 -0800 | [diff] [blame] | 29 | #include <errno.h> |
| 30 | #include <pthread.h> |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 31 | #include <signal.h> |
Elliott Hughes | 6dafb4a | 2018-01-26 17:47:56 -0800 | [diff] [blame] | 32 | #include <string.h> |
Elliott Hughes | 5905d6f | 2018-01-30 15:09:51 -0800 | [diff] [blame] | 33 | #include <sys/epoll.h> |
| 34 | #include <sys/signalfd.h> |
Elliott Hughes | 6dafb4a | 2018-01-26 17:47:56 -0800 | [diff] [blame] | 35 | #include <sys/types.h> |
| 36 | #include <time.h> |
| 37 | #include <unistd.h> |
| 38 | |
Elliott Hughes | 5905d6f | 2018-01-30 15:09:51 -0800 | [diff] [blame] | 39 | #include "private/ErrnoRestorer.h" |
| 40 | #include "private/SigSetConverter.h" |
Elliott Hughes | 6dafb4a | 2018-01-26 17:47:56 -0800 | [diff] [blame] | 41 | |
Elliott Hughes | 5905d6f | 2018-01-30 15:09:51 -0800 | [diff] [blame] | 42 | extern "C" int __rt_sigpending(const sigset64_t*, size_t); |
| 43 | extern "C" int __rt_sigprocmask(int, const sigset64_t*, sigset64_t*, size_t); |
Elliott Hughes | 6dafb4a | 2018-01-26 17:47:56 -0800 | [diff] [blame] | 44 | extern "C" int ___rt_sigqueueinfo(pid_t, int, siginfo_t*); |
Elliott Hughes | 5905d6f | 2018-01-30 15:09:51 -0800 | [diff] [blame] | 45 | extern "C" int __rt_sigsuspend(const sigset64_t*, size_t); |
| 46 | extern "C" int __rt_sigtimedwait(const sigset64_t*, siginfo_t*, const timespec*, size_t); |
Elliott Hughes | 6dafb4a | 2018-01-26 17:47:56 -0800 | [diff] [blame] | 47 | |
Elliott Hughes | 5905d6f | 2018-01-30 15:09:51 -0800 | [diff] [blame] | 48 | int pthread_sigmask(int how, const sigset_t* new_set, sigset_t* old_set) { |
| 49 | ErrnoRestorer errno_restorer; |
| 50 | return (sigprocmask(how, new_set, old_set) == -1) ? errno : 0; |
| 51 | } |
| 52 | |
| 53 | int pthread_sigmask64(int how, const sigset64_t* new_set, sigset64_t* old_set) { |
| 54 | ErrnoRestorer errno_restorer; |
| 55 | return (sigprocmask64(how, new_set, old_set) == -1) ? errno : 0; |
| 56 | } |
| 57 | |
| 58 | template <typename SigSetT> |
| 59 | int SigAddSet(SigSetT* set, int sig) { |
| 60 | int bit = sig - 1; // Signal numbers start at 1, but bit positions start at 0. |
Elliott Hughes | 6dafb4a | 2018-01-26 17:47:56 -0800 | [diff] [blame] | 61 | unsigned long* local_set = reinterpret_cast<unsigned long*>(set); |
Elliott Hughes | 5905d6f | 2018-01-30 15:09:51 -0800 | [diff] [blame] | 62 | if (set == nullptr || bit < 0 || bit >= static_cast<int>(8*sizeof(*set))) { |
Elliott Hughes | 6dafb4a | 2018-01-26 17:47:56 -0800 | [diff] [blame] | 63 | errno = EINVAL; |
| 64 | return -1; |
| 65 | } |
| 66 | local_set[bit / LONG_BIT] |= 1UL << (bit % LONG_BIT); |
| 67 | return 0; |
| 68 | } |
| 69 | |
Elliott Hughes | 5905d6f | 2018-01-30 15:09:51 -0800 | [diff] [blame] | 70 | int sigaddset(sigset_t* set, int sig) { |
| 71 | return SigAddSet(set, sig); |
Elliott Hughes | 6dafb4a | 2018-01-26 17:47:56 -0800 | [diff] [blame] | 72 | } |
| 73 | |
Elliott Hughes | 5905d6f | 2018-01-30 15:09:51 -0800 | [diff] [blame] | 74 | int sigaddset64(sigset64_t* set, int sig) { |
| 75 | return SigAddSet(set, sig); |
| 76 | } |
| 77 | |
| 78 | // This isn't in our header files, but is exposed on all architectures. |
| 79 | extern "C" int sigblock(int mask) { |
| 80 | SigSetConverter in, out; |
| 81 | sigemptyset(&in.sigset); |
| 82 | in.bsd = mask; |
| 83 | if (sigprocmask(SIG_BLOCK, &in.sigset, &out.sigset) == -1) return -1; |
| 84 | return out.bsd; |
| 85 | } |
| 86 | |
| 87 | template <typename SigSetT> |
| 88 | int SigDelSet(SigSetT* set, int sig) { |
| 89 | int bit = sig - 1; // Signal numbers start at 1, but bit positions start at 0. |
Elliott Hughes | 6dafb4a | 2018-01-26 17:47:56 -0800 | [diff] [blame] | 90 | unsigned long* local_set = reinterpret_cast<unsigned long*>(set); |
Elliott Hughes | 5905d6f | 2018-01-30 15:09:51 -0800 | [diff] [blame] | 91 | if (set == nullptr || bit < 0 || bit >= static_cast<int>(8*sizeof(*set))) { |
Elliott Hughes | 6dafb4a | 2018-01-26 17:47:56 -0800 | [diff] [blame] | 92 | errno = EINVAL; |
| 93 | return -1; |
| 94 | } |
| 95 | local_set[bit / LONG_BIT] &= ~(1UL << (bit % LONG_BIT)); |
| 96 | return 0; |
| 97 | } |
| 98 | |
Elliott Hughes | 5905d6f | 2018-01-30 15:09:51 -0800 | [diff] [blame] | 99 | int sigdelset(sigset_t* set, int sig) { |
| 100 | return SigDelSet(set, sig); |
| 101 | } |
| 102 | |
| 103 | int sigdelset64(sigset64_t* set, int sig) { |
| 104 | return SigDelSet(set, sig); |
| 105 | } |
| 106 | |
| 107 | template <typename SigSetT> |
| 108 | int SigEmptySet(SigSetT* set) { |
| 109 | if (set == nullptr) { |
Elliott Hughes | 6dafb4a | 2018-01-26 17:47:56 -0800 | [diff] [blame] | 110 | errno = EINVAL; |
| 111 | return -1; |
| 112 | } |
Elliott Hughes | 5905d6f | 2018-01-30 15:09:51 -0800 | [diff] [blame] | 113 | memset(set, 0, sizeof(*set)); |
| 114 | return 0; |
| 115 | } |
| 116 | |
| 117 | int sigemptyset(sigset_t* set) { |
| 118 | return SigEmptySet(set); |
| 119 | } |
| 120 | |
| 121 | int sigemptyset64(sigset64_t* set) { |
| 122 | return SigEmptySet(set); |
| 123 | } |
| 124 | |
| 125 | template <typename SigSetT> |
| 126 | int SigFillSet(SigSetT* set) { |
| 127 | if (set == nullptr) { |
| 128 | errno = EINVAL; |
| 129 | return -1; |
| 130 | } |
| 131 | memset(set, 0xff, sizeof(*set)); |
Elliott Hughes | 6dafb4a | 2018-01-26 17:47:56 -0800 | [diff] [blame] | 132 | return 0; |
| 133 | } |
| 134 | |
| 135 | int sigfillset(sigset_t* set) { |
Elliott Hughes | 5905d6f | 2018-01-30 15:09:51 -0800 | [diff] [blame] | 136 | return SigFillSet(set); |
| 137 | } |
| 138 | |
| 139 | int sigfillset64(sigset64_t* set) { |
| 140 | return SigFillSet(set); |
Elliott Hughes | 6dafb4a | 2018-01-26 17:47:56 -0800 | [diff] [blame] | 141 | } |
| 142 | |
| 143 | int sighold(int sig) { |
Elliott Hughes | 5905d6f | 2018-01-30 15:09:51 -0800 | [diff] [blame] | 144 | sigset64_t set = {}; |
| 145 | if (sigaddset64(&set, sig) == -1) return -1; |
| 146 | return sigprocmask64(SIG_BLOCK, &set, nullptr); |
Elliott Hughes | 6dafb4a | 2018-01-26 17:47:56 -0800 | [diff] [blame] | 147 | } |
| 148 | |
| 149 | int sigignore(int sig) { |
| 150 | struct sigaction sa; |
| 151 | memset(&sa, 0, sizeof(sa)); |
| 152 | if (sigemptyset(&sa.sa_mask) == -1) return -1; |
| 153 | sa.sa_handler = SIG_IGN; |
| 154 | return sigaction(sig, &sa, nullptr); |
| 155 | } |
| 156 | |
| 157 | int siginterrupt(int sig, int flag) { |
| 158 | struct sigaction act; |
| 159 | sigaction(sig, nullptr, &act); |
| 160 | if (flag) { |
| 161 | act.sa_flags &= ~SA_RESTART; |
| 162 | } else { |
| 163 | act.sa_flags |= SA_RESTART; |
| 164 | } |
| 165 | return sigaction(sig, &act, nullptr); |
| 166 | } |
| 167 | |
Elliott Hughes | 5905d6f | 2018-01-30 15:09:51 -0800 | [diff] [blame] | 168 | template <typename SigSetT> |
| 169 | int SigIsMember(const SigSetT* set, int sig) { |
| 170 | int bit = sig - 1; // Signal numbers start at 1, but bit positions start at 0. |
Elliott Hughes | 6dafb4a | 2018-01-26 17:47:56 -0800 | [diff] [blame] | 171 | const unsigned long* local_set = reinterpret_cast<const unsigned long*>(set); |
Elliott Hughes | 5905d6f | 2018-01-30 15:09:51 -0800 | [diff] [blame] | 172 | if (set == nullptr || bit < 0 || bit >= static_cast<int>(8*sizeof(*set))) { |
Elliott Hughes | 6dafb4a | 2018-01-26 17:47:56 -0800 | [diff] [blame] | 173 | errno = EINVAL; |
| 174 | return -1; |
| 175 | } |
| 176 | return static_cast<int>((local_set[bit / LONG_BIT] >> (bit % LONG_BIT)) & 1); |
| 177 | } |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 178 | |
Elliott Hughes | 5905d6f | 2018-01-30 15:09:51 -0800 | [diff] [blame] | 179 | int sigismember(const sigset_t* set, int sig) { |
| 180 | return SigIsMember(set, sig); |
| 181 | } |
| 182 | |
| 183 | int sigismember64(const sigset64_t* set, int sig) { |
| 184 | return SigIsMember(set, sig); |
| 185 | } |
| 186 | |
| 187 | __LIBC_HIDDEN__ sighandler_t _signal(int sig, sighandler_t handler, int flags) { |
Elliott Hughes | c7e9b23 | 2013-10-16 22:27:54 -0700 | [diff] [blame] | 188 | struct sigaction sa; |
| 189 | sigemptyset(&sa.sa_mask); |
| 190 | sa.sa_handler = handler; |
| 191 | sa.sa_flags = flags; |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 192 | |
Elliott Hughes | 5905d6f | 2018-01-30 15:09:51 -0800 | [diff] [blame] | 193 | if (sigaction(sig, &sa, &sa) == -1) { |
Elliott Hughes | c7e9b23 | 2013-10-16 22:27:54 -0700 | [diff] [blame] | 194 | return SIG_ERR; |
| 195 | } |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 196 | |
Elliott Hughes | 8b5df39 | 2015-01-21 16:19:07 -0800 | [diff] [blame] | 197 | return sa.sa_handler; |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 198 | } |
| 199 | |
Elliott Hughes | 5905d6f | 2018-01-30 15:09:51 -0800 | [diff] [blame] | 200 | sighandler_t signal(int sig, sighandler_t handler) { |
| 201 | return _signal(sig, handler, SA_RESTART); |
Elliott Hughes | c7e9b23 | 2013-10-16 22:27:54 -0700 | [diff] [blame] | 202 | } |
Elliott Hughes | 6dafb4a | 2018-01-26 17:47:56 -0800 | [diff] [blame] | 203 | |
| 204 | int sigpause(int sig) { |
Elliott Hughes | 5905d6f | 2018-01-30 15:09:51 -0800 | [diff] [blame] | 205 | sigset64_t set = {}; |
| 206 | if (sigprocmask64(SIG_SETMASK, nullptr, &set) == -1 || sigdelset64(&set, sig) == -1) return -1; |
| 207 | return sigsuspend64(&set); |
Elliott Hughes | 6dafb4a | 2018-01-26 17:47:56 -0800 | [diff] [blame] | 208 | } |
| 209 | |
| 210 | int sigpending(sigset_t* bionic_set) { |
Elliott Hughes | 5905d6f | 2018-01-30 15:09:51 -0800 | [diff] [blame] | 211 | SigSetConverter set = {}; |
| 212 | set.sigset = *bionic_set; |
| 213 | if (__rt_sigpending(&set.sigset64, sizeof(set.sigset64)) == -1) return -1; |
| 214 | *bionic_set = set.sigset; |
| 215 | return 0; |
| 216 | } |
| 217 | |
| 218 | int sigpending64(sigset64_t* set) { |
| 219 | return __rt_sigpending(set, sizeof(*set)); |
Elliott Hughes | 6dafb4a | 2018-01-26 17:47:56 -0800 | [diff] [blame] | 220 | } |
| 221 | |
| 222 | int sigprocmask(int how, const sigset_t* bionic_new_set, sigset_t* bionic_old_set) { |
Elliott Hughes | 5905d6f | 2018-01-30 15:09:51 -0800 | [diff] [blame] | 223 | SigSetConverter new_set; |
| 224 | sigset64_t* new_set_ptr = nullptr; |
| 225 | if (bionic_new_set != nullptr) { |
| 226 | sigemptyset64(&new_set.sigset64); |
| 227 | new_set.sigset = *bionic_new_set; |
| 228 | new_set_ptr = &new_set.sigset64; |
Elliott Hughes | 6dafb4a | 2018-01-26 17:47:56 -0800 | [diff] [blame] | 229 | } |
| 230 | |
Elliott Hughes | 5905d6f | 2018-01-30 15:09:51 -0800 | [diff] [blame] | 231 | SigSetConverter old_set; |
| 232 | if (sigprocmask64(how, new_set_ptr, &old_set.sigset64) == -1) { |
Elliott Hughes | 6dafb4a | 2018-01-26 17:47:56 -0800 | [diff] [blame] | 233 | return -1; |
| 234 | } |
| 235 | |
Elliott Hughes | 5905d6f | 2018-01-30 15:09:51 -0800 | [diff] [blame] | 236 | if (bionic_old_set != nullptr) { |
| 237 | *bionic_old_set = old_set.sigset; |
Elliott Hughes | 6dafb4a | 2018-01-26 17:47:56 -0800 | [diff] [blame] | 238 | } |
| 239 | |
| 240 | return 0; |
| 241 | } |
| 242 | |
Elliott Hughes | 5905d6f | 2018-01-30 15:09:51 -0800 | [diff] [blame] | 243 | int sigprocmask64(int how, const sigset64_t* new_set, sigset64_t* old_set) { |
| 244 | return __rt_sigprocmask(how, new_set, old_set, sizeof(*new_set)); |
| 245 | } |
| 246 | |
| 247 | int sigqueue(pid_t pid, int sig, const sigval value) { |
Elliott Hughes | 6dafb4a | 2018-01-26 17:47:56 -0800 | [diff] [blame] | 248 | siginfo_t info; |
| 249 | memset(&info, 0, sizeof(siginfo_t)); |
Elliott Hughes | 5905d6f | 2018-01-30 15:09:51 -0800 | [diff] [blame] | 250 | info.si_signo = sig; |
Elliott Hughes | 6dafb4a | 2018-01-26 17:47:56 -0800 | [diff] [blame] | 251 | info.si_code = SI_QUEUE; |
| 252 | info.si_pid = getpid(); |
| 253 | info.si_uid = getuid(); |
| 254 | info.si_value = value; |
Elliott Hughes | 5905d6f | 2018-01-30 15:09:51 -0800 | [diff] [blame] | 255 | return ___rt_sigqueueinfo(pid, sig, &info); |
Elliott Hughes | 6dafb4a | 2018-01-26 17:47:56 -0800 | [diff] [blame] | 256 | } |
| 257 | |
| 258 | int sigrelse(int sig) { |
Elliott Hughes | 5905d6f | 2018-01-30 15:09:51 -0800 | [diff] [blame] | 259 | sigset64_t set = {}; |
| 260 | if (sigaddset64(&set, sig) == -1) return -1; |
| 261 | return sigprocmask64(SIG_UNBLOCK, &set, nullptr); |
Elliott Hughes | 6dafb4a | 2018-01-26 17:47:56 -0800 | [diff] [blame] | 262 | } |
| 263 | |
| 264 | sighandler_t sigset(int sig, sighandler_t disp) { |
| 265 | struct sigaction new_sa; |
| 266 | if (disp != SIG_HOLD) { |
| 267 | memset(&new_sa, 0, sizeof(new_sa)); |
| 268 | new_sa.sa_handler = disp; |
| 269 | sigemptyset(&new_sa.sa_mask); |
| 270 | } |
| 271 | |
| 272 | struct sigaction old_sa; |
| 273 | if (sigaction(sig, (disp == SIG_HOLD) ? nullptr : &new_sa, &old_sa) == -1) { |
| 274 | return SIG_ERR; |
| 275 | } |
| 276 | |
Elliott Hughes | 5905d6f | 2018-01-30 15:09:51 -0800 | [diff] [blame] | 277 | sigset64_t new_mask = {}; |
| 278 | sigaddset64(&new_mask, sig); |
| 279 | sigset64_t old_mask; |
| 280 | if (sigprocmask64(disp == SIG_HOLD ? SIG_BLOCK : SIG_UNBLOCK, &new_mask, &old_mask) == -1) { |
Elliott Hughes | 6dafb4a | 2018-01-26 17:47:56 -0800 | [diff] [blame] | 281 | return SIG_ERR; |
| 282 | } |
| 283 | |
Elliott Hughes | 5905d6f | 2018-01-30 15:09:51 -0800 | [diff] [blame] | 284 | return sigismember64(&old_mask, sig) ? SIG_HOLD : old_sa.sa_handler; |
Elliott Hughes | 6dafb4a | 2018-01-26 17:47:56 -0800 | [diff] [blame] | 285 | } |
| 286 | |
| 287 | // This isn't in our header files, but is exposed on all architectures. |
| 288 | extern "C" int sigsetmask(int mask) { |
Elliott Hughes | 5905d6f | 2018-01-30 15:09:51 -0800 | [diff] [blame] | 289 | SigSetConverter in, out; |
| 290 | sigemptyset(&in.sigset); |
| 291 | in.bsd = mask; |
| 292 | if (sigprocmask(SIG_SETMASK, &in.sigset, &out.sigset) == -1) return -1; |
| 293 | return out.bsd; |
Elliott Hughes | 6dafb4a | 2018-01-26 17:47:56 -0800 | [diff] [blame] | 294 | } |
| 295 | |
| 296 | int sigsuspend(const sigset_t* bionic_set) { |
Elliott Hughes | 5905d6f | 2018-01-30 15:09:51 -0800 | [diff] [blame] | 297 | SigSetConverter set = {}; |
| 298 | set.sigset = *bionic_set; |
| 299 | return __rt_sigsuspend(&set.sigset64, sizeof(set.sigset64)); |
Elliott Hughes | 6dafb4a | 2018-01-26 17:47:56 -0800 | [diff] [blame] | 300 | } |
| 301 | |
Elliott Hughes | 5905d6f | 2018-01-30 15:09:51 -0800 | [diff] [blame] | 302 | int sigsuspend64(const sigset64_t* set) { |
| 303 | return __rt_sigsuspend(set, sizeof(*set)); |
Elliott Hughes | 6dafb4a | 2018-01-26 17:47:56 -0800 | [diff] [blame] | 304 | } |
| 305 | |
Elliott Hughes | 5905d6f | 2018-01-30 15:09:51 -0800 | [diff] [blame] | 306 | int sigtimedwait(const sigset_t* bionic_set, siginfo_t* info, const timespec* timeout) { |
| 307 | SigSetConverter set = {}; |
| 308 | set.sigset = *bionic_set; |
| 309 | return __rt_sigtimedwait(&set.sigset64, info, timeout, sizeof(set.sigset64)); |
| 310 | } |
| 311 | |
| 312 | int sigtimedwait64(const sigset64_t* set, siginfo_t* info, const timespec* timeout) { |
| 313 | return __rt_sigtimedwait(set, info, timeout, sizeof(*set)); |
| 314 | } |
| 315 | |
| 316 | int sigwait(const sigset_t* bionic_set, int* sig) { |
| 317 | SigSetConverter set = {}; |
| 318 | set.sigset = *bionic_set; |
| 319 | return sigwait64(&set.sigset64, sig); |
| 320 | } |
| 321 | |
| 322 | int sigwait64(const sigset64_t* set, int* sig) { |
Elliott Hughes | 6dafb4a | 2018-01-26 17:47:56 -0800 | [diff] [blame] | 323 | while (true) { |
| 324 | // __rt_sigtimedwait can return EAGAIN or EINTR, we need to loop |
| 325 | // around them since sigwait is only allowed to return EINVAL. |
Elliott Hughes | 5905d6f | 2018-01-30 15:09:51 -0800 | [diff] [blame] | 326 | int result = sigtimedwait64(set, nullptr, nullptr); |
Elliott Hughes | 6dafb4a | 2018-01-26 17:47:56 -0800 | [diff] [blame] | 327 | if (result >= 0) { |
| 328 | *sig = result; |
| 329 | return 0; |
| 330 | } |
Elliott Hughes | 5905d6f | 2018-01-30 15:09:51 -0800 | [diff] [blame] | 331 | if (errno != EAGAIN && errno != EINTR) return errno; |
Elliott Hughes | 6dafb4a | 2018-01-26 17:47:56 -0800 | [diff] [blame] | 332 | } |
| 333 | } |
| 334 | |
| 335 | int sigwaitinfo(const sigset_t* set, siginfo_t* info) { |
Elliott Hughes | 5905d6f | 2018-01-30 15:09:51 -0800 | [diff] [blame] | 336 | return sigtimedwait(set, info, nullptr); |
| 337 | } |
| 338 | |
| 339 | int sigwaitinfo64(const sigset64_t* set, siginfo_t* info) { |
| 340 | return sigtimedwait64(set, info, nullptr); |
Elliott Hughes | 6dafb4a | 2018-01-26 17:47:56 -0800 | [diff] [blame] | 341 | } |