Skip to content

Commit 120137c

Browse files
committed
Merge branch 'PHP-7.3' into PHP-7.4
2 parents e27af3b + 97dd159 commit 120137c

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

ext/pcntl/pcntl.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,6 +1265,12 @@ static void pcntl_siginfo_to_zval(int signo, siginfo_t *siginfo, zval *user_sigi
12651265
break;
12661266
#endif
12671267
}
1268+
#if defined(SIGRTMIN) && defined(SIGRTMAX)
1269+
if (SIGRTMIN <= signo && signo <= SIGRTMAX) {
1270+
add_assoc_long_ex(user_siginfo, "pid", sizeof("pid")-1, siginfo->si_pid);
1271+
add_assoc_long_ex(user_siginfo, "uid", sizeof("uid")-1, siginfo->si_uid);
1272+
}
1273+
#endif
12681274
}
12691275
}
12701276
/* }}} */
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
pcntl_signal() context of realtime signal
3+
--SKIPIF--
4+
<?php if (!defined('SIGRTMIN')) die("skip realtime signal not supported"); ?>
5+
<?php if (!extension_loaded("pcntl")) print "skip"; ?>
6+
<?php if (!extension_loaded("posix")) die("skip posix extension not available"); ?>
7+
--FILE--
8+
<?php
9+
10+
pcntl_signal(SIGRTMIN, function ($signo, $siginfo) {
11+
printf("got realtime signal from %s, ruid:%s\n", $siginfo['pid'] ?? '', $siginfo['uid'] ?? '');
12+
});
13+
posix_kill(posix_getpid(), SIGRTMIN);
14+
pcntl_signal_dispatch();
15+
16+
echo "ok\n";
17+
?>
18+
--EXPECTF--
19+
%rgot realtime signal from \d+, ruid:\d+%r
20+
ok

0 commit comments

Comments
 (0)