Skip to content

Commit

Permalink
[PHP 8.4] pcntl add cpu affinity calls.
Browse files Browse the repository at this point in the history
  • Loading branch information
devnexen committed Dec 27, 2024
1 parent 8bf3587 commit 4d65332
Show file tree
Hide file tree
Showing 3 changed files with 161 additions and 0 deletions.
75 changes: 75 additions & 0 deletions reference/pcntl/functions/pcntl-getcpuaffinity.xml
Original file line number Diff line number Diff line change
@@ -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
-->
84 changes: 84 additions & 0 deletions reference/pcntl/functions/pcntl-setcpuaffinity.xml
Original file line number Diff line number Diff line change
@@ -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
-->
2 changes: 2 additions & 0 deletions reference/pcntl/versions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"/>
Expand Down

0 comments on commit 4d65332

Please sign in to comment.