1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

ext/pcntl pcntl_signal_get_handler update.

The situation varies from platform to another, thus taking in
account the complexity of it.

Close GH-13902
This commit is contained in:
David Carlier
2024-04-07 08:43:23 +01:00
parent a22a87243f
commit 01817e99ab
2 changed files with 13 additions and 2 deletions

2
NEWS
View File

@@ -125,6 +125,8 @@ PHP NEWS
- PCNTL:
. Added pcntl_setns for Linux. (David Carlier)
. Added pcntl_getaffinity/pcntl_setaffinity. (David Carlier)
. Updated pcntl_get_signal_handler signal id upper limit to be
more in line with platforms limits. (David Carlier)
- PCRE:
. Upgrade bundled pcre2lib to version 10.43. (nielsdos)

View File

@@ -692,8 +692,17 @@ PHP_FUNCTION(pcntl_signal_get_handler)
Z_PARAM_LONG(signo)
ZEND_PARSE_PARAMETERS_END();
if (signo < 1 || signo > 32) {
zend_argument_value_error(1, "must be between 1 and 32");
// note: max signal on mac is SIGUSR2 (31), no real time signals.
int sigmax = NSIG - 1;
#if defined(SIGRTMAX)
// oddily enough, NSIG on freebsd reports only 32 whereas SIGRTMIN starts at 65.
if (sigmax < SIGRTMAX) {
sigmax = SIGRTMAX;
}
#endif
if (signo < 1 || signo > sigmax) {
zend_argument_value_error(1, "must be between 1 and %d", sigmax);
RETURN_THROWS();
}