Last change
on this file since a57ad8a was
6f9cc13,
checked in by Peter A. Buhr <pabuhr@…>, 5 years ago
|
formatting
|
-
Property mode set to
100644
|
File size:
578 bytes
|
Rev | Line | |
---|
[4149d9d] | 1 | #include <stdio.h> |
---|
| 2 | #include <stdlib.h> |
---|
| 3 | #include <signal.h> |
---|
| 4 | |
---|
| 5 | void sig_handler(int signo) |
---|
| 6 | { |
---|
| 7 | fprintf(stderr, "received %d\n", signo); |
---|
| 8 | exit(0); |
---|
| 9 | } |
---|
| 10 | |
---|
| 11 | void sig(int signo) { |
---|
| 12 | if (signal(signo, sig_handler) == SIG_ERR) |
---|
| 13 | { |
---|
| 14 | fprintf(stderr,"Error\n"); |
---|
| 15 | exit(1); |
---|
| 16 | } |
---|
| 17 | } |
---|
| 18 | |
---|
| 19 | int main(void) |
---|
| 20 | { |
---|
| 21 | printf("Starting...\n"); |
---|
| 22 | sig(SIGHUP); |
---|
[6f9cc13] | 23 | sig(SIGINT); |
---|
| 24 | sig(SIGQUIT); |
---|
| 25 | sig(SIGILL); |
---|
| 26 | sig(SIGABRT); |
---|
| 27 | sig(SIGFPE); |
---|
| 28 | sig(SIGSEGV); |
---|
| 29 | sig(SIGPIPE); |
---|
| 30 | sig(SIGALRM); |
---|
| 31 | sig(SIGTERM); |
---|
| 32 | sig(SIGUSR1); |
---|
| 33 | sig(SIGUSR2); |
---|
| 34 | sig(SIGCHLD); |
---|
| 35 | sig(SIGCONT); |
---|
| 36 | sig(SIGTSTP); |
---|
| 37 | sig(SIGTTIN); |
---|
| 38 | sig(SIGTTOU); |
---|
[4149d9d] | 39 | while(1); |
---|
| 40 | return 0; |
---|
| 41 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.