1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * Copyright (C) 2019 Arm Limited
4 * Original author: Dave Martin <Dave.Martin@arm.com>
5 */
6
7 #include "system.h"
8 #include "signal.h"
9
sigemptyset(sigset_t * s)10 int sigemptyset(sigset_t *s)
11 {
12 unsigned int i;
13
14 for (i = 0; i < _NSIG_WORDS; ++i)
15 s->sig[i] = 0;
16
17 return 0;
18 }
19
sigaddset(sigset_t * s,int n)20 int sigaddset(sigset_t *s, int n)
21 {
22 if (n < 1 || n > _NSIG)
23 return -EINVAL;
24
25 s->sig[(n - 1) / _NSIG_BPW] |= 1UL << (n - 1) % _NSIG_BPW;
26 return 0;
27 }
28
sigaction(int n,struct sigaction * sa,const struct sigaction * old)29 int sigaction(int n, struct sigaction *sa, const struct sigaction *old)
30 {
31 return syscall(__NR_rt_sigaction, n, sa, old, sizeof(sa->sa_mask));
32 }
33
sigprocmask(int how,const sigset_t * mask,sigset_t * old)34 int sigprocmask(int how, const sigset_t *mask, sigset_t *old)
35 {
36 return syscall(__NR_rt_sigprocmask, how, mask, old, sizeof(*mask));
37 }
38