php-doc-en/reference/eio/functions/eio-mknod.xml
2012-03-12 05:55:59 +00:00

225 lines
5.1 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.eio-mknod" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>eio_mknod</refname>
<refpurpose>Create a special or ordinary file.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>resource</type><methodname>eio_mknod</methodname>
<methodparam><type>string</type><parameter>path</parameter></methodparam>
<methodparam><type>int</type><parameter>mode</parameter></methodparam>
<methodparam><type>int</type><parameter>dev</parameter></methodparam>
<methodparam
choice="opt"><type>int</type><parameter>pri</parameter><initializer>EIO_PRI_DEFAULT</initializer></methodparam>
<methodparam
choice="opt"><type>callable</type><parameter>callback</parameter><initializer>NULL</initializer></methodparam>
<methodparam
choice="opt"><type>mixed</type><parameter>data</parameter><initializer>NULL</initializer></methodparam>
</methodsynopsis>
<para>
<function>eio_mknod</function> creates ordinary or special(often) file.
</para>
&warn.undocumented.func;
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>path</parameter></term>
<listitem>
<para>
Path for the new node(file).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>mode</parameter></term>
<listitem>
<para>
Specifies both the permissions to use and the type of node to be
created. It should be a combination (using bitwise OR) of one of the
file types listed below and the permissions for the new node(e.g. 0640).
Possible file types are: <constant>EIO_S_IFREG</constant>(regular file),
<constant>EIO_S_IFCHR</constant>(character file),
<constant>EIO_S_IFBLK</constant>(block special file),
<constant>EIO_S_IFIFO</constant>(FIFO - named pipe) and
<constant>EIO_S_IFSOCK</constant>(UNIX domain socket).
To specify permissions <emphasis>EIO_S_I*</emphasis> constants could be
used.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>dev</parameter></term>
<listitem>
<para>
If the file type is <constant>EIO_S_IFCHR</constant> or
<constant>EIO_S_IFBLK</constant> then dev specifies the major and minor
numbers of the newly created device special file. Otherwise
<parameter>dev</parameter> ignored. See <emphasis>mknod(2) man page for
details</emphasis>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>pri</parameter></term>
<listitem>
&eio.request.pri.values;
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>callback</parameter></term>
<listitem>
&eio.callback.proto;
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>data</parameter></term>
<listitem>
<para>
Arbitrary variable passed to <parameter>callback</parameter>.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
<function>eio_mknod</function> returns request resource on success or &false; on error.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>eio_mknod</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
// FIFO name
$temp_filename = "/tmp/eio-temp-fifo";
/* Is called when eio_mknod() finishes */
function my_mknod_callback($data, $result) {
$s = stat($data);
var_dump($s);
if ($result == 0) {
echo "eio_mknod_ok";
}
@unlink($data);
}
eio_mknod($temp_filename, EIO_S_IFIFO, 0,
EIO_PRI_DEFAULT, "my_mknod_callback", $temp_filename);
eio_event_loop();
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
array(26) {
[0]=>
int(17)
[1]=>
int(2337608)
[2]=>
int(4096)
[3]=>
int(1)
[4]=>
int(1000)
[5]=>
int(100)
[6]=>
int(0)
[7]=>
int(0)
[8]=>
int(1318241261)
[9]=>
int(1318241261)
[10]=>
int(1318241261)
[11]=>
int(4096)
[12]=>
int(0)
["dev"]=>
int(17)
["ino"]=>
int(2337608)
["mode"]=>
int(4096)
["nlink"]=>
int(1)
["uid"]=>
int(1000)
["gid"]=>
int(100)
["rdev"]=>
int(0)
["size"]=>
int(0)
["atime"]=>
int(1318241261)
["mtime"]=>
int(1318241261)
["ctime"]=>
int(1318241261)
["blksize"]=>
int(4096)
["blocks"]=>
int(0)
}
eio_mknod_ok
]]>
</screen>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member>eio_open</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
-->