From 4d65332865a11d45b2d479e858f26813dc92c7c9 Mon Sep 17 00:00:00 2001 From: David Carlier 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 @@ + + + + + pcntl_getcpuaffinity + Get the cpu affinity of a process + + + + &reftitle.description; + + boolarraypcntl_getcpuaffinity + intnullpid&null; + + + pcntl_getcpuaffinity gets the cpu affinity + pid. + + + + + &reftitle.parameters; + + + + pid + + + If &null;, the process id of the current process is used. + + + + + + + + + &reftitle.returnvalues; + + pcntl_getcpuaffinity returns the cpu affinity mask of + the process or &false; on error. + + &return.falseproblem; + + + + &reftitle.seealso; + + + pcntl_setcpuaffinity + + + + + + 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 @@ + + + + + pcntl_setcpuaffinity + Set the cpu affinity of a process + + + + &reftitle.description; + + boolpcntl_setcpuaffinity + intnullpid&null; + arrayhmask + + + pcntl_setcpuaffinity sets the cpu affinity + pid with the cpu affinity mask hmask. + + + + + &reftitle.parameters; + + + + pid + + + If &null;, the process id of the current process is used. + + + + + hmask + + + The cpu affinity mask comprised of 1 or more cpu id for binding the process to. + + + + + + + + + &reftitle.returnvalues; + + pcntl_setcpuaffinity returns &true; if the cpu binding + is successful or &false; on error. + + &return.falseproblem; + + + + &reftitle.seealso; + + + pcntl_setcpuaffinity + + + + + + 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 @@ + + From 903bd21546be8e3bf960a7b0d9f18faeaf3b8bdf Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard 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 @@ boolarraypcntl_getcpuaffinity intnullpid&null; - - pcntl_getcpuaffinity gets the cpu affinity - pid. - + + Retrieve the cpu affinity of the pid. + &reftitle.parameters; - - - - pid - - - If &null;, the process id of the current process is used. - - - - - + + + pid + + + If &null;, the current process ID is used. + + + + &reftitle.returnvalues; - - pcntl_getcpuaffinity returns the cpu affinity mask of - the process or &false; on error. - + + Returns the cpu affinity mask of the process, &return.falseforfailure;. + &return.falseproblem; &reftitle.seealso; - - - pcntl_setcpuaffinity - - + + pcntl_setcpuaffinity + 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 @@ intnullpid&null; arrayhmask - - pcntl_setcpuaffinity sets the cpu affinity - pid with the cpu affinity mask hmask. - + + Sets the cpu affinity for the pid with the cpu affinity mask given by + hmask. + &reftitle.parameters; - - - - pid - - - If &null;, the process id of the current process is used. - - - - - hmask - - - The cpu affinity mask comprised of 1 or more cpu id for binding the process to. - - - - - + + + pid + + + If &null;, the current process ID is used. + + + + + hmask + + + The cpu affinity mask comprised of one or more cpu id for binding the process to. + + + + &reftitle.returnvalues; - - pcntl_setcpuaffinity returns &true; if the cpu binding - is successful or &false; on error. - + + &return.success; + &return.falseproblem; &reftitle.seealso; - - - pcntl_setcpuaffinity - - + + pcntl_setcpuaffinity + From 7d2248b0c64952b875179c0430e9c9074c959c81 Mon Sep 17 00:00:00 2001 From: David Carlier 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; + + &reftitle.errors; + + A ValueError is thrown when + pid is an invalid process id + or the cpu mask had failed to be created.. + + + If pid is a process for which the current + user has no allowed permission, a E_WARNING + is emitted. + + + + + &reftitle.seealso; 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; + + &reftitle.errors; + + A ValueError is thrown if one + of the cpu id from the hmask is invalid + or pid is an invalid process id + or the cpu mask had failed to be created.. + + + &reftitle.seealso; From a347a4b773ddb565fd1106398cc0fdad5389abf1 Mon Sep 17 00:00:00 2001 From: David Carlier 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 @@ &reftitle.errors; - A ValueError is thrown if one - of the cpu id from the hmask is invalid - or pid is an invalid process id - or the cpu mask had failed to be created.. + A TypeError is thrown if one + of the cpu id from the hmask is invalid. + A ValueError is thrown if + pid is an invalid process id + or the cpu mask had failed to be created. From f014b0d528088fc2950755aa494d2d2ca434b8c3 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard 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 @@ &reftitle.errors; - + A ValueError is thrown when pid is an invalid process id or the cpu mask had failed to be created.. - - + + If pid is a process for which the current user has no allowed permission, a E_WARNING is emitted. - - - + 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 @@ &reftitle.errors; - + A TypeError is thrown if one of the cpu id from the hmask is invalid. A ValueError is thrown if pid is an invalid process id or the cpu mask had failed to be created. - +