sewardj | 0ca2a6b | 2002-03-29 14:02:34 +0000 | [diff] [blame^] | 1 | |
| 2 | #include <errno.h> |
| 3 | #include <stdio.h> |
| 4 | #include <signal.h> |
| 5 | #include <stdlib.h> |
| 6 | |
| 7 | static void |
| 8 | abend (int sig) |
| 9 | { |
| 10 | printf ("Abended on signal %d\n", sig); |
| 11 | exit (2); |
| 12 | } |
| 13 | |
| 14 | int |
| 15 | main (void) |
| 16 | { |
| 17 | struct sigaction sa; |
| 18 | |
| 19 | int i; |
| 20 | for (i = 1; i <= 64; i++) { |
| 21 | sa.sa_flags = 0; |
| 22 | sigemptyset( &sa.sa_mask ); |
| 23 | sa.sa_handler = abend; |
| 24 | errno = 0; |
| 25 | fprintf(stderr, "setting signal %d: ", i); |
| 26 | sigaction (i /*SIGKILL*/, &sa, NULL); |
| 27 | perror (""); |
| 28 | errno = 0; |
| 29 | fprintf(stderr, "getting signal %d: ", i); |
| 30 | sigaction (i /*SIGKILL*/, NULL, &sa); |
| 31 | perror (""); |
| 32 | fprintf(stderr, "\n"); |
| 33 | } |
| 34 | return 0; |
| 35 | } |