1 | //===-- Definition of Linux signal number macros --------------------------===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #ifndef LLVM_LIBC_MACROS_LINUX_SIGNAL_MACROS_H |
10 | #define LLVM_LIBC_MACROS_LINUX_SIGNAL_MACROS_H |
11 | |
12 | #define SIGHUP 1 |
13 | #define SIGINT 2 |
14 | #define SIGQUIT 3 |
15 | #define SIGILL 4 |
16 | #define SIGTRAP 5 |
17 | #define SIGABRT 6 |
18 | #define SIGIOT 6 |
19 | #define SIGBUS 7 |
20 | #define SIGFPE 8 |
21 | #define SIGKILL 9 |
22 | #define SIGUSR1 10 |
23 | #define SIGSEGV 11 |
24 | #define SIGUSR2 12 |
25 | #define SIGPIPE 13 |
26 | #define SIGALRM 14 |
27 | #define SIGTERM 15 |
28 | #define SIGSTKFLT 16 |
29 | #define SIGCHLD 17 |
30 | #define SIGCONT 18 |
31 | #define SIGSTOP 19 |
32 | #define SIGTSTP 20 |
33 | #define SIGTTIN 21 |
34 | #define SIGTTOU 22 |
35 | #define SIGURG 23 |
36 | #define SIGXCPU 24 |
37 | #define SIGXFSZ 25 |
38 | #define SIGVTALRM 26 |
39 | #define SIGPROF 27 |
40 | #define SIGWINCH 28 |
41 | #define SIGIO 29 |
42 | #define SIGPOLL SIGIO |
43 | #define SIGPWR 30 |
44 | #define SIGSYS 31 |
45 | |
46 | // Max signal number |
47 | #define NSIG 64 |
48 | |
49 | // SIGRTMIN is current set to the minimum usable from user mode programs. If |
50 | // the libc itself uses some of these signal numbers for private operations, |
51 | // then it has to be adjusted in future to reflect that. |
52 | #define SIGRTMIN 32 |
53 | |
54 | #define SIGRTMAX NSIG |
55 | |
56 | // The kernel sigset is stored as an array of long values. Each bit of this |
57 | // array corresponds to a signal, adjusted by 1. That is, bit 0 corresponds |
58 | // to signal number 1, bit 1 corresponds to signal number 2 and so on. The |
59 | // below macro denotes the size of that array (in number of long words and |
60 | // not bytes). |
61 | #define __NSIGSET_WORDS (NSIG / (sizeof(unsigned long) * 8)) |
62 | |
63 | #define SIG_BLOCK 0 // For blocking signals |
64 | #define SIG_UNBLOCK 1 // For unblocking signals |
65 | #define SIG_SETMASK 2 // For setting signal mask |
66 | |
67 | // Flag values to be used for setting sigaction.sa_flags. |
68 | #define SA_NOCLDSTOP 0x00000001 |
69 | #define SA_NOCLDWAIT 0x00000002 |
70 | #define SA_SIGINFO 0x00000004 |
71 | #define SA_RESTART 0x10000000 |
72 | #define SA_RESTORER 0x04000000 |
73 | #define SA_ONSTACK 0x08000000 |
74 | |
75 | // Signal stack flags |
76 | #define SS_ONSTACK 0x1 |
77 | #define SS_DISABLE 0x2 |
78 | |
79 | #ifdef __x86_64__ |
80 | #define MINSIGSTKSZ 2048 |
81 | #define SIGSTKSZ 8192 |
82 | #elif defined(__aarch64__) |
83 | #define MINSIGSTKSZ 5120 |
84 | #define SIGSTKSZ 16384 |
85 | #elif defined(__riscv) |
86 | #define MINSIGSTKSZ 2048 |
87 | #define SIGSTKSZ 8192 |
88 | #else |
89 | #error "Signal stack sizes not defined for your platform." |
90 | #endif |
91 | |
92 | #define SIG_DFL ((__sighandler_t)0) |
93 | #define SIG_IGN ((__sighandler_t)1) |
94 | #define SIG_ERR ((__sighandler_t)-1) |
95 | |
96 | // SIGCHLD si_codes |
97 | #define CLD_EXITED 1 // child has exited |
98 | #define CLD_KILLED 2 // child was killed |
99 | #define CLD_DUMPED 3 // child terminated abnormally |
100 | #define CLD_TRAPPED 4 // traced child has trapped |
101 | #define CLD_STOPPED 5 // child has stopped |
102 | #define CLD_CONTINUED 6 // stopped child has continued |
103 | |
104 | #endif // LLVM_LIBC_MACROS_LINUX_SIGNAL_MACROS_H |
105 | |