[doc-en] master: Add documentation for 6 new pcntl functions (PHP 8.4) (#5350)
| From: | Louis-Arnaud via GitHub | Date: | Sun, 07 Jun 2026 17:44:17 +0000 |
| Subject: | [doc-en] master: Add documentation for 6 new pcntl functions (PHP 8.4) (#5350) | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-23355@lists.php.net to get a copy of this message | ||
Author: Louis-Arnaud (lacatoire)
Committer: GitHub (web-flow)
Pusher: jordikroon
Date: 2026-06-07T19:44:14+02:00
Commit: https://github.com/php/doc-en/commit/acb474ea92ab6226eaf419a85de05f68c6715a9f
Raw diff: https://github.com/php/doc-en/commit/acb474ea92ab6226eaf419a85de05f68c6715a9f.diff
Add documentation for 6 new pcntl functions (PHP 8.4) (#5350)
* Add documentation for 6 new pcntl functions
Add documentation pages for pcntl functions available since PHP 8.4:
- pcntl_wifcontinued: Check if child continued from job control stop
- pcntl_getcpu: Get current CPU number (Linux)
- pcntl_forkx: Create child process using forkx(2) (illumos/Solaris)
- pcntl_setns: Reassociate process with namespace (Linux)
- pcntl_getqos_class: Get process QoS class (macOS)
- pcntl_setqos_class: Set process QoS class (macOS)
Changed paths:
A reference/pcntl/functions/pcntl-forkx.xml
A reference/pcntl/functions/pcntl-getcpu.xml
A reference/pcntl/functions/pcntl-getqos-class.xml
A reference/pcntl/functions/pcntl-setns.xml
A reference/pcntl/functions/pcntl-setqos-class.xml
A reference/pcntl/functions/pcntl-wifcontinued.xml
Diff:
diff --git a/reference/pcntl/functions/pcntl-forkx.xml b/reference/pcntl/functions/pcntl-forkx.xml
new file mode 100644
index 000000000000..b189e980356c
--- /dev/null
+++ b/reference/pcntl/functions/pcntl-forkx.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="utf-8"?>
+<refentry xml:id="function.pcntl-forkx" xmlns="http://docbook.org/ns/docbook">
+ <refnamediv>
+ <refname>pcntl_forkx</refname>
+ <refpurpose>Create a child process using forkx(2)</refpurpose>
+ </refnamediv>
+
+ <refsect1 role="description">
+ &reftitle.description;
+ <methodsynopsis>
+ <type>int</type><methodname>pcntl_forkx</methodname>
+
<methodparam><type>int</type><parameter>flags</parameter></methodparam>
+ </methodsynopsis>
+ <simpara>
+ The <function>pcntl_forkx</function> function creates a child process
+ using the <literal>forkx(2)</literal> system call, which is available
+ on illumos and Solaris systems.
+ </simpara>
+ </refsect1>
+
+ <refsect1 role="parameters">
+ &reftitle.parameters;
+ <variablelist>
+ <varlistentry>
+ <term><parameter>flags</parameter></term>
+ <listitem>
+ <simpara>
+ The <parameter>flags</parameter> parameter controls the behavior
+ of the fork. Pass <literal>0</literal> for default behavior or
+ <constant>FORK_NOSIGCHLD</constant> to prevent the
+ <constant>SIGCHLD</constant> signal from being sent to the parent
+ when the child terminates.
+ </simpara>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <simpara>
+ On success, the PID of the child process is returned in the
+ parent's thread of execution, and a <literal>0</literal> is returned
+ in the child's thread of execution. On failure, a <literal>-1</literal>
+ will be returned in the parent's context, no child process will be
+ created, and a PHP error is raised.
+ </simpara>
+ </refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <simplelist>
+ <member><function>pcntl_fork</function></member>
+ <member><function>pcntl_rfork</function></member>
+ <member><function>pcntl_waitpid</function></member>
+ </simplelist>
+ </refsect1>
+
+</refentry>
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
diff --git a/reference/pcntl/functions/pcntl-getcpu.xml b/reference/pcntl/functions/pcntl-getcpu.xml
new file mode 100644
index 000000000000..c35c45fc18bd
--- /dev/null
+++ b/reference/pcntl/functions/pcntl-getcpu.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="utf-8"?>
+<refentry xml:id="function.pcntl-getcpu" xmlns="http://docbook.org/ns/docbook">
+ <refnamediv>
+ <refname>pcntl_getcpu</refname>
+ <refpurpose>Get the CPU number on which the calling process last
executed</refpurpose>
+ </refnamediv>
+
+ <refsect1 role="description">
+ &reftitle.description;
+ <methodsynopsis>
+ <type>int</type><methodname>pcntl_getcpu</methodname>
+ <void/>
+ </methodsynopsis>
+ <simpara>
+ <function>pcntl_getcpu</function> returns the number of the CPU on which
+ the calling process was last executed. This function uses the
+ <literal>sched_getcpu(3)</literal> system call available on Linux.
+ </simpara>
+ </refsect1>
+
+ <refsect1 role="parameters">
+ &reftitle.parameters;
+ &no.function.parameters;
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <simpara>
+ Returns the CPU number as an &integer;.
+ </simpara>
+ </refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <simplelist>
+ <member><function>pcntl_getcpuaffinity</function></member>
+ <member><function>pcntl_setcpuaffinity</function></member>
+ </simplelist>
+ </refsect1>
+
+</refentry>
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
diff --git a/reference/pcntl/functions/pcntl-getqos-class.xml
b/reference/pcntl/functions/pcntl-getqos-class.xml
new file mode 100644
index 000000000000..430a54f5d030
--- /dev/null
+++ b/reference/pcntl/functions/pcntl-getqos-class.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="utf-8"?>
+<refentry xml:id="function.pcntl-getqos-class" xmlns="http://docbook.org/ns/docbook">
+ <refnamediv>
+ <refname>pcntl_getqos_class</refname>
+ <refpurpose>Get the current Quality of Service class of the process</refpurpose>
+ </refnamediv>
+
+ <refsect1 role="description">
+ &reftitle.description;
+ <methodsynopsis>
+ <type>Pcntl\QosClass</type><methodname>pcntl_getqos_class</methodname>
+ <void/>
+ </methodsynopsis>
+ <simpara>
+ Returns the current Quality of Service (<acronym>QoS</acronym>) class of the calling
process.
+ This function is only available on macOS, which uses <acronym>QoS</acronym> classes
to
+ manage energy efficiency and performance.
+ </simpara>
+ </refsect1>
+
+ <refsect1 role="parameters">
+ &reftitle.parameters;
+ &no.function.parameters;
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <simpara>
+ Returns a <classname>Pcntl\QosClass</classname> enum value representing
+ the current <acronym>QoS</acronym> class.
+ </simpara>
+ </refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <simplelist>
+ <member><function>pcntl_setqos_class</function></member>
+ </simplelist>
+ </refsect1>
+
+</refentry>
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
diff --git a/reference/pcntl/functions/pcntl-setns.xml b/reference/pcntl/functions/pcntl-setns.xml
new file mode 100644
index 000000000000..851dab086991
--- /dev/null
+++ b/reference/pcntl/functions/pcntl-setns.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="utf-8"?>
+<refentry xml:id="function.pcntl-setns" xmlns="http://docbook.org/ns/docbook">
+ <refnamediv>
+ <refname>pcntl_setns</refname>
+ <refpurpose>Reassociate the calling process with a namespace of another
process</refpurpose>
+ </refnamediv>
+
+ <refsect1 role="description">
+ &reftitle.description;
+ <methodsynopsis>
+ <type>bool</type><methodname>pcntl_setns</methodname>
+ <methodparam choice="opt"><type
class="union"><type>int</type><type>null</type></type><parameter>process_id</parameter><initializer>&null;</initializer></methodparam>
+ <methodparam
choice="opt"><type>int</type><parameter>nstype</parameter><initializer><constant>CLONE_NEWNET</constant></initializer></methodparam>
+ </methodsynopsis>
+ <simpara>
+ Reassociates the calling process with a Linux namespace of the process
+ specified by <parameter>process_id</parameter>, using a pidfd obtained
+ via <literal>pidfd_open(2)</literal> and <literal>setns(2)</literal>.
+ </simpara>
+ </refsect1>
+
+ <refsect1 role="parameters">
+ &reftitle.parameters;
+ <variablelist>
+ <varlistentry>
+ <term><parameter>process_id</parameter></term>
+ <listitem>
+ <simpara>
+ The process ID of the target process whose namespace to join.
+ If &null;, the calling process's own PID is used.
+ </simpara>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><parameter>nstype</parameter></term>
+ <listitem>
+ <simpara>
+ The namespace type to reassociate with. Defaults to
+ <constant>CLONE_NEWNET</constant> (network namespace).
+ Possible values include <constant>CLONE_NEWNET</constant>,
+ <constant>CLONE_NEWIPC</constant>,
+ <constant>CLONE_NEWUTS</constant>, and others.
+ </simpara>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <simpara>
+ &return.success;
+ </simpara>
+ </refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <simplelist>
+ <member><function>pcntl_unshare</function></member>
+ </simplelist>
+ </refsect1>
+
+</refentry>
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
diff --git a/reference/pcntl/functions/pcntl-setqos-class.xml
b/reference/pcntl/functions/pcntl-setqos-class.xml
new file mode 100644
index 000000000000..698d0d231f19
--- /dev/null
+++ b/reference/pcntl/functions/pcntl-setqos-class.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="utf-8"?>
+<refentry xml:id="function.pcntl-setqos-class" xmlns="http://docbook.org/ns/docbook">
+ <refnamediv>
+ <refname>pcntl_setqos_class</refname>
+ <refpurpose>Set the Quality of Service class of the process</refpurpose>
+ </refnamediv>
+
+ <refsect1 role="description">
+ &reftitle.description;
+ <methodsynopsis>
+ <type>void</type><methodname>pcntl_setqos_class</methodname>
+ <methodparam
choice="opt"><type>Pcntl\QosClass</type><parameter>qos_class</parameter><initializer>Pcntl\QosClass::Default</initializer></methodparam>
+ </methodsynopsis>
+ <simpara>
+ Sets the Quality of Service (<acronym>QoS</acronym>) class of the calling process.
+ This function is only available on macOS, which uses <acronym>QoS</acronym> classes
to
+ manage energy efficiency and performance.
+ </simpara>
+ </refsect1>
+
+ <refsect1 role="parameters">
+ &reftitle.parameters;
+ <variablelist>
+ <varlistentry>
+ <term><parameter>qos_class</parameter></term>
+ <listitem>
+ <simpara>
+ The <acronym>QoS</acronym> class to set. Must be one of the
+ <classname>Pcntl\QosClass</classname> enum values:
+ </simpara>
+ <simplelist>
+ <member><literal>Pcntl\QosClass::UserInteractive</literal></member>
+ <member><literal>Pcntl\QosClass::UserInitiated</literal></member>
+ <member><literal>Pcntl\QosClass::Default</literal></member>
+ <member><literal>Pcntl\QosClass::Utility</literal></member>
+ <member><literal>Pcntl\QosClass::Background</literal></member>
+ </simplelist>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <simpara>
+ &return.void;
+ </simpara>
+ </refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <simplelist>
+ <member><function>pcntl_getqos_class</function></member>
+ </simplelist>
+ </refsect1>
+
+</refentry>
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
diff --git a/reference/pcntl/functions/pcntl-wifcontinued.xml
b/reference/pcntl/functions/pcntl-wifcontinued.xml
new file mode 100644
index 000000000000..4190b294f177
--- /dev/null
+++ b/reference/pcntl/functions/pcntl-wifcontinued.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="utf-8"?>
+<refentry xml:id="function.pcntl-wifcontinued" xmlns="http://docbook.org/ns/docbook">
+ <refnamediv>
+ <refname>pcntl_wifcontinued</refname>
+ <refpurpose>Checks whether the child process has continued from a job control
stop</refpurpose>
+ </refnamediv>
+
+ <refsect1 role="description">
+ &reftitle.description;
+ <methodsynopsis>
+ <type>bool</type><methodname>pcntl_wifcontinued</methodname>
+
<methodparam><type>int</type><parameter>status</parameter></methodparam>
+ </methodsynopsis>
+ <simpara>
+ Checks whether the child process which caused the return of
+ <function>pcntl_waitpid</function> has continued from a job control stop.
+ This function is only useful if the call to
+ <function>pcntl_waitpid</function> was done using the
+ <constant>WCONTINUED</constant> option.
+ </simpara>
+ </refsect1>
+
+ <refsect1 role="parameters">
+ &reftitle.parameters;
+ <variablelist>
+ <varlistentry>
+ <term><parameter>status</parameter></term>
+ <listitem>
+ &pcntl.parameter.status;
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <simpara>
+ Returns &true; if the child process which caused the return of
+ <function>pcntl_waitpid</function> has continued from a job control stop,
+ &false; otherwise.
+ </simpara>
+ </refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <simplelist>
+ <member><function>pcntl_waitpid</function></member>
+ <member><function>pcntl_wifstopped</function></member>
+ <member><function>pcntl_wifexited</function></member>
+ <member><function>pcntl_wifsignaled</function></member>
+ </simplelist>
+ </refsect1>
+
+</refentry>
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->