php-doc-en/reference/dio/functions/dio-fcntl.xml
2004-03-04 17:49:47 +00:00

117 lines
3.6 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.6 $ -->
<!-- splitted from ./en/functions/dio.xml, last change in rev 1.1 -->
<refentry id="function.dio-fcntl">
<refnamediv>
<refname>dio_fcntl</refname>
<refpurpose>Performs a c library fcntl on fd</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>mixed</type><methodname>dio_fcntl</methodname>
<methodparam><type>resource</type><parameter>fd</parameter></methodparam>
<methodparam><type>int</type><parameter>cmd</parameter></methodparam>
<methodparam choice="opt"><type>mixed</type><parameter>args</parameter></methodparam>
</methodsynopsis>
<para>
The <function>dio_fcntl</function> function performs the
operation specified by <parameter>cmd</parameter> on the file
descriptor <parameter>fd</parameter>. Some commands require
additional arguments <parameter>args</parameter> to be supplied.
</para>
<para>
<parameter>args</parameter> is an associative array, when
<parameter>cmd</parameter> is F_SETLK or F_SETLLW, with the
following keys:
<itemizedlist>
<listitem>
<para>
"start" - offset where lock begins
</para>
</listitem>
<listitem>
<para>
"length" - size of locked area. zero means to end of file
</para>
</listitem>
<listitem>
<para>
"wenth" - Where l_start is relative to: can be SEEK_SET,
SEEK_END and SEEK_CUR
</para>
</listitem>
<listitem>
<para>
"type" - type of lock: can be F_RDLCK (read lock), F_WRLCK
(write lock) or F_UNLCK (unlock)
</para>
</listitem>
</itemizedlist>
</para>
<para>
<parameter>cmd</parameter> can be one of the following
operations:
<itemizedlist>
<listitem>
<para>
F_SETLK - Lock is set or cleared. If the lock
is held by someone else <function>dio_fcntl</function> returns
-1.
</para>
</listitem>
<listitem>
<para>
F_SETLKW - like F_SETLK, but in case the lock
is held by someone else, <function>dio_fcntl</function> waits
until the lock is released.
</para>
</listitem>
<listitem>
<para>
F_GETLK - <function>dio_fcntl</function> returns an
associative array (as described above) if someone else
prevents lock. If there is no obstruction key "type" will set
to F_UNLCK.
</para>
</listitem>
<listitem>
<para>
F_DUPFD - finds the lowest numbered available file descriptor
greater or equal than <parameter>args</parameter> and returns
them.
</para>
</listitem>
<listitem>
<para>
F_SETFL - Sets the file descriptors flags to the value specified by
<parameter>args</parameter>, which can be O_APPEND,O_NONBLOCK or
O_ASYNC. To use O_ASYNC you will need to use the
<link linkend="ref.pcntl">PCNTL</link> extension.
</para>
</listitem>
</itemizedlist>
</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:"../../../../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
-->