zhangmeng
2024-04-09 2561a007b8d8999a4750046d0cfb3b1ad5af50ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "usg_common.h"
static void sig_quit1(int);
static void sig_quit2(int);
int
main(void)
{
  sigset_t
  newmask, oldmask, pendmask;
  if (Signal(SIGQUIT, sig_quit1) == SIG_ERR)
    err_exit(errno, "can’t catch SIGQUIT");
 
  if (Signal(SIGQUIT, sig_quit2) == SIG_ERR)
    err_exit(errno, "can’t catch SIGQUIT");
 
  sleep(15);
  exit(0);
  /* SIGQUIT here will terminate with core file */
}
 
static void sig_quit1(int signo)
{
  printf("caught SIGQUIT 1\n");
   
}
 
 
static void sig_quit2(int signo)
{
  printf("caught SIGQUIT 2\n");
   
}