Skip to content

Commit 34f4a35

Browse files
committed
ext/pcntl: Bump num_signals to uint16_t
On AIX, NSIG is def'd as SIGMAX64+1, and SIGMAX64 itself is def'd as 255: ``` $ grep -Rw SIGMAX64 /QOpenSys/usr/include/ /QOpenSys/usr/include/sys/signal.h:#define SIGMAX64 255 /QOpenSys/usr/include/sys/signal.h:#define SIGMAX SIGMAX64 /QOpenSys/usr/include/sys/signal.h:#define NSIG64 (SIGMAX64+1) ``` ...this causes an overflow when we set num_signals from the value of NSIG, per GCC: ``` /rpmbuild/BUILD/php-8.5.3/ext/pcntl/pcntl.c:216:25: warning: large integer implicitly truncated to unsigned type [-Woverflow] PCNTL_G(num_signals) = NSIG; ^~~~ ``` ...when we try to use pcntl to i.e. install a signal handler, we get an error from pcntl: ``` Fatal error: Uncaught ValueError: pcntl_signal(): Argument #1 ($signal) must be less than 0 in phar:///QOpenSys/pkgs/bin/composer/vendor/seld/signal-handler/src/SignalHandler.php:491 ``` The easiest way to deal with this silly AIX behaviour is to just promote the storage size.
1 parent 099769d commit 34f4a35

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ext/pcntl/php_pcntl.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ ZEND_BEGIN_MODULE_GLOBALS(pcntl)
4646
bool processing_signal_queue;
4747
volatile bool pending_signals;
4848
bool async_signals;
49-
uint8_t num_signals;
49+
/* some OSes define NSIG to be > UINT8_MAX */
50+
uint16_t num_signals;
5051
int last_error;
5152
struct php_pcntl_pending_signal *head, *tail, *spares;
5253
ZEND_END_MODULE_GLOBALS(pcntl)

0 commit comments

Comments
 (0)