xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 1 | /* Copyright (C) 1991-2016 Free Software Foundation, Inc. |
| 2 | This file is part of the GNU C Library. |
| 3 | |
| 4 | The GNU C Library is free software; you can redistribute it and/or |
| 5 | modify it under the terms of the GNU Lesser General Public |
| 6 | License as published by the Free Software Foundation; either |
| 7 | version 2.1 of the License, or (at your option) any later version. |
| 8 | |
| 9 | The GNU C Library is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | Lesser General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU Lesser General Public |
| 15 | License along with the GNU C Library; if not, see |
| 16 | <http://www.gnu.org/licenses/>. */ |
| 17 | |
| 18 | #ifndef _SIGNAL_H |
| 19 | # error "Never include <bits/sigaction.h> directly; use <signal.h> instead." |
| 20 | #endif |
| 21 | |
| 22 | /* These definitions match those used by the 4.4 BSD kernel. |
| 23 | If the operating system has a `sigaction' system call that correctly |
| 24 | implements the POSIX.1 behavior, there should be a system-dependent |
| 25 | version of this file that defines `struct sigaction' and the `SA_*' |
| 26 | constants appropriately. */ |
| 27 | |
| 28 | /* Structure describing the action to be taken when a signal arrives. */ |
| 29 | struct sigaction |
| 30 | { |
| 31 | /* Signal handler. */ |
| 32 | #ifdef __USE_POSIX199309 |
| 33 | union |
| 34 | { |
| 35 | /* Used if SA_SIGINFO is not set. */ |
| 36 | __sighandler_t sa_handler; |
| 37 | /* Used if SA_SIGINFO is set. */ |
| 38 | void (*sa_sigaction) (int, siginfo_t *, void *); |
| 39 | } |
| 40 | __sigaction_handler; |
| 41 | # define sa_handler __sigaction_handler.sa_handler |
| 42 | # define sa_sigaction __sigaction_handler.sa_sigaction |
| 43 | #else |
| 44 | __sighandler_t sa_handler; |
| 45 | #endif |
| 46 | |
| 47 | /* Additional set of signals to be blocked. */ |
| 48 | __sigset_t sa_mask; |
| 49 | |
| 50 | /* Special flags. */ |
| 51 | int sa_flags; |
| 52 | }; |
| 53 | |
| 54 | /* Bits in `sa_flags'. */ |
| 55 | #if defined __USE_UNIX98 || defined __USE_MISC |
| 56 | # define SA_ONSTACK 0x0001 /* Take signal on signal stack. */ |
| 57 | #endif |
| 58 | #if defined __USE_UNIX98 || defined __USE_XOPEN2K8 |
| 59 | # define SA_RESTART 0x0002 /* Restart syscall on signal return. */ |
| 60 | # define SA_NODEFER 0x0010 /* Don't automatically block the signal when |
| 61 | its handler is being executed. */ |
| 62 | # define SA_RESETHAND 0x0004 /* Reset to SIG_DFL on entry to handler. */ |
| 63 | #endif |
| 64 | #define SA_NOCLDSTOP 0x0008 /* Don't send SIGCHLD when children stop. */ |
| 65 | |
| 66 | #ifdef __USE_MISC |
| 67 | # define SA_INTERRUPT 0 /* Historical no-op ("not SA_RESTART"). */ |
| 68 | |
| 69 | /* Some aliases for the SA_ constants. */ |
| 70 | # define SA_NOMASK SA_NODEFER |
| 71 | # define SA_ONESHOT SA_RESETHAND |
| 72 | # define SA_STACK SA_ONSTACK |
| 73 | #endif |
| 74 | |
| 75 | |
| 76 | /* Values for the HOW argument to `sigprocmask'. */ |
| 77 | #define SIG_BLOCK 1 /* Block signals. */ |
| 78 | #define SIG_UNBLOCK 2 /* Unblock signals. */ |
| 79 | #define SIG_SETMASK 3 /* Set the set of blocked signals. */ |