xref: /haiku/headers/private/system/signal_defs.h (revision 2b76973fa2401f7a5edf68e6470f3d3210cbcff3)
1 /*
2  * Copyright 2011, Ingo Weinhold, ingo_weinhold@gmx.de.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _SYSTEM_SIGNAL_DEFS_H
6 #define _SYSTEM_SIGNAL_DEFS_H
7 
8 
9 #include <signal.h>
10 #include <unistd.h>
11 
12 
13 // The total number of signals a process may have queued at receivers at any
14 // time.
15 #define MAX_QUEUED_SIGNALS			_POSIX_SIGQUEUE_MAX
16 
17 // realtime signal number range
18 #define SIGNAL_REALTIME_MIN			33
19 #define SIGNAL_REALTIME_MAX			40
20 
21 // greatest actually supported signal number
22 #define MAX_SIGNAL_NUMBER			SIGNAL_REALTIME_MAX
23 
24 // additional send_signal_etc() flags
25 #define SIGNAL_FLAG_QUEUING_REQUIRED		(0x10000)
26 	// force signal queuing, i.e. fail instead of falling back to unqueued
27 	// signals, when queuing isn't possible
28 #define SIGNAL_FLAG_SEND_TO_THREAD			(0x20000)
29 	// interpret the the given ID as a thread_id rather than a team_id (syscall
30 	// use only)
31 
32 // additional sigaction::sa_flags flag
33 #define SA_BEOS_COMPATIBLE_HANDLER		0x80000000
34 	// BeOS compatible signal handler, i.e. the vregs argument is passed
35 	// per-value, not per-pointer
36 
37 #define SIGNAL_TO_MASK(signal)	((sigset_t)1 << ((signal) - 1))
38 #define SIGNAL_RANGE_TO_MASK(first, last)	\
39 	((((SIGNAL_TO_MASK(last) - 1) << 1) | 1) & ~(SIGNAL_TO_MASK(first) - 1))
40 	// Note: The last mask computation looks that way to avoid an overflow for
41 	// last == 64.
42 
43 #endif	/* _SYSTEM_SIGNAL_DEFS_H */
44