diff --git a/reference/pcntl/functions/pcntl-getcpuaffinity.xml b/reference/pcntl/functions/pcntl-getcpuaffinity.xml new file mode 100644 index 000000000000..253453a81c94 --- /dev/null +++ b/reference/pcntl/functions/pcntl-getcpuaffinity.xml @@ -0,0 +1,83 @@ +<?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> + <simpara> + Retrieve the cpu affinity of the <parameter>pid</parameter>. + </simpara> + </refsect1> + + <refsect1 role="parameters"> + &reftitle.parameters; + <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; + <simpara> + Returns the cpu affinity mask of the process, &return.falseforfailure;. + </simpara> + &return.falseproblem; + </refsect1> + + <refsect1 role="errors"> + &reftitle.errors; + <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.. + </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. + </simpara> + </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; + <simplelist> + <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-setcpuaffinity.xml b/reference/pcntl/functions/pcntl-setcpuaffinity.xml new file mode 100644 index 000000000000..520787cb405c --- /dev/null +++ b/reference/pcntl/functions/pcntl-setcpuaffinity.xml @@ -0,0 +1,90 @@ +<?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> + <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; + <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; + <simpara> + &return.success; + </simpara> + &return.falseproblem; + </refsect1> + + <refsect1 role="errors"> + &reftitle.errors; + <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. + </simpara> + </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; + <simplelist> + <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/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 >= 5.3.4, PHP 7, PHP 8"/> <function name="pcntl_exec" from="PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8"/> <function name="pcntl_fork" from="PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8"/> + <function name="pcntl_getcpuaffinity" from="PHP 8 >= 8.4.0"/> <function name="pcntl_getpriority" from="PHP 5, PHP 7, PHP 8"/> <function name="pcntl_get_last_error" from="PHP 5 >= 5.3.4, PHP 7, PHP 8"/> <function name="pcntl_rfork" from="PHP 8 >= 8.1.0"/> + <function name="pcntl_setcpuaffinity" from="PHP 8 >= 8.4.0"/> <function name="pcntl_setpriority" from="PHP 5, PHP 7, PHP 8"/> <function name="pcntl_signal" from="PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8"/> <function name="pcntl_signal_dispatch" from="PHP 5 >= 5.3.0, PHP 7, PHP 8"/>