File: dio.xml

package info (click to toggle)
phpdoc 20020310-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 35,272 kB
  • ctags: 354
  • sloc: xml: 799,767; php: 1,395; cpp: 500; makefile: 200; sh: 140; awk: 51
file content (388 lines) | stat: -rw-r--r-- 13,250 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.10 $ -->
 <reference id="ref.dio">
  <title>Direct IO functions</title>
  <titleabbrev>DIO functions</titleabbrev>

  <partintro>
   <section id="dio.intro">
    <title>Direct I/O Functions</title>
    <para>
     PHP supports the direct io functions as described in the Posix
     Standard (Section 6) for performing I/O functions at a lower
     level than the C-Language stream I/O functions (fopen, fread,..).
    </para>
   </section>
   <section id="dio.installation">
    <title>Installation</title>
    <para>
     To get these functions to work, you have to configure PHP with
     <option role="configure">--enable-dio</option>.
    </para>
   </section>
  </partintro>
 
  <refentry id="function.dio-open">
   <refnamediv>
    <refname>dio_open</refname>
    <refpurpose>
     Opens a new filename with specified permissions of flags and
     creation permissions of mode
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>resource</type><methodname>dio_open</methodname>
      <methodparam><type>string</type><parameter>filename</parameter></methodparam>
      <methodparam><type>int</type><parameter>flags</parameter></methodparam>
      <methodparam choice="opt"><type>int</type><parameter>mode</parameter></methodparam>
     </methodsynopsis>
    <para>
     <function>dio_open</function> opens a file and returns a new file
     descriptor for it, or -1 if any error occurred.  If
     <parameter>flags</parameter> is O_CREAT, 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 file already exists
       </para>
      </listitem> 
      <listitem>
       <para>
        O_TRUNC - if file exists, and its opened for write access,
        file will be truncated to zero length.
       </para>
      </listitem>
      <listitem>
       <para>
        O_APPEND - write operations write data at the
        end of file</para></listitem> <listitem><para>O_NONBLOCK -
        sets non blocking mode
       </para>
      </listitem>
     </itemizedlist>
    </para>
   </refsect1>
  </refentry>
	
  <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>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <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>
     </methodsynopsis>
    <para>
     The function <function>dio_read</function> reads and returns
     <parameter>n</parameter> bytes from file with descriptor
     <parameter>resource</parameter>. If <parameter>n</parameter> is
     not specified, <function>dio_read</function> reads 1K sized block
     and returns them.
    </para>
   </refsect1>
  </refentry>
	
  <refentry id="function.dio-write">
   <refnamediv>
    <refname>dio_write</refname>
    <refpurpose>
     Writes data to fd with optional truncation at length 
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>dio_write</methodname>
      <methodparam><type>resource</type><parameter>fd</parameter></methodparam>
      <methodparam><type>string</type><parameter>data</parameter></methodparam>
      <methodparam choice="opt"><type>int</type><parameter>len</parameter></methodparam>
     </methodsynopsis>
    <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>.
    </para>
   </refsect1>
  </refentry>
	
  <refentry id="function.dio-truncate">
   <refnamediv>
    <refname>dio_truncate</refname>
    <refpurpose>
     Truncates file descriptor fd to offset bytes 
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <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. Returns 0 on success,
     otherwise -1.
    </para>
   </refsect1>
  </refentry>
	
  <refentry id="function.dio-stat">
   <refnamediv>
    <refname>dio_stat</refname>
    <refpurpose>
     Gets stat information about the file descriptor fd
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <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:
     <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_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>
     </itemizedlist>
     On error <function>dio_stat</function> returns NULL.
    </para>
   </refsect1>
  </refentry>
	
  <refentry id="function.dio-seek">
   <refnamediv>
    <refname>dio_seek</refname>
    <refpurpose>Seeks to pos on fd from whence</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>dio_seek</methodname>
      <methodparam><type>resource</type><parameter>fd</parameter></methodparam>
      <methodparam><type>int</type><parameter>pos</parameter></methodparam>
      <methodparam><type>int</type><parameter>whence</parameter></methodparam>
     </methodsynopsis>
    <para>
     The function <function>dio_seek</function> is used to change the
     file position of the file with descriptor
     <parameter>resource</parameter>.  The parameter
     <parameter>whence</parameter> specifies how the position
     <parameter>pos</parameter> should be interpreted:
     <itemizedlist>
      <listitem>
       <para>
        SEEK_SET - 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>
    </para>
   </refsect1>
  </refentry>
	
  <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>arg</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>arg</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>arg</parameter> and returns
        them.
       </para>
      </listitem>
     </itemizedlist>
    </para>
   </refsect1>
  </refentry>
	
  <refentry id="function.dio-close">
   <refnamediv>
    <refname>dio_close</refname>
    <refpurpose>Closes the file descriptor given by fd</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <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>resource</parameter>.
    </para>
   </refsect1>
  </refentry>
	
 </reference>
 
<!-- 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:
-->