Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

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.

AllDescription
signoSignal number
errnoAn error number
codeSignal code
SIGCHLDDescription
statusExit value or signal
utimeUser time consumed
stimeSystem time consumed
pidSending process ID
uidReal user ID of sending process
SIGILL, SIGFPE, SIGSEGV, SIGBUSDescription
addrMemory location which caused fault
SIGPOLLDescription
bandBand event
fdFile 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] => 3271
    [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] => 5046586576058
)

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] => 5046586576071
    [fd] => 0
)
HomeMenu