Switch ref.dio to the new structure

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@183658 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Mehdi Achour 2005-04-05 12:50:53 +00:00
parent 345f1cb361
commit b690627336
9 changed files with 606 additions and 274 deletions

View file

@ -1,30 +1,48 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.5 $ -->
<!-- splitted from ./en/functions/dio.xml, last change in rev 1.1 -->
<!-- $Revision: 1.6 $ -->
<refentry id="function.dio-close">
<refnamediv>
<refname>dio_close</refname>
<refpurpose>Closes the file descriptor given by fd</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>void</type><methodname>dio_close</methodname>
<methodparam><type>resource</type><parameter>fd</parameter></methodparam>
</methodsynopsis>
<para>
The function <function>dio_close</function> closes the
file descriptor <parameter>fd</parameter>.
The function <function>dio_close</function> closes the file descriptor
<parameter>fd</parameter>.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
See also <function>dio_open</function>.
<variablelist>
<varlistentry>
<term><parameter>fd</parameter></term>
<listitem>
<para>
The file descriptor returned by <function>dio_open</function>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.void;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>
Closing an open file descriptor
</title>
<programlisting role="php">
<title>Closing an open file descriptor</title>
<programlisting role="php">
<![CDATA[
<?php
$fd = dio_open('/dev/ttyS0', O_RDWR);
@ -36,6 +54,14 @@ dio_close($fd);
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>dio_open</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -1,13 +1,12 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.8 $ -->
<!-- splitted from ./en/functions/dio.xml, last change in rev 1.1 -->
<!-- $Revision: 1.9 $ -->
<refentry id="function.dio-fcntl">
<refnamediv>
<refname>dio_fcntl</refname>
<refpurpose>Performs a c library fcntl on fd</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>mixed</type><methodname>dio_fcntl</methodname>
<methodparam><type>resource</type><parameter>fd</parameter></methodparam>
@ -20,81 +19,117 @@
descriptor <parameter>fd</parameter>. Some commands require
additional arguments <parameter>args</parameter> to be supplied.
</para>
&note.no-windows;
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<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>
<variablelist>
<varlistentry>
<term><parameter>fd</parameter></term>
<listitem>
<para>
The file descriptor returned by <function>dio_open</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>cmd</parameter></term>
<listitem>
<para>
Can be one of the following operations:
<itemizedlist>
<listitem>
<para>
<constant>F_SETLK</constant> - Lock is set or cleared. If the lock
is held by someone else <function>dio_fcntl</function> returns
-1.
</para>
</listitem>
<listitem>
<para>
<constant>F_SETLKW</constant> - like <constant>F_SETLK</constant>, but in case the lock
is held by someone else, <function>dio_fcntl</function> waits
until the lock is released.
</para>
</listitem>
<listitem>
<para>
<constant>F_GETLK</constant> - <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 <constant>F_UNLCK</constant>.
</para>
</listitem>
<listitem>
<para>
<constant>F_DUPFD</constant> - finds the lowest numbered available file descriptor
greater than or equal to <parameter>args</parameter> and returns
them.
</para>
</listitem>
<listitem>
<para>
<constant>F_SETF</constant>L - Sets the file descriptors flags to the value specified by
<parameter>args</parameter>, which can be <constant>O_APPEND</constant>,
<constant>O_NONBLOCK</constant> or <constant>O_ASYNC</constant>. To use
<constant>O_ASYNC</constant> you will need to use the
<link linkend="ref.pcntl">PCNTL</link> extension.
</para>
</listitem>
</itemizedlist>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>args</parameter></term>
<listitem>
<para>
<parameter>args</parameter> is an associative array, when
<parameter>cmd</parameter> is <constant>F_SETLK</constant> or
<constant>F_SETLLW</constant>, 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 <constant>SEEK_SET</constant>,
<constant>SEEK_END</constant> and <constant>SEEK_CUR</constant>
</para>
</listitem>
<listitem>
<para>
"type" - type of lock: can be <constant>F_RDLCK</constant> (read
lock), <constant>F_WRLCK</constant> (write lock) or
<constant>F_UNLCK</constant> (unlock)
</para>
</listitem>
</itemizedlist>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<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 than or equal to <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>
<example>
<title>
Setting and clearing a lock
</title>
Returns the result of the C call.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Setting and clearing a lock</title>
<programlisting role="php">
<![CDATA[
<?php
@ -114,7 +149,6 @@ dio_close($fd);
</programlisting>
</example>
</para>
&note.no-windows;
</refsect1>
</refentry>

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.6 $ -->
<!-- splitted from ./en/functions/dio.xml, last change in rev 1.1 -->
<!-- $Revision: 1.7 $ -->
<refentry id="function.dio-open">
<refnamediv>
<refname>dio_open</refname>
@ -9,8 +8,8 @@
creation permissions of mode
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>resource</type><methodname>dio_open</methodname>
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
@ -19,64 +18,102 @@
</methodsynopsis>
<para>
<function>dio_open</function> opens a file and returns a new file
descriptor for it, or &false; if any error occurred. If
<parameter>flags</parameter> is O_CREAT, the optional third parameter
<parameter>mode</parameter> will set the mode of the file
(creation permissions). The <parameter>flags</parameter>
parameter can be one of the following options:
<itemizedlist>
<listitem>
<para>O_RDONLY - opens the file for read access.</para>
</listitem>
<listitem>
<para>O_WRONLY - opens the file for write access.</para>
</listitem>
<listitem>
<para>
O_RDWR - opens the file for both reading and
writing.
</para>
</listitem>
</itemizedlist>
The <parameter>flags</parameter> parameter can also include any
combination of the following flags:
<itemizedlist>
<listitem>
<para>
O_CREAT - creates the file, if it doesn't already exist.
</para>
</listitem>
<listitem>
<para>
O_EXCL - if both, O_CREAT and O_EXCL are set,
<function>dio_open</function> fails, if the file already exists.
</para>
</listitem>
<listitem>
<para>
O_TRUNC - if the file exists, and its opened for write access,
the file will be truncated to zero length.
</para>
</listitem>
<listitem>
<para>
O_APPEND - write operations write data at the
end of the file.
</para>
</listitem>
<listitem>
<para>O_NONBLOCK - sets non blocking mode.
</para>
</listitem>
</itemizedlist>
descriptor for it.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
See also: <function>dio_close</function>.
<variablelist>
<varlistentry>
<term><parameter>filename</parameter></term>
<listitem>
<para>
The opened file.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>flags</parameter></term>
<listitem>
<para>
The <parameter>flags</parameter> parameter can also include any
combination of the following flags:
<itemizedlist>
<listitem>
<para>
<constant>O_CREAT</constant> - creates the file, if it doesn't already exist.
</para>
</listitem>
<listitem>
<para>
<constant>O_EXCL</constant> - if both, <constant>O_CREAT</constant>
and <constant>O_EXCL</constant> are set, <function>dio_open</function>
fails, if the file already exists.
</para>
</listitem>
<listitem>
<para>
<constant>O_TRUNC</constant> - if the file exists, and its opened for write access,
the file will be truncated to zero length.
</para>
</listitem>
<listitem>
<para>
<constant>O_APPEND</constant> - write operations write data at the
end of the file.
</para>
</listitem>
<listitem>
<para>
<constant>O_NONBLOCK</constant> - sets non blocking mode.
</para>
</listitem>
</itemizedlist>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>mode</parameter></term>
<listitem>
<para>
If <parameter>flags</parameter> is <constant>O_CREAT</constant>,
<parameter>mode</parameter> will set the mode of the file
(creation permissions).
<itemizedlist>
<listitem>
<para>
<constant>O_RDONLY</constant> - opens the file for read access.
</para>
</listitem>
<listitem>
<para>
<constant>O_WRONLY</constant> - opens the file for write access.
</para>
</listitem>
<listitem>
<para>
<constant>O_RDWR</constant> - opens the file for both reading and
writing.
</para>
</listitem>
</itemizedlist>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
A file descriptor or &false; on error.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title>
Setting the baud rate on a serial port
</title>
<title>Setting the baud rate on a serial port</title>
<programlisting role="php">
<![CDATA[
<?php
@ -89,6 +126,14 @@ dio_close($fd);
</programlisting>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>dio_close</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -1,30 +1,59 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- splitted from ./en/functions/dio.xml, last change in rev 1.1 -->
<!-- $Revision: 1.5 $ -->
<refentry id="function.dio-read">
<refnamediv>
<refname>dio_read</refname>
<refpurpose>
Reads n bytes from fd and returns them, if n is not specified,
reads 1k block
</refpurpose>
<refpurpose>Reads bytes from a file descriptor</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>dio_read</methodname>
<methodparam><type>resource</type><parameter>fd</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>n</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>len</parameter></methodparam>
</methodsynopsis>
<para>
The function <function>dio_read</function> reads and returns
<parameter>n</parameter> bytes from file with descriptor
<parameter>fd</parameter>. If <parameter>n</parameter> is
not specified, <function>dio_read</function> reads 1K sized block
and returns them.
<parameter>len</parameter> bytes from file with descriptor
<parameter>fd</parameter>.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
See also: <function>dio_write</function>.
<variablelist>
<varlistentry>
<term><parameter>fd</parameter></term>
<listitem>
<para>
The file descriptor returned by <function>dio_open</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>len</parameter></term>
<listitem>
<para>
The number of bytes to read. If not specified,
<function>dio_read</function> reads 1K sized block.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The bytes readed from <parameter>fd</parameter>.
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>dio_write</function></member>
</simplelist>
</para>
</refsect1>
</refentry>

View file

@ -1,13 +1,12 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.6 $ -->
<!-- splitted from ./en/functions/dio.xml, last change in rev 1.1 -->
<!-- $Revision: 1.7 $ -->
<refentry id="function.dio-seek">
<refnamediv>
<refname>dio_seek</refname>
<refpurpose>Seeks to pos on fd from whence</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>int</type><methodname>dio_seek</methodname>
<methodparam><type>resource</type><parameter>fd</parameter></methodparam>
@ -16,40 +15,76 @@
</methodsynopsis>
<para>
The function <function>dio_seek</function> is used to change the
file position of the file with descriptor
<parameter>fd</parameter>. The parameter
<parameter>whence</parameter> specifies how the position
<parameter>pos</parameter> should be interpreted:
<itemizedlist>
<listitem>
<para>
SEEK_SET (default) - specifies that <parameter>pos</parameter> is
specified from the beginning of the file.
</para>
</listitem>
<listitem>
<para>
SEEK_CUR - Specifies that <parameter>pos</parameter> is a
count of characters from the current file position. This count
may be positive or negative.
</para>
</listitem>
<listitem>
<para>
SEEK_END - Specifies that <parameter>pos</parameter> is a
count of characters from the end of the file. A negative count
specifies a position within the current extent of the file; a
positive count specifies a position past the current end. If
you set the position past the current end, and actually write
data, you will extend the file with zeros up to that
position.
</para>
</listitem>
</itemizedlist>
<example>
<title>
Setting the baud rate on a serial port
</title>
file position of the given file descriptor.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>fd</parameter></term>
<listitem>
<para>
The file descriptor returned by <function>dio_open</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>pos</parameter></term>
<listitem>
<para>
The new position.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>whence</parameter></term>
<listitem>
<para>
Specifies how the position <parameter>pos</parameter> should be interpreted:
<itemizedlist>
<listitem>
<para>
<constant>SEEK_SET</constant> (default) - specifies that <parameter>pos</parameter> is
specified from the beginning of the file.
</para>
</listitem>
<listitem>
<para>
<constant>SEEK_CUR</constant> - Specifies that <parameter>pos</parameter> is a
count of characters from the current file position. This count
may be positive or negative.
</para>
</listitem>
<listitem>
<para>
<constant>SEEK_END</constant> - Specifies that <parameter>pos</parameter> is a
count of characters from the end of the file. A negative count
specifies a position within the current extent of the file; a
positive count specifies a position past the current end. If
you set the position past the current end, and actually write
data, you will extend the file with zeros up to that
position.
</para>
</listitem>
</itemizedlist>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Setting the baud rate on a serial port</title>
<programlisting role="php">
<![CDATA[
<?php

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/dio.xml, last change in rev 1.1 -->
<!-- $Revision: 1.4 $ -->
<refentry id="function.dio-stat">
<refnamediv>
<refname>dio_stat</refname>
@ -8,35 +7,102 @@
Gets stat information about the file descriptor fd
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>array</type><methodname>dio_stat</methodname>
<methodparam><type>resource</type><parameter>fd</parameter></methodparam>
</methodsynopsis>
<para>
Function <function>dio_stat</function> returns information about
the file with file descriptor
<parameter>fd</parameter>. <function>dio_stat</function> returns
an associative array with the following keys:
<function>dio_stat</function> returns information about the given file
descriptor.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>fd</parameter></term>
<listitem>
<para>
The file descriptor returned by <function>dio_open</function>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns an associative array with the following keys:
<itemizedlist>
<listitem><para>"device" - device</para></listitem>
<listitem><para>"inode" - inode</para></listitem>
<listitem><para>"mode" - mode</para></listitem>
<listitem><para>"nlink" - number of hard links</para></listitem>
<listitem><para>"uid" - user id</para></listitem>
<listitem><para>"gid" - group id</para></listitem>
<listitem>
<para>
"device" - device
</para>
</listitem>
<listitem>
<para>
"inode" - inode
</para>
</listitem>
<listitem>
<para>
"mode" - mode
</para>
</listitem>
<listitem>
<para>
"nlink" - number of hard links
</para>
</listitem>
<listitem>
<para>
"uid" - user id
</para>
</listitem>
<listitem>
<para>
"gid" - group id
</para>
</listitem>
<listitem>
<para>
"device_type" - device type (if inode device)
</para>
</listitem>
<listitem><para>"size" - total size in bytes</para></listitem>
<listitem><para>"blocksize" - blocksize</para></listitem>
<listitem><para>"blocks" - number of blocks allocated</para></listitem>
<listitem><para>"atime" - time of last access</para></listitem>
<listitem><para>"mtime" - time of last modification</para></listitem>
<listitem><para>"ctime" - time of last change</para></listitem>
<listitem>
<para>
"size" - total size in bytes
</para>
</listitem>
<listitem>
<para>
"blocksize" - blocksize
</para>
</listitem>
<listitem>
<para>
"blocks" - number of blocks allocated
</para>
</listitem>
<listitem>
<para>
"atime" - time of last access
</para>
</listitem>
<listitem>
<para>
"mtime" - time of last modification
</para>
</listitem>
<listitem>
<para>
"ctime" - time of last change
</para>
</listitem>
</itemizedlist>
On error <function>dio_stat</function> returns &null;.
</para>

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.8 $ -->
<!-- splitted from ./en/functions/dio.xml, last change in rev 1.1 -->
<!-- $Revision: 1.9 $ -->
<refentry id="function.dio-tcsetattr">
<refnamediv>
<refname>dio_tcsetattr</refname>
@ -8,44 +7,76 @@
Sets terminal attributes and baud rate for a serial port
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>void</type><methodname>dio_tcsetattr</methodname>
<methodparam><type>resource</type><parameter>fd</parameter></methodparam>
<methodparam><type>array</type><parameter>options</parameter></methodparam>
</methodsynopsis>
<para>
The function <function>dio_tcsetattr</function> sets
the terminal attributes and baud rate of the open
<parameter>resource</parameter>. The currently available options are
<itemizedlist>
<listitem>
<para>
'baud' - baud rate of the port - can be 38400,19200,9600,4800,2400,1800,
1200,600,300,200,150,134,110,75 or 50, default value is 9600.
</para>
</listitem>
<listitem>
<para>
'bits' - data bits - can be 8,7,6 or 5. Default value is 8.
</para>
</listitem>
<listitem>
<para>
'stop' - stop bits - can be 1 or 2. Default value is 1.
</para>
</listitem>
<listitem>
<para>
'parity' - can be 0,1 or 2. Default value is 0.
</para>
</listitem>
</itemizedlist>
<example>
<title>
Setting the baud rate on a serial port
</title>
<function>dio_tcsetattr</function> sets the terminal attributes and baud
rate of the open <parameter>resource</parameter>.
</para>
&note.no-windows;
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>fd</parameter></term>
<listitem>
<para>
The file descriptor returned by <function>dio_open</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>options</parameter></term>
<listitem>
<para>
The currently available options are
<itemizedlist>
<listitem>
<para>
'baud' - baud rate of the port - can be 38400,19200,9600,4800,2400,1800,
1200,600,300,200,150,134,110,75 or 50, default value is 9600.
</para>
</listitem>
<listitem>
<para>
'bits' - data bits - can be 8,7,6 or 5. Default value is 8.
</para>
</listitem>
<listitem>
<para>
'stop' - stop bits - can be 1 or 2. Default value is 1.
</para>
</listitem>
<listitem>
<para>
'parity' - can be 0,1 or 2. Default value is 0.
</para>
</listitem>
</itemizedlist>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.void;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Setting the baud rate on a serial port</title>
<programlisting role="php">
<![CDATA[
<?php
@ -75,7 +106,6 @@ while (1) {
</programlisting>
</example>
</para>
&note.no-windows;
</refsect1>
</refentry>

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- splitted from ./en/functions/dio.xml, last change in rev 1.1 -->
<!-- $Revision: 1.5 $ -->
<refentry id="function.dio-truncate">
<refnamediv>
<refname>dio_truncate</refname>
@ -8,24 +7,54 @@
Truncates file descriptor fd to offset bytes
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>dio_truncate</methodname>
<methodparam><type>resource</type><parameter>fd</parameter></methodparam>
<methodparam><type>int</type><parameter>offset</parameter></methodparam>
</methodsynopsis>
<para>
Function <function>dio_truncate</function> causes the file
referenced by <parameter>fd</parameter> to be truncated to at
most <parameter>offset</parameter> bytes in size. If the file
previously was larger than this size, the extra data is lost. If
the file previously was shorter, it is unspecified whether the
file is left unchanged or is extended. In the latter case the
extended part reads as zero bytes. &return.success;.
<function>dio_truncate</function> truncates a file to at most
<parameter>offset</parameter> bytes in size.
</para>
<para>
If the file previously was larger than this size, the extra data is
lost. If the file previously was shorter, it is unspecified whether the
file is left unchanged or is extended. In the latter case the extended
part reads as zero bytes.
</para>
&note.no-windows;
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>fd</parameter></term>
<listitem>
<para>
The file descriptor returned by <function>dio_open</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>offset</parameter></term>
<listitem>
<para>
The offset in bytes.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/dio.xml, last change in rev 1.1 -->
<!-- $Revision: 1.4 $ -->
<refentry id="function.dio-write">
<refnamediv>
<refname>dio_write</refname>
@ -8,8 +7,8 @@
Writes data to fd with optional truncation at length
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>int</type><methodname>dio_write</methodname>
<methodparam><type>resource</type><parameter>fd</parameter></methodparam>
@ -19,14 +18,53 @@
<para>
The function <function>dio_write</function> writes up to
<parameter>len</parameter> bytes from <parameter>data</parameter>
to file <parameter>fd</parameter>. If <parameter>len</parameter>
is not specified, <function>dio_write</function> writes all
<parameter>data</parameter> to the specified
file. <function>dio_write</function> returns the number of bytes
written to <parameter>fd</parameter>.
to file <parameter>fd</parameter>.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
See also <function>dio_read</function>.
<variablelist>
<varlistentry>
<term><parameter>fd</parameter></term>
<listitem>
<para>
The file descriptor returned by <function>dio_open</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>data</parameter></term>
<listitem>
<para>
The written data.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>len</parameter></term>
<listitem>
<para>
The length of data to write in bytes. If not specified, the
function writes all the data to the specified file.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the number of bytes written to <parameter>fd</parameter>.
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>dio_read</function></member>
</simplelist>
</para>
</refsect1>
</refentry>