1 /* __sigset_t manipulators. Generic/BSD version.
2 Copyright (C) 1991-2017 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
20 #define _SIGSETOPS_H 1
24 /* Return a mask that includes SIG only. The cast to `sigset_t' avoids
25 overflow if `sigset_t' is wider than `int'. */
26 # define __sigmask(sig) (((__sigset_t) 1) << ((sig) - 1))
28 #define __sigemptyset(set) \
30 *(set) = (__sigset_t) 0; \
33 #define __sigfillset(set) \
35 *(set) = ~(__sigset_t) 0; \
39 # define __sigisemptyset(set) \
40 (*(set) == (__sigset_t) 0)
42 # define __sigandset(dest, left, right) \
44 *(dest) = *(left) & *(right); \
48 # define __sigorset(dest, left, right) \
50 *(dest) = *(left) | *(right); \
55 /* These macros needn't check for a bogus signal number;
56 checking is done in the non-__ versions. */
57 # define __sigismember(set, sig) \
59 __sigset_t __mask = __sigmask (sig); \
60 (set) & __mask ? 1 : 0; \
63 # define __sigaddset(set, sig) \
65 __sigset_t __mask = __sigmask (sig); \
70 # define __sigdelset(set, sig) \
72 __sigset_t __mask = __sigmask (sig); \