| 1 | /* Test of <signal.h> substitute.
|
|---|
| 2 | Copyright (C) 2009-2022 Free Software Foundation, Inc.
|
|---|
| 3 |
|
|---|
| 4 | This program is free software: you can redistribute it and/or modify
|
|---|
| 5 | it under the terms of the GNU General Public License as published by
|
|---|
| 6 | the Free Software Foundation, either version 3 of the License, or
|
|---|
| 7 | (at your option) any later version.
|
|---|
| 8 |
|
|---|
| 9 | This program 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
|
|---|
| 12 | GNU General Public License for more details.
|
|---|
| 13 |
|
|---|
| 14 | You should have received a copy of the GNU General Public License
|
|---|
| 15 | along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
|---|
| 16 |
|
|---|
| 17 | /* Written by Eric Blake <ebb9@byu.net>, 2009. */
|
|---|
| 18 |
|
|---|
| 19 | #include <config.h>
|
|---|
| 20 |
|
|---|
| 21 | #include <signal.h>
|
|---|
| 22 |
|
|---|
| 23 | /* Check for required types. */
|
|---|
| 24 | struct
|
|---|
| 25 | {
|
|---|
| 26 | size_t a;
|
|---|
| 27 | uid_t b;
|
|---|
| 28 | volatile sig_atomic_t c;
|
|---|
| 29 | sigset_t d;
|
|---|
| 30 | pid_t e;
|
|---|
| 31 | #if 0
|
|---|
| 32 | /* Not guaranteed by gnulib. */
|
|---|
| 33 | pthread_t f;
|
|---|
| 34 | struct timespec g;
|
|---|
| 35 | #endif
|
|---|
| 36 | } s;
|
|---|
| 37 |
|
|---|
| 38 | /* Check that NSIG is defined. */
|
|---|
| 39 | int nsig = NSIG;
|
|---|
| 40 |
|
|---|
| 41 | int
|
|---|
| 42 | main (void)
|
|---|
| 43 | {
|
|---|
| 44 | switch (0)
|
|---|
| 45 | {
|
|---|
| 46 | /* The following are guaranteed by C. */
|
|---|
| 47 | case 0:
|
|---|
| 48 | case SIGABRT:
|
|---|
| 49 | case SIGFPE:
|
|---|
| 50 | case SIGILL:
|
|---|
| 51 | case SIGINT:
|
|---|
| 52 | case SIGSEGV:
|
|---|
| 53 | case SIGTERM:
|
|---|
| 54 | /* The following is guaranteed by gnulib. */
|
|---|
| 55 | #if GNULIB_SIGPIPE || defined SIGPIPE
|
|---|
| 56 | case SIGPIPE:
|
|---|
| 57 | #endif
|
|---|
| 58 | /* Ensure no conflict with other standardized names. */
|
|---|
| 59 | #ifdef SIGALRM
|
|---|
| 60 | case SIGALRM:
|
|---|
| 61 | #endif
|
|---|
| 62 | /* On Haiku, SIGBUS is mistakenly equal to SIGSEGV. */
|
|---|
| 63 | #if defined SIGBUS && SIGBUS != SIGSEGV
|
|---|
| 64 | case SIGBUS:
|
|---|
| 65 | #endif
|
|---|
| 66 | #ifdef SIGCHLD
|
|---|
| 67 | case SIGCHLD:
|
|---|
| 68 | #endif
|
|---|
| 69 | #ifdef SIGCONT
|
|---|
| 70 | case SIGCONT:
|
|---|
| 71 | #endif
|
|---|
| 72 | #ifdef SIGHUP
|
|---|
| 73 | case SIGHUP:
|
|---|
| 74 | #endif
|
|---|
| 75 | #ifdef SIGKILL
|
|---|
| 76 | case SIGKILL:
|
|---|
| 77 | #endif
|
|---|
| 78 | #ifdef SIGQUIT
|
|---|
| 79 | case SIGQUIT:
|
|---|
| 80 | #endif
|
|---|
| 81 | #ifdef SIGSTOP
|
|---|
| 82 | case SIGSTOP:
|
|---|
| 83 | #endif
|
|---|
| 84 | #ifdef SIGTSTP
|
|---|
| 85 | case SIGTSTP:
|
|---|
| 86 | #endif
|
|---|
| 87 | #ifdef SIGTTIN
|
|---|
| 88 | case SIGTTIN:
|
|---|
| 89 | #endif
|
|---|
| 90 | #ifdef SIGTTOU
|
|---|
| 91 | case SIGTTOU:
|
|---|
| 92 | #endif
|
|---|
| 93 | #ifdef SIGUSR1
|
|---|
| 94 | case SIGUSR1:
|
|---|
| 95 | #endif
|
|---|
| 96 | #ifdef SIGUSR2
|
|---|
| 97 | case SIGUSR2:
|
|---|
| 98 | #endif
|
|---|
| 99 | #ifdef SIGSYS
|
|---|
| 100 | case SIGSYS:
|
|---|
| 101 | #endif
|
|---|
| 102 | #ifdef SIGTRAP
|
|---|
| 103 | case SIGTRAP:
|
|---|
| 104 | #endif
|
|---|
| 105 | #ifdef SIGURG
|
|---|
| 106 | case SIGURG:
|
|---|
| 107 | #endif
|
|---|
| 108 | #ifdef SIGVTALRM
|
|---|
| 109 | case SIGVTALRM:
|
|---|
| 110 | #endif
|
|---|
| 111 | #ifdef SIGXCPU
|
|---|
| 112 | case SIGXCPU:
|
|---|
| 113 | #endif
|
|---|
| 114 | #ifdef SIGXFSZ
|
|---|
| 115 | case SIGXFSZ:
|
|---|
| 116 | #endif
|
|---|
| 117 | /* SIGRTMIN and SIGRTMAX need not be compile-time constants. */
|
|---|
| 118 | #if 0
|
|---|
| 119 | # ifdef SIGRTMIN
|
|---|
| 120 | case SIGRTMIN:
|
|---|
| 121 | # endif
|
|---|
| 122 | # ifdef SIGRTMAX
|
|---|
| 123 | case SIGRTMAX:
|
|---|
| 124 | # endif
|
|---|
| 125 | #endif
|
|---|
| 126 | ;
|
|---|
| 127 | }
|
|---|
| 128 | return s.a + s.b + s.c + s.e;
|
|---|
| 129 | }
|
|---|