From 4d65332865a11d45b2d479e858f26813dc92c7c9 Mon Sep 17 00:00:00 2001
From: David Carlier <devnexen@gmail.com>
Date: Fri, 27 Dec 2024 07:46:58 +0000
Subject: [PATCH 1/5] [PHP 8.4] pcntl add cpu affinity calls.

---
 .../pcntl/functions/pcntl-getcpuaffinity.xml  | 75 +++++++++++++++++
 .../pcntl/functions/pcntl-setcpuaffinity.xml  | 84 +++++++++++++++++++
 reference/pcntl/versions.xml                  |  2 +
 3 files changed, 161 insertions(+)
 create mode 100644 reference/pcntl/functions/pcntl-getcpuaffinity.xml
 create mode 100644 reference/pcntl/functions/pcntl-setcpuaffinity.xml

diff --git a/reference/pcntl/functions/pcntl-getcpuaffinity.xml b/reference/pcntl/functions/pcntl-getcpuaffinity.xml
new file mode 100644
index 000000000000..33ec4fa6dcb9
--- /dev/null
+++ b/reference/pcntl/functions/pcntl-getcpuaffinity.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision$ -->
+<refentry xml:id="function.pcntl-getcpuaffinity" xmlns="http://docbook.org/ns/docbook">
+ <refnamediv>
+  <refname>pcntl_getcpuaffinity</refname>
+  <refpurpose>Get the cpu affinity of a process</refpurpose>
+ </refnamediv>
+
+ <refsect1 role="description">
+  &reftitle.description;
+  <methodsynopsis>
+   <type class="union"><type>bool</type><type>array</type></type><methodname>pcntl_getcpuaffinity</methodname>
+   <methodparam choice="opt"><type class="union"><type>int</type><type>null</type></type><parameter>pid</parameter><initializer>&null;</initializer></methodparam>
+  </methodsynopsis>
+  <para>
+   <function>pcntl_getcpuaffinity</function> gets the cpu affinity
+   <parameter>pid</parameter>.
+  </para>
+ </refsect1>
+
+ <refsect1 role="parameters">
+  &reftitle.parameters;
+  <para>
+   <variablelist>
+    <varlistentry>
+     <term><parameter>pid</parameter></term>
+     <listitem>
+      <para>
+       If &null;, the process id of the current process is used.
+      </para>
+     </listitem>
+    </varlistentry>
+   </variablelist>
+  </para>
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+  &reftitle.returnvalues;
+  <para>
+   <function>pcntl_getcpuaffinity</function> returns the cpu affinity mask of
+   the process or &false; on error.
+  </para>
+  &return.falseproblem;
+ </refsect1>
+
+ <refsect1 role="seealso">
+  &reftitle.seealso;
+  <para>
+   <simplelist>
+    <member><function>pcntl_setcpuaffinity</function></member>
+   </simplelist>
+  </para>
+ </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-setcpuaffinity.xml b/reference/pcntl/functions/pcntl-setcpuaffinity.xml
new file mode 100644
index 000000000000..6c1e3d1b084b
--- /dev/null
+++ b/reference/pcntl/functions/pcntl-setcpuaffinity.xml
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision$ -->
+<refentry xml:id="function.pcntl-setcpuaffinity" xmlns="http://docbook.org/ns/docbook">
+ <refnamediv>
+  <refname>pcntl_setcpuaffinity</refname>
+  <refpurpose>Set the cpu affinity of a process</refpurpose>
+ </refnamediv>
+
+ <refsect1 role="description">
+  &reftitle.description;
+  <methodsynopsis>
+   <type>bool</type><methodname>pcntl_setcpuaffinity</methodname>
+   <methodparam choice="opt"><type class="union"><type>int</type><type>null</type></type><parameter>pid</parameter><initializer>&null;</initializer></methodparam>
+   <methodparam choice="opt"><type>array</type><parameter>hmask</parameter></methodparam>
+  </methodsynopsis>
+  <para>
+   <function>pcntl_setcpuaffinity</function> sets the cpu affinity
+   <parameter>pid</parameter> with the cpu affinity mask <parameter>hmask</parameter>.
+  </para>
+ </refsect1>
+
+ <refsect1 role="parameters">
+  &reftitle.parameters;
+  <para>
+   <variablelist>
+    <varlistentry>
+     <term><parameter>pid</parameter></term>
+     <listitem>
+      <para>
+       If &null;, the process id of the current process is used.
+      </para>
+     </listitem>
+    </varlistentry>
+    <varlistentry>
+     <term><parameter>hmask</parameter></term>
+     <listitem>
+      <para>
+       The cpu affinity mask comprised of 1 or more cpu id for binding the process to.
+      </para>
+     </listitem>
+    </varlistentry>
+   </variablelist>
+  </para>
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+  &reftitle.returnvalues;
+  <para>
+   <function>pcntl_setcpuaffinity</function> returns &true; if the cpu binding
+   is successful or &false; on error.
+  </para>
+  &return.falseproblem;
+ </refsect1>
+
+ <refsect1 role="seealso">
+  &reftitle.seealso;
+  <para>
+   <simplelist>
+    <member><function>pcntl_setcpuaffinity</function></member>
+   </simplelist>
+  </para>
+ </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/versions.xml b/reference/pcntl/versions.xml
index a8c087fa5e55..b00421970981 100644
--- a/reference/pcntl/versions.xml
+++ b/reference/pcntl/versions.xml
@@ -9,9 +9,11 @@
  <function name="pcntl_errno" from="PHP 5 &gt;= 5.3.4, PHP 7, PHP 8"/>
  <function name="pcntl_exec" from="PHP 4 &gt;= 4.2.0, PHP 5, PHP 7, PHP 8"/>
  <function name="pcntl_fork" from="PHP 4 &gt;= 4.1.0, PHP 5, PHP 7, PHP 8"/>
