1 /*
2  * Copyright (C) 2015-2021 Alibaba Group Holding Limited
3  */
4 
5 #ifndef _SIGNAL_H
6 #define _SIGNAL_H
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 #include <stdint.h>
13 #include <pthread.h>
14 
15 /* Here is only signal definitions, no signal function is supported. */
16 #define SIGHUP    1
17 #define SIGINT    2
18 #define SIGQUIT   3
19 #define SIGILL    4
20 #define SIGTRAP   5
21 #define SIGABRT   6
22 #define SIGIOT    SIGABRT
23 #define SIGBUS    7
24 #define SIGFPE    8
25 #define SIGKILL   9
26 #define SIGUSR1   10
27 #define SIGSEGV   11
28 #define SIGUSR2   12
29 #define SIGPIPE   13
30 #define SIGALRM   14
31 #define SIGTERM   15
32 #define SIGSTKFLT 16
33 #define SIGCHLD   17
34 #define SIGCONT   18
35 #define SIGSTOP   19
36 #define SIGTSTP   20
37 #define SIGTTIN   21
38 #define SIGTTOU   22
39 #define SIGURG    23
40 #define SIGXCPU   24
41 #define SIGXFSZ   25
42 #define SIGVTALRM 26
43 #define SIGPROF   27
44 #define SIGWINCH  28
45 #define SIGIO     29
46 #define SIGPOLL   29
47 #define SIGPWR    30
48 #define SIGSYS    31
49 #define SIGUNUSED SIGSYS
50 #define NSIG 32
51 
52 #define SIG_BLOCK     0
53 #define SIG_UNBLOCK   1
54 #define SIG_SETMASK   2
55 
56 
57 typedef uint32_t sigset_t;
58 typedef void (*sighandler_t)(int);
59 typedef sighandler_t _sig_func_ptr;
60 
61 #define SIG_ERR  ((sighandler_t)-1)
62 #define SIG_DFL  ((sighandler_t) 0)
63 #define SIG_IGN  ((sighandler_t) 1)
64 
65 #define SIGEV_NONE   0
66 #define SIGEV_SIGNAL 1
67 #define SIGEV_THREAD 2
68 
69 union sigval {
70     int   sival_int;
71     void *sival_ptr;
72 };
73 
74 struct sigevent {
75     int             sigev_notify;
76     int             sigev_signo;
77     union sigval    sigev_value;
78     pthread_attr_t *sigev_notify_attributes;
79     void (*sigev_notify_function)(union sigval);
80 };
81 
82 #ifdef __cplusplus
83 }
84 #endif
85 
86 #endif /* _SIGNAL_H */
87