Warning: This file is not a C or C++ file. It does not have highlighting.
| 1 | /* __sigset_t manipulators. Generic/BSD version. |
|---|---|
| 2 | Copyright (C) 1991-2024 Free Software Foundation, Inc. |
| 3 | This file is part of the GNU C Library. |
| 4 | |
| 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. |
| 9 | |
| 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. |
| 14 | |
| 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 | <https://www.gnu.org/licenses/>. */ |
| 18 | |
| 19 | #ifndef _SIGSETOPS_H |
| 20 | #define _SIGSETOPS_H 1 |
| 21 | |
| 22 | #include <signal.h> |
| 23 | |
| 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)) |
| 27 | |
| 28 | #define __sigemptyset(set) \ |
| 29 | (__extension__ ({ \ |
| 30 | *(set) = (__sigset_t) 0; \ |
| 31 | 0; \ |
| 32 | })) |
| 33 | #define __sigfillset(set) \ |
| 34 | (__extension__ ({ \ |
| 35 | *(set) = ~(__sigset_t) 0; \ |
| 36 | 0; \ |
| 37 | })) |
| 38 | |
| 39 | # define __sigisemptyset(set) \ |
| 40 | (*(set) == (__sigset_t) 0) |
| 41 | |
| 42 | # define __sigandset(dest, left, right) \ |
| 43 | (__extension__ ({ \ |
| 44 | *(dest) = *(left) & *(right); \ |
| 45 | 0; \ |
| 46 | })) |
| 47 | |
| 48 | # define __sigorset(dest, left, right) \ |
| 49 | (__extension__ ({ \ |
| 50 | *(dest) = *(left) | *(right); \ |
| 51 | 0; \ |
| 52 | })) |
| 53 | |
| 54 | /* These macros needn't check for a bogus signal number; |
| 55 | checking is done in the non-__ versions. */ |
| 56 | # define __sigismember(set, sig) \ |
| 57 | (__extension__ ({ \ |
| 58 | __sigset_t __mask = __sigmask (sig); \ |
| 59 | *(set) & __mask ? 1 : 0; \ |
| 60 | })) |
| 61 | |
| 62 | # define __sigaddset(set, sig) \ |
| 63 | (__extension__ ({ \ |
| 64 | __sigset_t __mask = __sigmask (sig); \ |
| 65 | *(set) |= __mask; \ |
| 66 | 0; \ |
| 67 | })) |
| 68 | |
| 69 | # define __sigdelset(set, sig) \ |
| 70 | (__extension__ ({ \ |
| 71 | __sigset_t __mask = __sigmask (sig); \ |
| 72 | *(set) &= ~__mask; \ |
| 73 | 0; \ |
| 74 | })) |
| 75 | |
| 76 | #endif |
| 77 |
Warning: This file is not a C or C++ file. It does not have highlighting.
