diff --git a/NEWS b/NEWS index c469ba952a8..4fefc16d6cd 100644 --- a/NEWS +++ b/NEWS @@ -146,6 +146,7 @@ PHP NEWS . Added pcntl_getcpu for Linux/FreeBSD/Solaris/Illumos. (David Carlier) . Added pcntl_getqos_class/pcntl_setqos_class for macOs. (David Carlier) . Added SIGCKPT/SIGCKPTEXIT constants for DragonFlyBSD. (David Carlier) + . Added FreeBSD's SIGTRAP handling to pcntl_siginfo_to_zval. (David Carlier) - PCRE: . Upgrade bundled pcre2lib to version 10.43. (nielsdos) diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c index e1451188bb1..31048e47b06 100644 --- a/ext/pcntl/pcntl.c +++ b/ext/pcntl/pcntl.c @@ -1067,6 +1067,20 @@ static void pcntl_siginfo_to_zval(int signo, siginfo_t *siginfo, zval *user_sigi add_assoc_long_ex(user_siginfo, "fd", sizeof("fd")-1, siginfo->si_fd); # endif break; +#endif + +#ifdef SIGTRAP + case SIGTRAP: +# if defined(si_syscall) && defined(__FreeBSD__) + if (siginfo->si_code == TRAP_CAP) { + add_assoc_long_ex(user_siginfo, "syscall", sizeof("syscall")-1, (zend_long)siginfo->si_syscall); + } else { + add_assoc_long_ex(user_siginfo, "trapno", sizeof("trapno")-1, (zend_long)siginfo->si_trapno); + } + +# endif + break; + #endif } #if defined(SIGRTMIN) && defined(SIGRTMAX)