Reading up on signal(7)
I can see that now: two, but once: three; signal numbers past 31 are reserved for use by the Real-time signal system and should not be used:
Real-time Signals
Linux supports real-time signals as originally defined in the POSIX.1b real-time extensions (and now included in POSIX.1-2001). The range of supported real-time signals is defined by the macros
SIGRTMIN
andSIGRTMAX
. POSIX.1-2001 requires that an implementation support at leastPOSIX_RTSIG_MAX(8)
real-time signals.The Linux kernel supports a range of 32 different real-time signals, numbered 33 to 64. However, the
glibc
POSIX threads implementation internally uses two (for NPTL) or three (for LinuxThreads) real-time signals (seepthreads(7)
), and adjusts the value ofSIGRTMIN
suitably (to 34 or 35). Because the range of available real-time signals varies according to theglibc
threading implementation (and this variation can occur at run time according to the available kernel and glibc), and indeed the range of real-time signals varies across UNIX systems, programs should never refer to real-time signals using hard-coded numbers, but instead should always refer to real-time signals using the notationSIGRTMIN+n
, and include suitable (run-time) checks thatSIGRTMIN+n
does not exceedSIGRTMAX
.
So, how do I determine the value (in a C program that needs to set up signal handling for itself and any children) of SIGRTMIN when the program is running? I have looked through questions and answers here but they all seem to treat SIGRTMIN
as if it was a #define SIGRTMIN 34
when the man
page says that should not be done!