1 | //===-- Linux implementation of sigprocmask -------------------------------===// |
---|---|
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #include "src/signal/sigprocmask.h" |
10 | |
11 | #include "hdr/types/sigset_t.h" |
12 | #include "src/__support/OSUtil/syscall.h" // For internal syscall function. |
13 | #include "src/__support/common.h" |
14 | #include "src/errno/libc_errno.h" |
15 | #include "src/signal/linux/signal_utils.h" |
16 | |
17 | #include <sys/syscall.h> // For syscall numbers. |
18 | |
19 | namespace LIBC_NAMESPACE { |
20 | |
21 | LLVM_LIBC_FUNCTION(int, sigprocmask, |
22 | (int how, const sigset_t *__restrict set, |
23 | sigset_t *__restrict oldset)) { |
24 | int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_rt_sigprocmask, ts: how, ts: set, |
25 | ts: oldset, ts: sizeof(sigset_t)); |
26 | if (!ret) |
27 | return 0; |
28 | |
29 | libc_errno = -ret; |
30 | return -1; |
31 | } |
32 | |
33 | } // namespace LIBC_NAMESPACE |
34 |