+ <function name="pcntl_getcpuaffinity" from="PHP 8 &gt;= 8.4.0"/>
  <function name="pcntl_getpriority" from="PHP 5, PHP 7, PHP 8"/>
  <function name="pcntl_get_last_error" from="PHP 5 &gt;= 5.3.4, PHP 7, PHP 8"/>
  <function name="pcntl_rfork" from="PHP 8 &gt;= 8.1.0"/>
+ <function name="pcntl_setcpuaffinity" from="PHP 8 &gt;= 8.4.0"/>
  <function name="pcntl_setpriority" from="PHP 5, PHP 7, PHP 8"/>
  <function name="pcntl_signal" from="PHP 4 &gt;= 4.1.0, PHP 5, PHP 7, PHP 8"/>
  <function name="pcntl_signal_dispatch" from="PHP 5 &gt;= 5.3.0, PHP 7, PHP 8"/>

From 903bd21546be8e3bf960a7b0d9f18faeaf3b8bdf Mon Sep 17 00:00:00 2001
From: Gina Peter Banyard <girgias@php.net>
Date: Tue, 14 Jan 2025 13:19:23 +0000
Subject: [PATCH 2/5] Markup

---
 .../pcntl/functions/pcntl-getcpuaffinity.xml  | 44 ++++++-------
 .../pcntl/functions/pcntl-setcpuaffinity.xml  | 61 +++++++++----------
 2 files changed, 47 insertions(+), 58 deletions(-)

diff --git a/reference/pcntl/functions/pcntl-getcpuaffinity.xml b/reference/pcntl/functions/pcntl-getcpuaffinity.xml
index 33ec4fa6dcb9..1678551eacd9 100644
--- a/reference/pcntl/functions/pcntl-getcpuaffinity.xml
+++ b/reference/pcntl/functions/pcntl-getcpuaffinity.xml
@@ -12,44 +12,38 @@
    <type class="union"><type>bool</type><type>array</type></type><methodname>pcntl_getcpuaffinity</methodname>
    <methodparam choice="opt"><type class="union"><type>int</type><type>null</type></type><parameter>pid</parameter><initializer>&null;</initializer></methodparam>
   </methodsynopsis>
-  <para>
-   <function>pcntl_getcpuaffinity</function> gets the cpu affinity
-   <parameter>pid</parameter>.
-  </para>
+  <simpara>
+   Retrieve the cpu affinity of the <parameter>pid</parameter>.
+  </simpara>
  </refsect1>
 
  <refsect1 role="parameters">
   &reftitle.parameters;
-  <para>
-   <variablelist>
-    <varlistentry>
-     <term><parameter>pid</parameter></term>
-     <listitem>
-      <para>
-       If &null;, the process id of the current process is used.
-      </para>
-     </listitem>
-    </varlistentry>
-   </variablelist>
-  </para>
+  <variablelist>
+   <varlistentry>
+    <term><parameter>pid</parameter></term>
+    <listitem>
+     <simpara>
+      If &null;, the current process ID is used.
+     </simpara>
+    </listitem>
+   </varlistentry>
+  </variablelist>
  </refsect1>
 
  <refsect1 role="returnvalues">
   &reftitle.returnvalues;
-  <para>
-   <function>pcntl_getcpuaffinity</function> returns the cpu affinity mask of
-   the process or &false; on error.
-  </para>
+  <simpara>
+   Returns the cpu affinity mask of the process, &return.falseforfailure;.
+  </simpara>
   &return.falseproblem;
  </refsect1>
 
  <refsect1 role="seealso">
   &reftitle.seealso;
