pcntl_setns
PHP Manual
PHP Manual»PCNTL 函数»pcntl_setns

pcntl_setns

(PHP 8 >= 8.4.0)

pcntl_setns — Reassociate the calling process with a namespace of another process

说明

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).

参数

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.

返回值

成功时返回 true, 或者在失败时返回 false。

参见

To Top