From 58c419eb2e8fd09fbe3bc897cfb4c52ba4be7be6 Mon Sep 17 00:00:00 2001 From: Sergey Panteleev Date: Thu, 31 Mar 2022 18:41:26 +0300 Subject: [PATCH] [PHP 8.1] Add pcntl_rfork description (#1033) --- reference/pcntl/functions/pcntl-fork.xml | 1 + reference/pcntl/functions/pcntl-rfork.xml | 145 ++++++++++++++++++++++ reference/pcntl/versions.xml | 1 + 3 files changed, 147 insertions(+) create mode 100644 reference/pcntl/functions/pcntl-rfork.xml diff --git a/reference/pcntl/functions/pcntl-fork.xml b/reference/pcntl/functions/pcntl-fork.xml index a2dda61714..c441c08d17 100644 --- a/reference/pcntl/functions/pcntl-fork.xml +++ b/reference/pcntl/functions/pcntl-fork.xml @@ -66,6 +66,7 @@ if ($pid == -1) { &reftitle.seealso; + pcntl_rfork pcntl_waitpid pcntl_signal cli_set_process_title diff --git a/reference/pcntl/functions/pcntl-rfork.xml b/reference/pcntl/functions/pcntl-rfork.xml new file mode 100644 index 0000000000..9db0584f2b --- /dev/null +++ b/reference/pcntl/functions/pcntl-rfork.xml @@ -0,0 +1,145 @@ + + + + pcntl_rfork + Manipulates process resources + + + + &reftitle.description; + + intpcntl_rfork + intflags + intsignal0 + + + Manipulates process resources. + + + + + &reftitle.parameters; + + + + flags + + + The flags parameter determines which resources of the invoking process (parent) + are shared by the new process (child) or initialized to their default values. + + + flags is the logical OR of some subset of: + + + RFPROC: If set a new process is created; + otherwise changes affect the current process. + + + RFNOWAIT: If set, the child process will be dissociated from the parent. + Upon exit the child will not leave a status for the parent to collect. + + + RFFDG: If set, the invoker's file descriptor table is copied; + otherwise the two processes share a single table. + + + RFCFDG: If set, the new process starts with a clean file descriptor table. + Is mutually exclusive with RFFDG. + + + RFLINUXTHPN: If set, the kernel will return SIGUSR1 instead of SIGCHILD upon thread exit for the child. + This is intended to do Linux clone exit parent notification. + + + + + + + signal + + + The signal number. + + + + + + + + + &reftitle.returnvalues; + + On success, the PID of the child process is returned in the + parent's thread of execution, and a 0 is returned in the child's + thread of execution. + On failure, a -1 will be returned in the + parent's context, no child process will be created, and a PHP error is raised. + + + + + &reftitle.examples; + + + <function>pcntl_rfork</function> example + + 0) { + // This is the parent process. + var_dump($pid); +} else { + // This is the child process. + var_dump($pid); + sleep(2); // as the child does not wait, so we see its "pid" +} +?> +]]> + + &example.outputs.similar; + + + + + + + + + &reftitle.seealso; + + + pcntl_fork + pcntl_waitpid + pcntl_signal + cli_set_process_title + + + + + + diff --git a/reference/pcntl/versions.xml b/reference/pcntl/versions.xml index 451c89e1e9..f785a3edd4 100644 --- a/reference/pcntl/versions.xml +++ b/reference/pcntl/versions.xml @@ -11,6 +11,7 @@ +