-  <para>
-   <simplelist>
-    <member><function>pcntl_setcpuaffinity</function></member>
-   </simplelist>
-  </para>
+  <simplelist>
+   <member><function>pcntl_setcpuaffinity</function></member>
+  </simplelist>
  </refsect1>
 
 </refentry>
diff --git a/reference/pcntl/functions/pcntl-setcpuaffinity.xml b/reference/pcntl/functions/pcntl-setcpuaffinity.xml
index 6c1e3d1b084b..17830678cb48 100644
--- a/reference/pcntl/functions/pcntl-setcpuaffinity.xml
+++ b/reference/pcntl/functions/pcntl-setcpuaffinity.xml
@@ -13,52 +13,47 @@
    <methodparam choice="opt"><type class="union"><type>int</type><type>null</type></type><parameter>pid</parameter><initializer>&null;</initializer></methodparam>
    <methodparam choice="opt"><type>array</type><parameter>hmask</parameter></methodparam>
   </methodsynopsis>
-  <para>
-   <function>pcntl_setcpuaffinity</function> sets the cpu affinity
-   <parameter>pid</parameter> with the cpu affinity mask <parameter>hmask</parameter>.
-  </para>
+  <simpara>
+   Sets the cpu affinity for the <parameter>pid</parameter> with the cpu affinity mask given by
+   <parameter>hmask</parameter>.
+  </simpara>
  </refsect1>
 
  <refsect1 role="parameters">
   &reftitle.parameters;
-  <para>
-   <variablelist>
-    <varlistentry>
-     <term><parameter>pid</parameter></term>
-     <listitem>
-      <para>
-       If &null;, the process id of the current process is used.
-      </para>
-     </listitem>
-    </varlistentry>
-    <varlistentry>
-     <term><parameter>hmask</parameter></term>
-     <listitem>
-      <para>
-       The cpu affinity mask comprised of 1 or more cpu id for binding the process to.
-      </para>
-     </listitem>
-    </varlistentry>
-   </variablelist>
-  </para>
+  <variablelist>
+   <varlistentry>
+    <term><parameter>pid</parameter></term>
+    <listitem>
+     <simpara>
+      If &null;, the current process ID is used.
+     </simpara>
+    </listitem>
+   </varlistentry>
+   <varlistentry>
+    <term><parameter>hmask</parameter></term>
+    <listitem>
+     <simpara>
+      The cpu affinity mask comprised of one or more cpu id for binding the process to.
+     </simpara>
+    </listitem>
+   </varlistentry>
+  </variablelist>
  </refsect1>
 
  <refsect1 role="returnvalues">
   &reftitle.returnvalues;
-  <para>
-   <function>pcntl_setcpuaffinity</function> returns &true; if the cpu binding
-   is successful or &false; on error.
-  </para>
+  <simpara>
+   &return.success;
+  </simpara>
   &return.falseproblem;
  </refsect1>
 
  <refsect1 role="seealso">
   &reftitle.seealso;
-  <para>
-   <simplelist>
-    <member><function>pcntl_setcpuaffinity</function></member>
-   </simplelist>
-  </para>
+  <simplelist>
+   <member><function>pcntl_setcpuaffinity</function></member>
+  </simplelist>
  </refsect1>
 
 </refentry>

From 7d2248b0c64952b875179c0430e9c9074c959c81 Mon Sep 17 00:00:00 2001
From: David Carlier <devnexen@gmail.com>
Date: Tue, 14 Jan 2025 18:18:22 +0000
Subject: [PATCH 3/5] adding error sections

---
 .../pcntl/functions/pcntl-getcpuaffinity.xml     | 16 ++++++++++++++++
 .../pcntl/functions/pcntl-setcpuaffinity.xml     | 10 ++++++++++
 2 files changed, 26 insertions(+)

diff --git a/reference/pcntl/functions/pcntl-getcpuaffinity.xml b/reference/pcntl/functions/pcntl-getcpuaffinity.xml
index 33ec4fa6dcb9..eb78bc1092ba 100644
--- a/reference/pcntl/functions/pcntl-getcpuaffinity.xml
+++ b/reference/pcntl/functions/pcntl-getcpuaffinity.xml
@@ -43,6 +43,22 @@
   &return.falseproblem;
  </refsect1>
 
+ <refsect1 role="errors">
+  &reftitle.errors;
+  <para>
+   A <classname>ValueError</classname> is thrown when
+   <parameter>pid</parameter> is an invalid process id
+   or the cpu mask had failed to be created..
+  </para>
+  <para>
+   If <parameter>pid</parameter> is a process for which the current
+   user has no allowed permission, a <constant>E_WARNING</constant>
+   is emitted.
+  </para>
+  <para>
+  </para>
+ </refsect1>
+
  <refsect1 role="seealso">
   &reftitle.seealso;
   <para>
