File size: 725 Bytes
1e94262
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
--TEST--
pcntl_setns()
--EXTENSIONS--
pcntl
posix
--SKIPIF--
<?php
if (!function_exists("pcntl_setns")) die("skip pcntl_setns is not available");
if (getenv('SKIP_ASAN')) die('skip Timeouts under ASAN');

$pid = pcntl_fork();
if ($pid == -1) die("skip pcntl_fork failed");
if ($pid != 0) {
    if (@pcntl_setns($pid, CLONE_NEWPID) === false && pcntl_get_last_error() == PCNTL_EPERM) {
        die("skip Insufficient privileges to use pcntl_setns()");
    }
}
?>
--FILE--
<?php
$pid = pcntl_fork();
if ($pid == -1) die("pcntl_fork failed");
if ($pid != 0) {
	try {
		pcntl_setns($pid, 0);
	} catch (\ValueError $e) {
		echo $e->getMessage();
	}
}
?>
--EXPECTF--
pcntl_setns(): Argument #2 ($nstype) is an invalid nstype (%d)