1
0
mirror of https://github.com/php/doc-en.git synced 2026-03-23 23:32:18 +01:00

[PHP 8.3] posix extension documentation update (#2928)

Co-authored-by: Gina Peter Baynard <girgias@php.net>
This commit is contained in:
David CARLIER
2023-11-10 05:37:41 +00:00
committed by GitHub
parent b362867fce
commit 9c16642325
8 changed files with 587 additions and 2 deletions

View File

@@ -0,0 +1,152 @@
<?xml version="1.0" encoding="utf-8"?>
<refentry xml:id="function.posix-eaccess" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>posix_eaccess</refname>
<refpurpose>
Determine accessibility of a file
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>posix_eaccess</methodname>
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>flags</parameter><initializer>0</initializer></methodparam>
</methodsynopsis>
<para>
<function>posix_eaccess</function> checks the effective user's permission of a file
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>filename</parameter></term>
<listitem>
<para>
The name of a file to be tested.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>flags</parameter></term>
<listitem>
<para>
A mask consisting of one or more of <constant>POSIX_F_OK</constant>,
<constant>POSIX_R_OK</constant>, <constant>POSIX_W_OK</constant> and
<constant>POSIX_X_OK</constant>.
</para>
<para>
<constant>POSIX_R_OK</constant>, <constant>POSIX_W_OK</constant> and
<constant>POSIX_X_OK</constant> request checking whether the file
exists and has read, write and execute permissions, respectively.
<constant>POSIX_F_OK</constant> just requests checking for the
existence of the file.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>8.3.0</entry>
<entry>
Checks the effective user/group for a file, differing
from <function>posix_access</function> which checks
from the real user/group.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>posix_eaccess</function> example</title>
<para>
This example will check if the $file is readable and writable, otherwise
will print an error message.
</para>
<programlisting role="php">
<![CDATA[
<?php
$file = 'some_file';
if (posix_eaccess($file, POSIX_R_OK | POSIX_W_OK)) {
echo 'The file is readable and writable!';
} else {
$error = posix_get_last_error();
echo "Error $error: " . posix_strerror($error);
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>posix_get_last_error</function></member>
<member><function>posix_strerror</function></member>
<member><function>posix_access</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
-->

View File

@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="utf-8"?>
<refentry xml:id="function.posix-fpathconf" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>posix_fpathconf</refname>
<refpurpose>Returns the value of a configurable limit</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type class="union"><type>int</type><type>false</type></type><methodname>posix_fpathconf</methodname>
<methodparam><type class="union"><type>resource</type><type>int</type></type><parameter>file_descriptor</parameter></methodparam>
<methodparam><type>int</type><parameter>name</parameter></methodparam>
</methodsynopsis>
<para>
Returns the value of a configurable limit from <parameter>name</parameter> for a file descriptor <parameter>resource</parameter>
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
&posix.parameter.fd;
<varlistentry>
<term><parameter>name</parameter></term>
<listitem>
<para>
The name of the configurable limit, one of the following.
<constant>POSIX_PC_LINK_MAX</constant>, <constant>POSIX_PC_MAX_CANON</constant>
<constant>POSIX_PC_MAX_INPUT</constant>, <constant>POSIX_PC_NAME_MAX</constant>
<constant>POSIX_PC_PATH_MAX</constant>, <constant>POSIX_PC_PIPE_BUF</constant>
<constant>POSIX_PC_CHOWN_RESTRICTED</constant>, <constant>POSIX_PC_NO_TRUNC</constant>
<constant>POSIX_PC_ALLOC_SIZE_MIN</constant>, <constant>POSIX_PC_SYMLINK_MAX</constant>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the configurable limit or &false;.
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
<para>
Throws a <classname>ValueError</classname>
when <parameter>resource</parameter> is invalid.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example xml:id="function.posix-fpathconf.example.basic">
<title><function>posix_fpathconf</function> example</title>
<para>
This example will get the max path name's length in bytes
for the current dir.
</para>
<programlisting role="php">
<![CDATA[
<?php
$fd = fopen(__DIR__, "r");
echo posix_fpathconf($fd, POSIX_PC_PATH_MAX);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
4096
]]>
</screen>
</example>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><function>posix_pathconf</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
-->

View File

@@ -10,7 +10,7 @@
&reftitle.description;
<methodsynopsis>
<type class="union"><type>array</type><type>false</type></type><methodname>posix_getrlimit</methodname>
<void/>
<methodparam choice="opt"><type class="union"><type>int</type><type>null</type></type><parameter>resource</parameter><initializer>&null;</initializer></methodparam>
</methodsynopsis>
<para>
<function>posix_getrlimit</function> returns an <type>array</type>
@@ -21,7 +21,19 @@
<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>resource</parameter></term>
<listitem>
<para>
If &null; all resource limits will be fetched.
Otherwise, the only limits of the resource type provided will be returned.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
@@ -115,6 +127,28 @@
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>8.3.0</entry>
<entry>
The optional <parameter>resource</parameter> parameter has been added.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>

View File

@@ -34,6 +34,29 @@
to a terminal and &false; otherwise.
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>8.3.0</entry>
<entry>
Type error <constant>E_WARNING</constant>s are now raised for integer
coercions following the usual PHP type coercion semantics.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<refentry xml:id="function.posix-pathconf" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>posix_pathconf</refname>
<refpurpose>Returns the value of a configurable limit</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type class="union"><type>int</type><type>false</type></type><methodname>posix_pathconf</methodname>
<methodparam><type>string</type><parameter>path</parameter></methodparam>
<methodparam><type>int</type><parameter>name</parameter></methodparam>
</methodsynopsis>
&warn.undocumented.func;
<para>
Returns the value of a configurable limit from <parameter>name</parameter> for a <parameter>file</parameter>
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>path</parameter></term>
<listitem>
<para>
The name of the file whose limit you want to get.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>name</parameter></term>
<listitem>
<para>
The name of the configurable limit, one of the following.
<constant>POSIX_PC_LINK_MAX</constant>, <constant>POSIX_PC_MAX_CANON</constant>
<constant>POSIX_PC_MAX_INPUT</constant>, <constant>POSIX_PC_NAME_MAX</constant>
<constant>POSIX_PC_PATH_MAX</constant>, <constant>POSIX_PC_PIPE_BUF</constant>
<constant>POSIX_PC_CHOWN_RESTRICTED</constant>, <constant>POSIX_PC_NO_TRUNC</constant>
<constant>POSIX_PC_ALLOC_SIZE_MIN</constant>, <constant>POSIX_PC_SYMLINK_MAX</constant>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the configurable limit or &false;.
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
<para>
Throws a <classname>ValueError</classname>
when <parameter>path</parameter> is empty.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example xml:id="function.posix-pathconf.example.basic">
<title><function>posix_pathconf</function> example</title>
<para>
This example will get the max path name's length in bytes
for the tmp dir.
</para>
<programlisting role="php">
<![CDATA[
<?php
echo posix_pathconf(sys_get_temp_dir(), POSIX_PC_PATH_MAX);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
4096
]]>
</screen>
</example>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><function>posix_fpathconf</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
-->

View File

@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<refentry xml:id="function.posix-sysconf" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>posix_sysconf</refname>
<refpurpose>Returns system runtime information</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>int</type><methodname>posix_sysconf</methodname>
<methodparam><type>int</type><parameter>conf_id</parameter></methodparam>
</methodsynopsis>
<para>
Returns system runtime information.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>conf_id</parameter></term>
<listitem>
<para>
Identifier of the variable with the following constants
<constant>POSIX_SC_ARG_MAX</constant>, <constant>POSIX_SC_PAGESIZE</constant>
<constant>POSIX_SC_NPROCESSORS_CONF</constant>, <constant>POSIX_SC_NPROCESSORS_ONLN</constant>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the numeric value related to <parameter>conf_id</parameter>
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example xml:id="function.posix-sysconf.example.basic">
<title><function>posix_sysconf</function> example</title>
<para>
Returns the number of active cpus.
</para>
<programlisting role="php">
<![CDATA[
<?php
echo posix_sysconf(POSIX_SC_NPROCESSORS_ONLN);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
2
]]>
</screen>
</example>
</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
-->

View File

@@ -36,6 +36,54 @@
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
<para>
On invalid <parameter>file_descriptor</parameter> integer values
an <constant>E_WARNING</constant> is raised.
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>8.3.0</entry>
<entry>
Type error <constant>E_WARNING</constant>s are now raised for integer
coercions following the usual PHP type coercion semantics.
</entry>
</row>
<row>
<entry>8.3.0</entry>
<entry>
On invalid <parameter>file_descriptor</parameter> integer values
an <constant>E_WARNING</constant> is now raised.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>posix_isatty</function></member>
<member><function>stream_isatty</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View File

@@ -6,7 +6,9 @@
<versions>
<function name="posix_access" from="PHP 5 &gt;= 5.1.0, PHP 7, PHP 8"/>
<function name="posix_ctermid" from="PHP 4, PHP 5, PHP 7, PHP 8"/>
<function name="posix_eaccess" from="PHP 8 &gt;= 8.3.0"/>
<function name="posix_errno" from="PHP 4 &gt;= 4.2.0, PHP 5, PHP 7, PHP 8"/>
<function name="posix_fpathconf" from="PHP 8 &gt;= 8.3.0"/>
<function name="posix_get_last_error" from="PHP 4 &gt;= 4.2.0, PHP 5, PHP 7, PHP 8"/>
<function name="posix_getcwd" from="PHP 4, PHP 5, PHP 7, PHP 8"/>
<function name="posix_getegid" from="PHP 4, PHP 5, PHP 7, PHP 8"/>
@@ -30,6 +32,7 @@
<function name="posix_kill" from="PHP 4, PHP 5, PHP 7, PHP 8"/>
<function name="posix_mkfifo" from="PHP 4, PHP 5, PHP 7, PHP 8"/>
<function name="posix_mknod" from="PHP 5 &gt;= 5.1.0, PHP 7, PHP 8"/>
<function name="posix_pathconf" from="PHP 8 &gt;= 8.3.0"/>
<function name="posix_setegid" from="PHP 4 &gt;= 4.0.2, PHP 5, PHP 7, PHP 8"/>
<function name="posix_seteuid" from="PHP 4 &gt;= 4.0.2, PHP 5, PHP 7, PHP 8"/>
<function name="posix_setgid" from="PHP 4, PHP 5, PHP 7, PHP 8"/>
@@ -38,6 +41,7 @@
<function name="posix_setsid" from="PHP 4, PHP 5, PHP 7, PHP 8"/>
<function name="posix_setuid" from="PHP 4, PHP 5, PHP 7, PHP 8"/>
<function name="posix_strerror" from="PHP 4 &gt;= 4.2.0, PHP 5, PHP 7, PHP 8"/>
<function name="posix_sysconf" from="PHP 8 &gt;= 8.3.0"/>
<function name="posix_times" from="PHP 4, PHP 5, PHP 7, PHP 8"/>
<function name="posix_ttyname" from="PHP 4, PHP 5, PHP 7, PHP 8"/>
<function name="posix_uname" from="PHP 4, PHP 5, PHP 7, PHP 8"/>