1 #ifndef ULINUX_SIGNAL_SIGNAL_H
2 #define ULINUX_SIGNAL_SIGNAL_H
4 * this code is protected by the GNU affero GPLv3
5 * author:Sylvain BERTRAND
7 #include <ulinux/arch/signal/signal.h>
9 * In POSIX a signal is sent either to a specific thread (Linux task)
10 * or to the process as a whole (Linux thread group). How the signal
11 * is sent determines whether it's to one thread or the whole group,
12 * which determines which signal mask(s) are involved in blocking it
13 * from being delivered until later. When the signal is delivered,
14 * either it's caught or ignored by a user handler or it has a default
15 * effect that applies to the whole thread group (POSIX process).
17 * The possible effects an unblocked signal set to SIG_DFL can have are:
18 * ignore - Nothing Happens
19 * terminate - kill the process, i.e. all threads in the group,
20 * similar to exit_group. The group leader (only) reports
21 * WIFSIGNALED status to its parent.
22 * coredump - write a core dump file describing all threads using
23 * the same mm and then kill all those threads
24 * stop - stop all the threads in the group, i.e. TASK_STOPPED state
26 * SIGKILL and SIGSTOP cannot be caught, blocked, or ignored.
27 * Other signals when not blocked and set to SIG_DFL behaves as follows.
28 * The job control signals also have other special effects.
30 * +--------------------+------------------+
31 * | POSIX signal | default action |
32 * +--------------------+------------------+
33 * | SIGHUP | terminate |
34 * | SIGINT | terminate |
35 * | SIGQUIT | coredump |
36 * | SIGILL | coredump |
37 * | SIGTRAP | coredump |
38 * | SIGABRT/SIGIOT | coredump |
39 * | SIGBUS | coredump |
40 * | SIGFPE | coredump |
41 * | SIGKILL | terminate(+) |
42 * | SIGUSR1 | terminate |
43 * | SIGSEGV | coredump |
44 * | SIGUSR2 | terminate |
45 * | SIGPIPE | terminate |
46 * | SIGALRM | terminate |
47 * | SIGTERM | terminate |
48 * | SIGCHLD | ignore |
49 * | SIGCONT | ignore(*) |
50 * | SIGSTOP | stop(*)(+) |
51 * | SIGTSTP | stop(*) |
52 * | SIGTTIN | stop(*) |
53 * | SIGTTOU | stop(*) |
55 * | SIGXCPU | coredump |
56 * | SIGXFSZ | coredump |
57 * | SIGVTALRM | terminate |
58 * | SIGPROF | terminate |
59 * | SIGPOLL/SIGIO | terminate |
60 * | SIGSYS/SIGUNUSED | coredump |
61 * | SIGSTKFLT | terminate |
62 * | SIGWINCH | ignore |
63 * | SIGPWR | terminate |
64 * | SIGRTMIN-SIGRTMAX | terminate |
65 * +--------------------+------------------+
66 * | non-POSIX signal | default action |
67 * +--------------------+------------------+
68 * | SIGEMT | coredump |
69 * +--------------------+------------------+
71 * (+) For SIGKILL and SIGSTOP the action is "always", not just "default".
72 * (*) Special job control effects:
73 * When SIGCONT is sent, it resumes the process (all threads in the group)
74 * from TASK_STOPPED state and also clears any pending/queued stop signals
75 * (any of those marked with "stop(*)"). This happens regardless of blocking,
76 * catching, or ignoring SIGCONT. When any stop signal is sent, it clears
77 * any pending/queued SIGCONT signals; this happens regardless of blocking,
78 * catching, or ignored the stop signal, though (except for SIGSTOP) the
79 * default action of stopping the process may happen later or never.
82 #define ULINUX_SIG_BLOCK 0 /* for blocking signals */
83 #define ULINUX_SIG_UNBLOCK 1 /* for unblocking signals */
84 #define ULINUX_SIG_SETMASK 2 /* for setting the signal mask */
87 /*----------------------------------------------------------------------------*/
89 #ifndef ULINUX_O_NONBLOCK
90 #error "missing definition of ULINUX_O_NONBLOCK"
92 #define ULINUX_SFD_NONBLOCK ULINUX_O_NONBLOCK
93 #ifndef ULINUX_O_CLOEXEC
94 #error "missing definition of ULINUX_O_CLOEXEC"
96 #define ULINUX_SFD_CLOEXEC ULINUX_O_CLOEXEC
98 /* user siginfo stuff */
99 struct ulinux_signalfd_siginfo
{
100 ulinux_u32 ssi_signo
;
101 ulinux_s32 ssi_errno
;
108 ulinux_u32 ssi_overrun
;
109 ulinux_u32 ssi_trapno
;
110 ulinux_s32 ssi_status
;
113 ulinux_u64 ssi_utime
;
114 ulinux_u64 ssi_stime
;
116 ulinux_u16 ssi_addr_lsb
;
118 ulinux_s32 ssi_syscall
;
119 ulinux_u64 ssi_call_addr
;
123 * Pad strcture to 128 bytes. Remember to update the
124 * pad size when you add new members. We use a fixed
125 * size structure to avoid compatibility problems with
126 * future versions, and we leave extra space for additional
127 * members. We use fixed size members because this strcture
128 * comes out of a read(2) and we really don't want to have
129 * a compat on read(2).
133 /*----------------------------------------------------------------------------*/