mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-18 05:26:57 +08:00
260 lines
9.5 KiB
HTML
260 lines
9.5 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||
<html>
|
||
<head>
|
||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||
<title>Create a special or ordinary file</title>
|
||
</head>
|
||
<body class="docs"><div id="layout">
|
||
<div id="layout-content"><div id="function.eio-mknod" class="refentry">
|
||
<div class="refnamediv">
|
||
<h1 class="refname">eio_mknod</h1>
|
||
<p class="verinfo">(PECL eio >= 0.0.1dev)</p><p class="refpurpose"><span class="refname">eio_mknod</span> — <span class="dc-title">Create a special or ordinary file</span></p>
|
||
|
||
</div>
|
||
|
||
<div class="refsect1 description" id="refsect1-function.eio-mknod-description">
|
||
<h3 class="title">说明</h3>
|
||
<div class="methodsynopsis dc-description">
|
||
<span class="methodname"><strong>eio_mknod</strong></span>
|
||
( <span class="methodparam"><span class="type">string</span> <code class="parameter">$path</code></span>
|
||
, <span class="methodparam"><span class="type">int</span> <code class="parameter">$mode</code></span>
|
||
, <span class="methodparam"><span class="type">int</span> <code class="parameter">$dev</code></span>
|
||
[, <span class="methodparam"><span class="type">int</span> <code class="parameter">$pri</code><span class="initializer"> = EIO_PRI_DEFAULT</span></span>
|
||
[, <span class="methodparam"><span class="type"><a href="language.types.callable.html" class="type callable">callable</a></span> <code class="parameter">$callback</code><span class="initializer"> = NULL</span></span>
|
||
[, <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$data</code><span class="initializer"> = NULL</span></span>
|
||
|
||
]]] ) : <span class="type">resource</span></div>
|
||
|
||
<p class="para rdfs-comment">
|
||
<span class="function"><strong>eio_mknod()</strong></span> creates ordinary or special(often) file.
|
||
</p>
|
||
|
||
<div class="warning"><strong class="warning">Warning</strong><p class="simpara">本函数还未编写文档,仅有参数列表。</p></div>
|
||
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 parameters" id="refsect1-function.eio-mknod-parameters">
|
||
<h3 class="title">参数</h3>
|
||
<dl>
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">path</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
Path for the new node(file).
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">mode</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="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: <strong><code>EIO_S_IFREG</code></strong>(regular file),
|
||
<strong><code>EIO_S_IFCHR</code></strong>(character file),
|
||
<strong><code>EIO_S_IFBLK</code></strong>(block special file),
|
||
<strong><code>EIO_S_IFIFO</code></strong>(FIFO - named pipe) and
|
||
<strong><code>EIO_S_IFSOCK</code></strong>(UNIX domain socket).
|
||
|
||
To specify permissions <em class="emphasis">EIO_S_I*</em> constants could be
|
||
used.
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">dev</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
If the file type is <strong><code>EIO_S_IFCHR</code></strong> or
|
||
<strong><code>EIO_S_IFBLK</code></strong> then dev specifies the major and minor
|
||
numbers of the newly created device special file. Otherwise
|
||
<code class="parameter">dev</code> ignored. See <em class="emphasis">mknod(2) man page for
|
||
details</em>.
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">pri</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">请求的优先级:<strong><code>EIO_PRI_DEFAULT</code></strong>,<strong><code>EIO_PRI_MIN</code></strong>,<strong><code>EIO_PRI_MAX</code></strong> 或 <strong><code>NULL</code></strong>。如果是
|
||
<strong><code>NULL</code></strong>,<code class="parameter">pri</code> 将设为
|
||
<strong><code>EIO_PRI_DEFAULT</code></strong>。
|
||
</p>
|
||
|
||
</dd>
|
||
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">callback</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
<code class="parameter">callback</code>
|
||
函数在请求完成时被调用。其应匹配一下原型:<div class="example-contents"><div class="phpcode"><pre><span style="color: #000000">
|
||
void callback(mixed $data, int $result[, resource $req]);</span>
|
||
</pre></div></div>
|
||
|
||
<dl>
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">data</code></dt>
|
||
|
||
<dd>
|
||
<p class="para">传递给请求的用户数据。</p></dd>
|
||
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">result</code></dt>
|
||
|
||
<dd>
|
||
<p class="para">针对请求的结果的值。通常是相应的系统调用返回的值。</p></dd>
|
||
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">req</code></dt>
|
||
|
||
<dd>
|
||
<p class="para">可选的请求资源,可被 <span class="function"><a href="eio_get_last_error.html" class="function">eio_get_last_error()</a></span>
|
||
之类的函数使用。</p></dd>
|
||
|
||
|
||
</dl>
|
||
|
||
</p>
|
||
|
||
</dd>
|
||
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">data</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
Arbitrary variable passed to <code class="parameter">callback</code>.
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
</dl>
|
||
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 returnvalues" id="refsect1-function.eio-mknod-returnvalues">
|
||
<h3 class="title">返回值</h3>
|
||
<p class="para">
|
||
<span class="function"><strong>eio_mknod()</strong></span> returns request resource on success or <strong><code>FALSE</code></strong> on error.
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 examples" id="refsect1-function.eio-mknod-examples">
|
||
<h3 class="title">范例</h3>
|
||
<div class="example" id="example-4279">
|
||
<p><strong>Example #1 <span class="function"><strong>eio_mknod()</strong></span> example</strong></p>
|
||
<div class="example-contents">
|
||
<div class="phpcode"><pre><span style="color: #000000">
|
||
<span style="color: #0000BB"><?php<br /></span><span style="color: #FF8000">// FIFO name<br /></span><span style="color: #0000BB">$temp_filename </span><span style="color: #007700">= </span><span style="color: #DD0000">"/tmp/eio-temp-fifo"</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">/* Is called when eio_mknod() finishes */<br /></span><span style="color: #007700">function </span><span style="color: #0000BB">my_mknod_callback</span><span style="color: #007700">(</span><span style="color: #0000BB">$data</span><span style="color: #007700">, </span><span style="color: #0000BB">$result</span><span style="color: #007700">) {<br /> </span><span style="color: #0000BB">$s </span><span style="color: #007700">= </span><span style="color: #0000BB">stat</span><span style="color: #007700">(</span><span style="color: #0000BB">$data</span><span style="color: #007700">);<br /> </span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$s</span><span style="color: #007700">);<br /><br /> if (</span><span style="color: #0000BB">$result </span><span style="color: #007700">== </span><span style="color: #0000BB">0</span><span style="color: #007700">) {<br /> echo </span><span style="color: #DD0000">"eio_mknod_ok"</span><span style="color: #007700">;<br /> }<br /><br /> @</span><span style="color: #0000BB">unlink</span><span style="color: #007700">(</span><span style="color: #0000BB">$data</span><span style="color: #007700">);<br />}<br /><br /></span><span style="color: #0000BB">eio_mknod</span><span style="color: #007700">(</span><span style="color: #0000BB">$temp_filename</span><span style="color: #007700">, </span><span style="color: #0000BB">EIO_S_IFIFO</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">,<br /> </span><span style="color: #0000BB">EIO_PRI_DEFAULT</span><span style="color: #007700">, </span><span style="color: #DD0000">"my_mknod_callback"</span><span style="color: #007700">, </span><span style="color: #0000BB">$temp_filename</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">eio_event_loop</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">?></span>
|
||
</span>
|
||
</pre></div>
|
||
</div>
|
||
|
||
<div class="example-contents"><p>以上例程的输出类似于:</p></div>
|
||
<div class="example-contents screen">
|
||
<div class="cdata"><pre>
|
||
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
|
||
</pre></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 seealso" id="refsect1-function.eio-mknod-seealso">
|
||
<h3 class="title">参见</h3>
|
||
<ul class="simplelist">
|
||
<li class="member">eio_open</li>
|
||
</ul>
|
||
</div>
|
||
|
||
|
||
</div></div></div></body></html> |