Download src/php/php-src/ext/pcntl/tests/003.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 1.39 kB
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/pcntl/tests/003.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/ext/pcntl/tests/003.phpt
-
curl -L -o 003.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/pcntl/tests/003.phpt
1.39 kB
| --TEST-- | |
| pcntl: SIG_BLOCK, SIG_UNBLOCK, SIG_SETMASK | |
| --EXTENSIONS-- | |
| pcntl | |
| posix | |
| --SKIPIF-- | |
| if (!function_exists("pcntl_sigprocmask")) die("skip pcntl_sigprocmask() not available"); | |
| --FILE-- | |
| const SIGNO_NAMES = [ | |
| SIGINT => "SIGINT", | |
| SIGTERM => "SIGTERM", | |
| SIGCHLD => "SIGCHLD", | |
| ]; | |
| function map_signo_to_name(int $no): string { | |
| return SIGNO_NAMES[$no]; | |
| } | |
| // Clear mask | |
| pcntl_sigprocmask(SIG_SETMASK, [], $prev); | |
| pcntl_sigprocmask(SIG_BLOCK, [SIGCHLD, SIGTERM], $old); | |
| var_dump(array_map(map_signo_to_name(...), $old)); | |
| pcntl_sigprocmask(SIG_BLOCK, [SIGINT], $old); | |
| var_dump(array_map(map_signo_to_name(...), $old)); | |
| pcntl_sigprocmask(SIG_UNBLOCK, [SIGINT], $old); | |
| var_dump(array_map(map_signo_to_name(...), $old)); | |
| pcntl_sigprocmask(SIG_SETMASK, [SIGINT], $old); | |
| var_dump(array_map(map_signo_to_name(...), $old)); | |
| pcntl_sigprocmask(SIG_SETMASK, [], $old); | |
| var_dump(array_map(map_signo_to_name(...), $old)); | |
| // Restore previous mask | |
| pcntl_sigprocmask(SIG_SETMASK, $prev, $old); | |
| var_dump(array_map(map_signo_to_name(...), $old)); | |
| --EXPECT-- | |
| array(0) { | |
| } | |
| array(2) { | |
| [0]=> | |
| string(7) "SIGTERM" | |
| [1]=> | |
| string(7) "SIGCHLD" | |
| } | |
| array(3) { | |
| [0]=> | |
| string(6) "SIGINT" | |
| [1]=> | |
| string(7) "SIGTERM" | |
| [2]=> | |
| string(7) "SIGCHLD" | |
| } | |
| array(2) { | |
| [0]=> | |
| string(7) "SIGTERM" | |
| [1]=> | |
| string(7) "SIGCHLD" | |
| } | |
| array(1) { | |
| [0]=> | |
| string(6) "SIGINT" | |
| } | |
| array(0) { | |
| } | |