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 #include "src/errno/llvmlibc_errno.h"
11 #include "src/signal/linux/signal.h"
12 
13 #include "src/__support/common.h"
14 
15 namespace __llvm_libc {
16 
17 LLVM_LIBC_FUNCTION(int, sigprocmask,
18                    (int how, const sigset_t *__restrict set,
19                     sigset_t *__restrict oldset)) {
20   int ret = __llvm_libc::syscall(SYS_rt_sigprocmask, how, set, oldset,
21                                  sizeof(sigset_t));
22   if (!ret)
23     return 0;
24 
25   llvmlibc_errno = -ret;
26   return -1;
27 }
28 
29 } // namespace __llvm_libc
30