array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'en', ), 'this' => array ( 0 => 'function.pcntl-setns.php', 1 => 'pcntl_setns', 2 => 'Reassociate the calling process with a namespace of another process', ), 'up' => array ( 0 => 'ref.pcntl.php', 1 => 'PCNTL Functions', ), 'prev' => array ( 0 => 'function.pcntl-setcpuaffinity.php', 1 => 'pcntl_setcpuaffinity', ), 'next' => array ( 0 => 'function.pcntl-setpriority.php', 1 => 'pcntl_setpriority', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/pcntl/functions/pcntl-setns.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

pcntl_setns

(No version information available, might only be in Git)

pcntl_setnsReassociate the calling process with a namespace of another process

Description

function pcntl_setns(?int $process_id = null, int $nstype = CLONE_NEWNET): bool

Reassociates the calling process with a Linux namespace of the process specified by process_id, using a pidfd obtained via pidfd_open(2) and setns(2).

Parameters

process_id
The process ID of the target process whose namespace to join. If null, the calling process's own PID is used.
nstype
The namespace type to reassociate with. Defaults to CLONE_NEWNET (network namespace). Possible values include CLONE_NEWNET, CLONE_NEWIPC, CLONE_NEWUTS, and others.

Return Values

Returns true on success or false on failure.

See Also