diff --git a/reference/pcntl/functions/pcntl-setcpuaffinity.xml b/reference/pcntl/functions/pcntl-setcpuaffinity.xml
index 6c1e3d1b084b..2fb1b73c2514 100644
--- a/reference/pcntl/functions/pcntl-setcpuaffinity.xml
+++ b/reference/pcntl/functions/pcntl-setcpuaffinity.xml
@@ -52,6 +52,16 @@
   &return.falseproblem;
  </refsect1>
 
+ <refsect1 role="errors">
+  &reftitle.errors;
+  <para>
+   A <classname>ValueError</classname> is thrown if one
+   of the cpu id from the <parameter>hmask</parameter> is invalid
+   or <parameter>pid</parameter> is an invalid process id
+   or the cpu mask had failed to be created..
+  </para>
+ </refsect1>
+
  <refsect1 role="seealso">
   &reftitle.seealso;
   <para>

From a347a4b773ddb565fd1106398cc0fdad5389abf1 Mon Sep 17 00:00:00 2001
From: David Carlier <devnexen@gmail.com>
Date: Fri, 24 Jan 2025 12:34:35 +0000
Subject: [PATCH 4/5] update from code changes

---
 reference/pcntl/functions/pcntl-setcpuaffinity.xml | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/reference/pcntl/functions/pcntl-setcpuaffinity.xml b/reference/pcntl/functions/pcntl-setcpuaffinity.xml
index cb86208f6248..5b0e42263cfc 100644
--- a/reference/pcntl/functions/pcntl-setcpuaffinity.xml
+++ b/reference/pcntl/functions/pcntl-setcpuaffinity.xml
@@ -52,10 +52,11 @@
  <refsect1 role="errors">
   &reftitle.errors;
   <para>
-   A <classname>ValueError</classname> is thrown if one
-   of the cpu id from the <parameter>hmask</parameter> is invalid
-   or <parameter>pid</parameter> is an invalid process id
-   or the cpu mask had failed to be created..
+   A <classname>TypeError</classname> is thrown if one
+   of the cpu id from the <parameter>hmask</parameter> is invalid.
+   A <classname>ValueError</classname> is thrown if
+   <parameter>pid</parameter> is an invalid process id
+   or the cpu mask had failed to be created.
   </para>
  </refsect1>
 

From f014b0d528088fc2950755aa494d2d2ca434b8c3 Mon Sep 17 00:00:00 2001
From: Gina Peter Banyard <girgias@php.net>
Date: Thu, 30 Jan 2025 12:29:46 +0000
Subject: [PATCH 5/5] Markup nit

---
 reference/pcntl/functions/pcntl-getcpuaffinity.xml | 10 ++++------
 reference/pcntl/functions/pcntl-setcpuaffinity.xml |  4 ++--
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/reference/pcntl/functions/pcntl-getcpuaffinity.xml b/reference/pcntl/functions/pcntl-getcpuaffinity.xml
index e08d17e70c60..253453a81c94 100644
--- a/reference/pcntl/functions/pcntl-getcpuaffinity.xml
+++ b/reference/pcntl/functions/pcntl-getcpuaffinity.xml
@@ -41,18 +41,16 @@
 
  <refsect1 role="errors">
   &reftitle.errors;
-  <para>
+  <simpara>
    A <classname>ValueError</classname> is thrown when
    <parameter>pid</parameter> is an invalid process id
    or the cpu mask had failed to be created..
-  </para>
-  <para>
+  </simpara>
+  <simpara>
    If <parameter>pid</parameter> is a process for which the current
    user has no allowed permission, a <constant>E_WARNING</constant>
    is emitted.
-  </para>
-  <para>
-  </para>
+  </simpara>
  </refsect1>
 
  <refsect1 role="seealso">
diff --git a/reference/pcntl/functions/pcntl-setcpuaffinity.xml b/reference/pcntl/functions/pcntl-setcpuaffinity.xml
index 5b0e42263cfc..520787cb405c 100644
--- a/reference/pcntl/functions/pcntl-setcpuaffinity.xml
+++ b/reference/pcntl/functions/pcntl-setcpuaffinity.xml
@@ -51,13 +51,13 @@
 
  <refsect1 role="errors">
   &reftitle.errors;
-  <para>
+  <simpara>
    A <classname>TypeError</classname> is thrown if one
    of the cpu id from the <parameter>hmask</parameter> is invalid.
    A <classname>ValueError</classname> is thrown if
    <parameter>pid</parameter> is an invalid process id
    or the cpu mask had failed to be created.
-  </para>
+  </simpara>
  </refsect1>
 
  <refsect1 role="seealso">