pcntl_sigwaitinfo
Description
The pcntl_sigwaitinfo of PCNTL for PHP waits for signals.
Syntax
pcntl_sigwaitinfo( array $signals, array &$info = [] ): int|false
Parameters
signals
The array of signals to wait for.
info
Set to an array containing information about the signal.
All | Description |
---|---|
signo | Signal number |
errno | An error number |
code | Signal code |
SIGCHLD | Description |
---|---|
status | Exit value or signal |
utime | User time consumed |
stime | System time consumed |
pid | Sending process ID |
uid | Real user ID of sending process |
SIGILL, SIGFPE, SIGSEGV, SIGBUS | Description |
---|---|
addr | Memory location which caused fault |
SIGPOLL | Description |
---|---|
band | Band event |
fd | File descriptor number |
Return
Returns a signal number on success, or false on failure.
Examples
1 · signals
<? $signal = SIGHUP; $mode = SIG_BLOCK; $signals = [ $signal ]; pcntl_sigprocmask($mode, $signals); $process_id = posix_getpid(); posix_kill($process_id, $signal); $return = pcntl_sigwaitinfo($signals); echo $return; ?>
1
2 · info · all
<? $signal = SIGHUP; $mode = SIG_BLOCK; $signals = [ $signal ]; pcntl_sigprocmask($mode, $signals); $process_id = posix_getpid(); posix_kill($process_id, $signal); $return = pcntl_sigwaitinfo($signals, $info); echo $return . PHP_EOL; print_r($info); ?>
1 Array ( [signo] => 1 [errno] => 0 [code] => 0 )
3 · info · SIGCHLD
<? $signal = SIGCHLD; $mode = SIG_BLOCK; $signals = [ $signal ]; pcntl_sigprocmask($mode, $signals); $process_id = posix_getpid(); posix_kill($process_id, $signal); $return = pcntl_sigwaitinfo($signals, $info); echo $return . PHP_EOL; print_r($info); ?>
17 Array ( [signo] => 17 [errno] => 0 [code] => 0 [status] => 0 [utime] => 0 [stime] => 0 [pid] => 10178 [uid] => 1175 )
4 · info · SIGILL
<? $signal = SIGILL; $mode = SIG_BLOCK; $signals = [ $signal ]; pcntl_sigprocmask($mode, $signals); $process_id = posix_getpid(); posix_kill($process_id, $signal); $return = pcntl_sigwaitinfo($signals, $info); echo $return . PHP_EOL; print_r($info); ?>
4 Array ( [signo] => 4 [errno] => 0 [code] => 0 [addr] => 5046586583676 )
5 · info · SIGPOLL
<? $signal = SIGPOLL; $mode = SIG_BLOCK; $signals = [ $signal ]; pcntl_sigprocmask($mode, $signals); $process_id = posix_getpid(); posix_kill($process_id, $signal); $return = pcntl_sigwaitinfo($signals, $info); echo $return . PHP_EOL; print_r($info); ?>
29 Array ( [signo] => 29 [errno] => 0 [code] => 0 [band] => 5046586582978 [fd] => 0 )
Links
Related
PCNTL
- pcntl_alarm
- pcntl_async_signals
- pcntl_errno
- pcntl_exec
- pcntl_fork
- pcntl_get_last_error
- pcntl_getpriority
- pcntl_rfork
- pcntl_setpriority
- pcntl_signal
- pcntl_signal_dispatch
- pcntl_signal_get_handler
- pcntl_sigprocmask
- pcntl_sigtimedwait
- pcntl_strerror
- pcntl_unshare
- pcntl_wait
- pcntl_waitpid
- pcntl_wexitstatus
- pcntl_wifexited
- pcntl_wifsignaled
- pcntl_wifstopped
- pcntl_wstopsig
- pcntl_wtermsig