xref: /csrg-svn/old/dbx/tests/cc/signal.c (revision 44091)
1*44091Sbostic /*
2*44091Sbostic  * Test of tracebacks from signal handlers.
3*44091Sbostic  */
4*44091Sbostic 
5*44091Sbostic #include <stdio.h>
6*44091Sbostic #include <signal.h>
7*44091Sbostic 
8*44091Sbostic int catch(), secondcatch();
9*44091Sbostic 
main()10*44091Sbostic main()
11*44091Sbostic {
12*44091Sbostic     signal(SIGQUIT, catch);
13*44091Sbostic     kill(getpid(), SIGQUIT);
14*44091Sbostic     printf("back in main\n");
15*44091Sbostic }
16*44091Sbostic 
catch()17*44091Sbostic catch()
18*44091Sbostic {
19*44091Sbostic     printf("in catch\n");
20*44091Sbostic     sigsetmask(0);
21*44091Sbostic     signal(SIGQUIT, secondcatch);
22*44091Sbostic     kill(getpid(), SIGQUIT);
23*44091Sbostic     printf("back in catch\n");
24*44091Sbostic }
25*44091Sbostic 
secondcatch()26*44091Sbostic secondcatch()
27*44091Sbostic {
28*44091Sbostic     printf("in secondcatch\n");
29*44091Sbostic }
30