php8.5
Home/ Manual/ pcntl / functions/ pcntl_setns

pcntl_setns

PHP function Edit on GitHub ✎

(PHP 8 >= 8.4.0)

Reassociate the calling process with a namespace of another process

Description

pcntl_setns(int|null $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

Success

See Also

Source: reference/pcntl/functions/pcntl-setns.xml · from the official PHP manual (php/doc-en)