1 // Define Py_NSIG constant for signal handling.
2 
3 #ifndef Py_INTERNAL_SIGNAL_H
4 #define Py_INTERNAL_SIGNAL_H
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
8 
9 #ifndef Py_BUILD_CORE
10 #  error "this header requires Py_BUILD_CORE define"
11 #endif
12 
13 #include <signal.h>                // NSIG
14 
15 #ifdef _SIG_MAXSIG
16    // gh-91145: On FreeBSD, <signal.h> defines NSIG as 32: it doesn't include
17    // realtime signals: [SIGRTMIN,SIGRTMAX]. Use _SIG_MAXSIG instead. For
18    // example on x86-64 FreeBSD 13, SIGRTMAX is 126 and _SIG_MAXSIG is 128.
19 #  define Py_NSIG _SIG_MAXSIG
20 #elif defined(NSIG)
21 #  define Py_NSIG NSIG
22 #elif defined(_NSIG)
23 #  define Py_NSIG _NSIG            // BSD/SysV
24 #elif defined(_SIGMAX)
25 #  define Py_NSIG (_SIGMAX + 1)    // QNX
26 #elif defined(SIGMAX)
27 #  define Py_NSIG (SIGMAX + 1)     // djgpp
28 #else
29 #  define Py_NSIG 64               // Use a reasonable default value
30 #endif
31 
32 #ifdef __cplusplus
33 }
34 #endif
35 #endif  // !Py_INTERNAL_SIGNAL_H
36