????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.216.36 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/self/root/home/b8009/php-5.6.22/ext/pcntl/tests/ |
Upload File : |
--TEST--
Test pcntl wait functionality
--SKIPIF--
<?php
if (!extension_loaded("pcntl")) print "skip";
elseif (!function_exists("posix_kill")) print "skip posix_kill() not available";
?>
--FILE--
<?php
function test_exit_waits(){
print "\n\nTesting pcntl_wifexited and wexitstatus....";
$pid=pcntl_fork();
if ($pid==0) {
sleep(1);
exit(-1);
} else {
$options=0;
pcntl_waitpid($pid, $status, $options);
if ( pcntl_wifexited($status) ) print "\nExited With: ". pcntl_wexitstatus($status);
}
}
function test_exit_signal(){
print "\n\nTesting pcntl_wifsignaled....";
$pid=pcntl_fork();
if ($pid==0) {
sleep(10);
exit;
} else {
$options=0;
posix_kill($pid, SIGTERM);
pcntl_waitpid($pid, $status, $options);
if ( pcntl_wifsignaled($status) ) {
$signal_print=pcntl_wtermsig($status);
if ($signal_print==SIGTERM) $signal_print="SIGTERM";
print "\nProcess was terminated by signal : ". $signal_print;
}
}
}
function test_stop_signal(){
print "\n\nTesting pcntl_wifstopped and pcntl_wstopsig....";
$pid=pcntl_fork();
if ($pid==0) {
sleep(1);
exit;
} else {
$options=WUNTRACED;
posix_kill($pid, SIGSTOP);
pcntl_waitpid($pid, $status, $options);
if ( pcntl_wifstopped($status) ) {
$signal_print=pcntl_wstopsig($status);
if ($signal_print==SIGSTOP) $signal_print="SIGSTOP";
print "\nProcess was stoped by signal : ". $signal_print;
}
posix_kill($pid, SIGCONT);
}
}
print "Staring wait.h tests....";
test_exit_waits();
test_exit_signal();
test_stop_signal();
?>
--EXPECT--
Staring wait.h tests....
Testing pcntl_wifexited and wexitstatus....
Exited With: 255
Testing pcntl_wifsignaled....
Process was terminated by signal : SIGTERM
Testing pcntl_wifstopped and pcntl_wstopsig....
Process was stoped by signal : SIGSTOP