source: tools/catchsig.c@ db27767

ADT arm-eh ast-experimental cleanup-dtors enum forall-pointer-decay jacob/cs343-translation jenkins-sandbox new-ast new-ast-unique-expr pthread-emulation qualifiedEnum
Last change on this file since db27767 was 4149d9d, checked in by Thierry Delisle <tdelisle@…>, 8 years ago

replacing old repeat script with c program

  • Property mode set to 100644
File size: 658 bytes
Line 
1#include <stdio.h>
2#include <stdlib.h>
3#include <signal.h>
4
5void sig_handler(int signo)
6{
7 fprintf(stderr, "received %d\n", signo);
8 exit(0);
9}
10
11void sig(int signo) {
12 if (signal(signo, sig_handler) == SIG_ERR)
13 {
14 fprintf(stderr,"Error\n");
15 exit(1);
16 }
17}
18
19int main(void)
20{
21 printf("Starting...\n");
22 sig(SIGHUP);
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);
39 while(1);
40 return 0;
41}
Note: See TracBrowser for help on using the repository browser.