forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpcntl_waitpid_rusage1.phpt
50 lines (45 loc) · 985 Bytes
/
pcntl_waitpid_rusage1.phpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
--TEST--
pcntl_waitpid() and rusage
--EXTENSIONS--
pcntl
posix
--FILE--
<?php
$pid = pcntl_fork();
if ($pid == -1) {
die("failed");
} else if ($pid) {
$status = 0;
var_dump(pcntl_waitpid($pid, $status, WUNTRACED, $rusage));
var_dump($rusage['ru_utime.tv_sec']);
var_dump($rusage['ru_utime.tv_usec']);
posix_kill($pid, SIGCONT);
$rusage = array(1,2,3);
pcntl_waitpid($pid, $status, WUNTRACED, $rusage);
var_dump($rusage['ru_utime.tv_sec']);
var_dump($rusage['ru_utime.tv_usec']);
$rusage = "string";
pcntl_waitpid($pid, $status, 0, $rusage);
var_dump(gettype($rusage));
var_dump(count($rusage));
$rusage = new stdClass;
pcntl_waitpid($pid, $status, 0, $rusage);
var_dump(gettype($rusage));
var_dump(count($rusage));
echo "END\n";
} else {
posix_kill(posix_getpid(), SIGSTOP);
exit(42);
}
?>
--EXPECTF--
int(%d)
int(%d)
int(%d)
int(%d)
int(%d)
string(5) "array"
int(0)
string(5) "array"
int(0)
END