1 | @c |
---|
2 | @c COPYRIGHT (c) 1988-1998. |
---|
3 | @c On-Line Applications Research Corporation (OAR). |
---|
4 | @c All rights reserved. |
---|
5 | @c |
---|
6 | @c $Id$ |
---|
7 | @c |
---|
8 | |
---|
9 | @chapter Input and Output Primitives Manager |
---|
10 | |
---|
11 | @section Introduction |
---|
12 | |
---|
13 | The input and output primitives manager is ... |
---|
14 | |
---|
15 | The directives provided by the input and output primitives manager are: |
---|
16 | |
---|
17 | @itemize @bullet |
---|
18 | @item @code{pipe} - YYY |
---|
19 | @item @code{dup} - Duplicates an open file descriptor |
---|
20 | @item @code{dup2} - Duplicates an open file descriptor |
---|
21 | @item @code{close} - Closes a file |
---|
22 | @item @code{read} - Reads from a file |
---|
23 | @item @code{write} - Writes to a file |
---|
24 | @item @code{fcntl} - Manipulates an open file descriptor |
---|
25 | @item @code{lseek} - Reposition read/write file offset |
---|
26 | @item @code{fsync} - Synchronize a file's complete in-core state with that on disk |
---|
27 | @item @code{fdatasync} - synchronize a file's in-core data with that on disk |
---|
28 | @item @code{mount} - Mount a file system |
---|
29 | @item @code{umount} - Unmount file systems |
---|
30 | @item @code{aio_read} - YYY |
---|
31 | @item @code{aio_write} - YYY |
---|
32 | @item @code{lio_listio} - YYY |
---|
33 | @item @code{aio_error} - YYY |
---|
34 | @item @code{aio_return} - YYY |
---|
35 | @item @code{aio_cancel} - YYY |
---|
36 | @item @code{aio_suspend} - YYY |
---|
37 | @item @code{aio_fsync} - YYY |
---|
38 | @end itemize |
---|
39 | |
---|
40 | @section Background |
---|
41 | |
---|
42 | There is currently no text in this section. |
---|
43 | |
---|
44 | @section Operations |
---|
45 | |
---|
46 | There is currently no text in this section. |
---|
47 | |
---|
48 | @section Directives |
---|
49 | |
---|
50 | This section details the input and output primitives manager's directives. |
---|
51 | A subsection is dedicated to each of this manager's directives |
---|
52 | and describes the calling sequence, related constants, usage, |
---|
53 | and status codes. |
---|
54 | |
---|
55 | @page |
---|
56 | @subsection pipe - |
---|
57 | |
---|
58 | @subheading CALLING SEQUENCE: |
---|
59 | |
---|
60 | @ifset is-C |
---|
61 | @example |
---|
62 | int pipe( |
---|
63 | ); |
---|
64 | @end example |
---|
65 | @end ifset |
---|
66 | |
---|
67 | @ifset is-Ada |
---|
68 | @end ifset |
---|
69 | |
---|
70 | @subheading STATUS CODES: |
---|
71 | |
---|
72 | @table @b |
---|
73 | @item E |
---|
74 | The |
---|
75 | |
---|
76 | @end table |
---|
77 | |
---|
78 | @subheading DESCRIPTION: |
---|
79 | |
---|
80 | @subheading NOTES: |
---|
81 | |
---|
82 | This routine is not currently supported by RTEMS but could be |
---|
83 | in a future version. |
---|
84 | |
---|
85 | @page |
---|
86 | @subsection dup - Duplicates an open file descriptor |
---|
87 | |
---|
88 | @subheading CALLING SEQUENCE: |
---|
89 | |
---|
90 | @ifset is-C |
---|
91 | @example |
---|
92 | #include <unistd.h> |
---|
93 | |
---|
94 | int dup( |
---|
95 | int fildes |
---|
96 | ); |
---|
97 | @end example |
---|
98 | @end ifset |
---|
99 | |
---|
100 | @ifset is-Ada |
---|
101 | @end ifset |
---|
102 | |
---|
103 | @subheading STATUS CODES: |
---|
104 | |
---|
105 | @table @b |
---|
106 | @item EBADF |
---|
107 | Invalid file descriptor. |
---|
108 | |
---|
109 | @item EINTR |
---|
110 | Function was interrupted by a signal. |
---|
111 | |
---|
112 | @item EMFILE |
---|
113 | The process already has the maximum number of file descriptors open |
---|
114 | and tried to open a new one. |
---|
115 | @end table |
---|
116 | |
---|
117 | @subheading DESCRIPTION: |
---|
118 | |
---|
119 | The @code{dup} function returns the lowest numbered available file |
---|
120 | descriptor. This new desciptor refers to the same open file as the |
---|
121 | original descriptor and shares any locks. |
---|
122 | |
---|
123 | @subheading NOTES: |
---|
124 | |
---|
125 | NONE |
---|
126 | |
---|
127 | @page |
---|
128 | @subsection dup2 - Duplicates an open file descriptor |
---|
129 | |
---|
130 | @subheading CALLING SEQUENCE: |
---|
131 | |
---|
132 | @ifset is-C |
---|
133 | @example |
---|
134 | #include <unistd.h> |
---|
135 | |
---|
136 | int dup2( |
---|
137 | int fildes, |
---|
138 | int fildes2 |
---|
139 | ); |
---|
140 | @end example |
---|
141 | @end ifset |
---|
142 | |
---|
143 | @ifset is-Ada |
---|
144 | @end ifset |
---|
145 | |
---|
146 | @subheading STATUS CODES: |
---|
147 | |
---|
148 | @table @b |
---|
149 | @item EBADF |
---|
150 | Invalid file descriptor. |
---|
151 | |
---|
152 | @item EINTR |
---|
153 | Function was interrupted by a signal. |
---|
154 | |
---|
155 | @item EMFILE |
---|
156 | The process already has the maximum number of file descriptors open |
---|
157 | and tried to open a new one. |
---|
158 | @end table |
---|
159 | |
---|
160 | @subheading DESCRIPTION: |
---|
161 | |
---|
162 | @code{Dup2} creates a copy of the file descriptor @code{oldfd}. |
---|
163 | |
---|
164 | The old and new descriptors may be used interchangeably. They share locks, file |
---|
165 | position pointers and flags; for example, if the file position is modified by using |
---|
166 | @code{lseek} on one of the descriptors, the position is also changed for the other. |
---|
167 | |
---|
168 | @subheading NOTES: |
---|
169 | |
---|
170 | NONE |
---|
171 | |
---|
172 | @page |
---|
173 | @subsection close - Closes a file. |
---|
174 | |
---|
175 | @subheading CALLING SEQUENCE: |
---|
176 | |
---|
177 | @ifset is-C |
---|
178 | @example |
---|
179 | #include <unistd.h> |
---|
180 | |
---|
181 | int close( |
---|
182 | int fildes |
---|
183 | ); |
---|
184 | @end example |
---|
185 | @end ifset |
---|
186 | |
---|
187 | @ifset is-Ada |
---|
188 | @end ifset |
---|
189 | |
---|
190 | @subheading STATUS CODES: |
---|
191 | |
---|
192 | @table @b |
---|
193 | @item EBADF |
---|
194 | Invalid file descriptor |
---|
195 | |
---|
196 | @item EINTR |
---|
197 | Function was interrupted by a signal. |
---|
198 | @end table |
---|
199 | |
---|
200 | @subheading DESCRIPTION: |
---|
201 | |
---|
202 | The @code{close()} function deallocates the file descriptor named by |
---|
203 | @code{fildes} and makes it available for reuse. All outstanding |
---|
204 | record locks owned by this process for the file are unlocked. |
---|
205 | |
---|
206 | @subheading NOTES: |
---|
207 | |
---|
208 | A signal can interrupt the @code{close()} function. In that case, |
---|
209 | @code{close()} returns -1 with @code{errno} set to EINTR. The file |
---|
210 | may or may not be closed. |
---|
211 | |
---|
212 | @page |
---|
213 | @subsection read - Reads from a file. |
---|
214 | |
---|
215 | @subheading CALLING SEQUENCE: |
---|
216 | |
---|
217 | @ifset is-C |
---|
218 | @example |
---|
219 | #include <unistd.h> |
---|
220 | |
---|
221 | int read( |
---|
222 | int fildes, |
---|
223 | void *buf, |
---|
224 | unsigned int nbyte |
---|
225 | ); |
---|
226 | @end example |
---|
227 | @end ifset |
---|
228 | |
---|
229 | @ifset is-Ada |
---|
230 | @end ifset |
---|
231 | |
---|
232 | @subheading STATUS CODES: |
---|
233 | |
---|
234 | On error, this routine returns -1 and sets @code{errno} to one of |
---|
235 | the following: |
---|
236 | |
---|
237 | @table @b |
---|
238 | @item EAGAIN |
---|
239 | The O_NONBLOCK flag is set for a file descriptor and the process |
---|
240 | would be delayed in the I/O operation. |
---|
241 | |
---|
242 | @item EBADF |
---|
243 | Invalid file descriptor |
---|
244 | |
---|
245 | @item EINTR |
---|
246 | Function was interrupted by a signal. |
---|
247 | |
---|
248 | @item EIO |
---|
249 | Input or output error |
---|
250 | |
---|
251 | @end table |
---|
252 | |
---|
253 | @subheading DESCRIPTION: |
---|
254 | |
---|
255 | The @code{read()} function reads @code{nbyte} bytes from the file |
---|
256 | associated with @code{fildes} into the buffer pointed to by @code{buf}. |
---|
257 | |
---|
258 | The @code{read()} function returns the number of bytes actually read |
---|
259 | and placed in the buffer. This will be less than @code{nbyte} if: |
---|
260 | |
---|
261 | @itemize @bullet |
---|
262 | |
---|
263 | @item The number of bytes left in the file is less than @code{nbyte}. |
---|
264 | |
---|
265 | @item The @code{read()} request was interrupted by a signal. |
---|
266 | |
---|
267 | @item The file is a pipe or FIFO or special file with less than @code{nbytes} |
---|
268 | immediately available for reading. |
---|
269 | |
---|
270 | @end itemize |
---|
271 | |
---|
272 | When attempting to read from any empty pipe or FIFO: |
---|
273 | |
---|
274 | |
---|
275 | @itemize @bullet |
---|
276 | |
---|
277 | @item If no process has the pipe open for writing, zero is returned to |
---|
278 | indicate end-of-file. |
---|
279 | |
---|
280 | @item If some process has the pipe open for writing and O_NONBLOCK is set, |
---|
281 | -1 is returned and @code{errno} is set to EAGAIN. |
---|
282 | |
---|
283 | @item If some process has the pipe open for writing and O_NONBLOCK is clear, |
---|
284 | @code{read()} waits for some data to be written or the pipe to be closed. |
---|
285 | |
---|
286 | @end itemize |
---|
287 | |
---|
288 | |
---|
289 | When attempting to read from a file other than a pipe or FIFO and no data |
---|
290 | is available. |
---|
291 | |
---|
292 | @itemize @bullet |
---|
293 | |
---|
294 | @item If O_NONBLOCK is set, -1 is returned and @code{errno} is set to EAGAIN. |
---|
295 | |
---|
296 | @item If O_NONBLOCK is clear, @code{read()} waits for some data to become |
---|
297 | available. |
---|
298 | |
---|
299 | @item The O_NONBLOCK flag is ignored if data is available. |
---|
300 | |
---|
301 | @end itemize |
---|
302 | |
---|
303 | @subheading NOTES: |
---|
304 | |
---|
305 | NONE |
---|
306 | |
---|
307 | @page |
---|
308 | @subsection write - Writes to a file |
---|
309 | |
---|
310 | @subheading CALLING SEQUENCE: |
---|
311 | |
---|
312 | @ifset is-C |
---|
313 | @example |
---|
314 | #include <unistd.h> |
---|
315 | |
---|
316 | int write( |
---|
317 | int fildes, |
---|
318 | const void *buf, |
---|
319 | unsigned int nbytes |
---|
320 | ); |
---|
321 | @end example |
---|
322 | @end ifset |
---|
323 | |
---|
324 | @ifset is-Ada |
---|
325 | @end ifset |
---|
326 | |
---|
327 | @subheading STATUS CODES: |
---|
328 | |
---|
329 | @table @b |
---|
330 | @item EAGAIN |
---|
331 | The O_NONBLOCK flag is set for a file descriptor and the process |
---|
332 | would be delayed in the I/O operation. |
---|
333 | |
---|
334 | @item EBADF |
---|
335 | Invalid file descriptor |
---|
336 | |
---|
337 | @item EFBIG |
---|
338 | An attempt was made to write to a file that exceeds the maximum file |
---|
339 | size |
---|
340 | |
---|
341 | @item EINTR |
---|
342 | The function was interrupted by a signal. |
---|
343 | |
---|
344 | @item EIO |
---|
345 | Input or output error. |
---|
346 | |
---|
347 | @item ENOSPC |
---|
348 | No space left on disk. |
---|
349 | |
---|
350 | @item EPIPE |
---|
351 | Attempt to write to a pope or FIFO with no reader. |
---|
352 | |
---|
353 | @end table |
---|
354 | |
---|
355 | @subheading DESCRIPTION: |
---|
356 | |
---|
357 | The @code{write()} function writes @code{nbyte} from the array pointed |
---|
358 | to by @code{buf} into the file associated with @code{fildes}. |
---|
359 | |
---|
360 | If @code{nybte} is zero and the file is a regular file, the @code{write()} |
---|
361 | function returns zero and has no other effect. If @code{nbyte} is zero |
---|
362 | and the file is a special file, te results are not portable. |
---|
363 | |
---|
364 | The @code{write()} function returns the number of bytes written. This |
---|
365 | number will be less than @code{nbytes} if there is an error. It will never |
---|
366 | be greater than @code{nbytes}. |
---|
367 | |
---|
368 | @subheading NOTES: |
---|
369 | |
---|
370 | NONE |
---|
371 | |
---|
372 | @page |
---|
373 | @subsection fcntl - Manipulates an open file descriptor |
---|
374 | |
---|
375 | @subheading CALLING SEQUENCE: |
---|
376 | |
---|
377 | @ifset is-C |
---|
378 | @example |
---|
379 | #include <sys/types.h> |
---|
380 | #include <fcntl.h> |
---|
381 | #include <unistd.h> |
---|
382 | |
---|
383 | int fcntl( |
---|
384 | int fildes, |
---|
385 | int cmd |
---|
386 | ); |
---|
387 | @end example |
---|
388 | @end ifset |
---|
389 | |
---|
390 | @ifset is-Ada |
---|
391 | @end ifset |
---|
392 | |
---|
393 | @subheading STATUS CODES: |
---|
394 | |
---|
395 | @table @b |
---|
396 | @item EACCESS |
---|
397 | Search permission is denied for a direcotry in a file's path |
---|
398 | prefix. |
---|
399 | |
---|
400 | @item EAGAIN |
---|
401 | The O_NONBLOCK flag is set for a file descriptor and the process |
---|
402 | would be delayed in the I/O operation. |
---|
403 | |
---|
404 | @item EBADF |
---|
405 | Invalid file descriptor |
---|
406 | |
---|
407 | @item EDEADLK |
---|
408 | An @code{fcntl} with function F_SETLKW would cause a deadlock. |
---|
409 | |
---|
410 | @item EINTR |
---|
411 | The functioin was interrupted by a signal. |
---|
412 | |
---|
413 | @item EINVAL |
---|
414 | Invalid argument |
---|
415 | |
---|
416 | @item EMFILE |
---|
417 | Too many file descriptor or in use by the process. |
---|
418 | |
---|
419 | @item ENOLCK |
---|
420 | No locks available |
---|
421 | |
---|
422 | @end table |
---|
423 | |
---|
424 | @subheading DESCRIPTION: |
---|
425 | |
---|
426 | @code{fcntl()} performs one of various miscellaneous operations on |
---|
427 | @code{fd}. The operation in question is determined by @code{cmd}: |
---|
428 | |
---|
429 | @table @b |
---|
430 | |
---|
431 | @item F_DUPFD |
---|
432 | Makes @code{arg} be a copy of @code{fd}, closing @code{fd} first if necessary. |
---|
433 | |
---|
434 | The same functionality can be more easily achieved by using @code{dup2()}. |
---|
435 | |
---|
436 | The old and new descriptors may be used interchangeably. They share locks, |
---|
437 | file position pointers and flags; for example, if the file position is |
---|
438 | modified by using @code{lseek()} on one of the descriptors, the position is |
---|
439 | also changed for the other. |
---|
440 | |
---|
441 | The two descriptors do not share the close-on-exec flag, however. The |
---|
442 | close-on-exec flag of the copy is off, meaning that it will be closed on |
---|
443 | exec. |
---|
444 | |
---|
445 | On success, the new descriptor is returned. |
---|
446 | |
---|
447 | @item F_GETFD |
---|
448 | Read the close-on-exec flag. If the low-order bit is 0, the file will |
---|
449 | remain open across exec, otherwise it will be closed. |
---|
450 | |
---|
451 | @item F_SETFD |
---|
452 | Set the close-on-exec flag to the value specified by @code{arg} (only the least |
---|
453 | significant bit is used). |
---|
454 | |
---|
455 | @item F_GETFL |
---|
456 | Read the descriptor's flags (all flags (as set by open()) are returned). |
---|
457 | |
---|
458 | @item F_SETFL |
---|
459 | Set the descriptor's flags to the value specified by @code{arg}. Only |
---|
460 | @code{O_APPEND} and @code{O_NONBLOCK} may be set. |
---|
461 | |
---|
462 | The flags are shared between copies (made with @code{dup()} etc.) of the same |
---|
463 | file descriptor. |
---|
464 | |
---|
465 | The flags and their semantics are described in @code{open()}. |
---|
466 | |
---|
467 | @item F_GETLK, F_SETLK and F_SETLKW |
---|
468 | Manage discretionary file locks. The third argument @code{arg} is a pointer to a |
---|
469 | struct flock (that may be overwritten by this call). |
---|
470 | |
---|
471 | @item F_GETLK |
---|
472 | Return the flock structure that prevents us from obtaining the lock, or set the |
---|
473 | @code{l_type} field of the lock to @code{F_UNLCK} if there is no obstruction. |
---|
474 | |
---|
475 | @item F_SETLK |
---|
476 | The lock is set (when @code{l_type} is @code{F_RDLCK} or @code{F_WRLCK}) or |
---|
477 | cleared (when it is @code{F_UNLCK}. If lock is held by someone else, this |
---|
478 | call returns -1 and sets @code{errno} to EACCES or EAGAIN. |
---|
479 | |
---|
480 | @item F_SETLKW |
---|
481 | Like @code{F_SETLK}, but instead of returning an error we wait for the lock to |
---|
482 | be released. |
---|
483 | |
---|
484 | @item F_GETOWN |
---|
485 | Get the process ID (or process group) of the owner of a socket. |
---|
486 | |
---|
487 | Process groups are returned as negative values. |
---|
488 | |
---|
489 | @item F_SETOWN |
---|
490 | Set the process or process group that owns a socket. |
---|
491 | |
---|
492 | For these commands, ownership means receiving @code{SIGIO} or @code{SIGURG} |
---|
493 | signals. |
---|
494 | |
---|
495 | Process groups are specified using negative values. |
---|
496 | |
---|
497 | @end table |
---|
498 | |
---|
499 | @subheading NOTES: |
---|
500 | |
---|
501 | The errors returned by @code{dup2} are different from those returned by |
---|
502 | @code{F_DUPFD}. |
---|
503 | |
---|
504 | @page |
---|
505 | @subsection lseek - Reposition read/write file offset |
---|
506 | |
---|
507 | @subheading CALLING SEQUENCE: |
---|
508 | |
---|
509 | @ifset is-C |
---|
510 | @example |
---|
511 | #include <sys/types.h> |
---|
512 | #include <unistd.h> |
---|
513 | |
---|
514 | int lseek( |
---|
515 | int fildes, |
---|
516 | off_t offset, |
---|
517 | int whence |
---|
518 | ); |
---|
519 | @end example |
---|
520 | @end ifset |
---|
521 | |
---|
522 | @ifset is-Ada |
---|
523 | @end ifset |
---|
524 | |
---|
525 | @subheading STATUS CODES: |
---|
526 | |
---|
527 | @table @b |
---|
528 | @item EBADF |
---|
529 | @code{Fildes} is not an open file descriptor. |
---|
530 | |
---|
531 | @item ESPIPE |
---|
532 | @code{Fildes} is associated with a pipe, socket or FIFO. |
---|
533 | |
---|
534 | @item EINVAL |
---|
535 | @code{Whence} is not a proper value. |
---|
536 | |
---|
537 | @end table |
---|
538 | |
---|
539 | @subheading DESCRIPTION: |
---|
540 | |
---|
541 | The @code{lseek} function repositions the offset of the file descriptor |
---|
542 | @code{fildes} to the argument offset according to the directive whence. |
---|
543 | The argument @code{fildes} must be an open file descriptor. @code{Lseek} |
---|
544 | repositions the file pointer fildes as follows: |
---|
545 | |
---|
546 | @itemize @bullet |
---|
547 | |
---|
548 | @item |
---|
549 | If @code{whence} is SEEK_SET, the offset is set to @code{offset} bytes. |
---|
550 | |
---|
551 | @item |
---|
552 | If @code{whence} is SEEK_CUR, the offset is set to its current location |
---|
553 | plus offset bytes. |
---|
554 | |
---|
555 | @item |
---|
556 | If @code{whence} is SEEK_END, the offset is set to the size of the |
---|
557 | file plus @code{offset} bytes. |
---|
558 | |
---|
559 | @end itemize |
---|
560 | |
---|
561 | The @code{lseek} function allows the file offset to be set beyond the end |
---|
562 | of the existing end-of-file of the file. If data is later written at this |
---|
563 | point, subsequent reads of the data in the gap return bytes of zeros |
---|
564 | (until data is actually written into the gap). |
---|
565 | |
---|
566 | Some devices are incapable of seeking. The value of the pointer associated |
---|
567 | with such a device is undefined. |
---|
568 | |
---|
569 | @subheading NOTES: |
---|
570 | |
---|
571 | NONE |
---|
572 | |
---|
573 | @page |
---|
574 | @subsection fsync - Synchronize a file's complete in-core state with that on disk |
---|
575 | |
---|
576 | @subheading CALLING SEQUENCE: |
---|
577 | |
---|
578 | @ifset is-C |
---|
579 | @example |
---|
580 | int fsync( |
---|
581 | int fd |
---|
582 | ); |
---|
583 | @end example |
---|
584 | @end ifset |
---|
585 | |
---|
586 | @ifset is-Ada |
---|
587 | @end ifset |
---|
588 | |
---|
589 | @subheading STATUS CODES: |
---|
590 | |
---|
591 | On success, zero is returned. On error, -1 is returned, and @code{errno} |
---|
592 | is set appropriately. |
---|
593 | |
---|
594 | @table @b |
---|
595 | @item EBADF |
---|
596 | @code{fd} is not a valid descriptor open for writing |
---|
597 | |
---|
598 | @item EINVAL |
---|
599 | @code{fd} is bound to a special file which does not support support synchronization |
---|
600 | |
---|
601 | @item EROFS |
---|
602 | @code{fd} is bound to a special file which does not support support synchronization |
---|
603 | |
---|
604 | @item EIO |
---|
605 | An error occurred during synchronization |
---|
606 | |
---|
607 | @end table |
---|
608 | |
---|
609 | @subheading DESCRIPTION: |
---|
610 | |
---|
611 | @code{fsync} copies all in-core parts of a file to disk. |
---|
612 | |
---|
613 | @subheading NOTES: |
---|
614 | |
---|
615 | NONE |
---|
616 | |
---|
617 | @page |
---|
618 | @subsection fdatasync - synchronize a file's in-core data with that on disk. |
---|
619 | |
---|
620 | @subheading CALLING SEQUENCE: |
---|
621 | |
---|
622 | @ifset is-C |
---|
623 | @example |
---|
624 | int fdatasync( |
---|
625 | int fd |
---|
626 | ); |
---|
627 | @end example |
---|
628 | @end ifset |
---|
629 | |
---|
630 | @ifset is-Ada |
---|
631 | @end ifset |
---|
632 | |
---|
633 | @subheading STATUS CODES: |
---|
634 | |
---|
635 | On success, zero is returned. On error, -1 is returned, and @code{errno} is |
---|
636 | set appropriately. |
---|
637 | |
---|
638 | @table @b |
---|
639 | @item EBADF |
---|
640 | @code{fd} is not a valid file descriptor open for writing. |
---|
641 | |
---|
642 | @item EINVAL |
---|
643 | @code{fd} is bound to a special file which does not support synchronization. |
---|
644 | |
---|
645 | @item EIO |
---|
646 | An error occurred during synchronization. |
---|
647 | |
---|
648 | @item EROFS |
---|
649 | @code{fd} is bound to a special file which dows not support synchronization. |
---|
650 | |
---|
651 | @end table |
---|
652 | |
---|
653 | @subheading DESCRIPTION: |
---|
654 | |
---|
655 | @code{fdatasync} flushes all data buffers of a file to disk (before the system call |
---|
656 | returns). It resembles @code{fsync} but is not required to update the metadata such |
---|
657 | as access time. |
---|
658 | |
---|
659 | Applications that access databases or log files often write a tiny data fragment |
---|
660 | (e.g., one line in a log file) and then call @code{fsync} immediately in order to |
---|
661 | ensure that the written data is physically stored on the harddisk. Unfortunately, |
---|
662 | fsync will always initiate two write operations: one for the newly written data and |
---|
663 | another one in order to update the modification time stored in the inode. If the |
---|
664 | modification time is not a part of the transaction concept @code{fdatasync} can be |
---|
665 | used to avoid unnecessary inode disk write operations. |
---|
666 | |
---|
667 | @subheading NOTES: |
---|
668 | |
---|
669 | NONE |
---|
670 | |
---|
671 | @page |
---|
672 | @subsection mount - Mount a file system |
---|
673 | |
---|
674 | @subheading CALLING SEQUENCE: |
---|
675 | |
---|
676 | @ifset is-C |
---|
677 | @example |
---|
678 | #include <sys/mount.h> |
---|
679 | #include <linux/fs.h> |
---|
680 | |
---|
681 | int mount( |
---|
682 | const char *specialfile, |
---|
683 | const char * dir, |
---|
684 | const char * filesystemtype, |
---|
685 | unsigned long rwflag, |
---|
686 | const void * data |
---|
687 | ); |
---|
688 | @end example |
---|
689 | @end ifset |
---|
690 | |
---|
691 | @ifset is-Ada |
---|
692 | @end ifset |
---|
693 | |
---|
694 | @subheading STATUS CODES: |
---|
695 | |
---|
696 | @table @b |
---|
697 | @item EPERM |
---|
698 | The user is not the super-user. |
---|
699 | |
---|
700 | @item ENODEV |
---|
701 | @code{filesystemtype} not configured in the kernel. |
---|
702 | |
---|
703 | @item ENOTBLK |
---|
704 | @code{specialfile} is not a block device (if a device was required). |
---|
705 | |
---|
706 | @item EBUSY |
---|
707 | @code{specialfile} is already mounted. Or, it cannot be remounted |
---|
708 | read-only, because it still holds files open for writing. Or, it |
---|
709 | cannot be mounted on @code{dir} because @code{dir} is still busy |
---|
710 | (it is the working directory of some task, the mount point of another |
---|
711 | device, has open files, etc.). |
---|
712 | |
---|
713 | @item EINVAL |
---|
714 | @code{specialfile} had an invalid superblock. Or, a remount was |
---|
715 | attempted, while @code{specialfile} was not already mounted on @code{dir}. |
---|
716 | Or, an umount was attempted, while @code{dir} was not a mount point. |
---|
717 | |
---|
718 | @item EFAULT |
---|
719 | One of the pointer arguments points outside the user address space. |
---|
720 | |
---|
721 | @item ENOMEM |
---|
722 | The kernel could not allocate a free page to copy filenames or data into. |
---|
723 | |
---|
724 | @item ENAMETOOLONG |
---|
725 | A pathname was longer than MAXPATHLEN. |
---|
726 | |
---|
727 | @item ENOTDIR |
---|
728 | A pathname was empty or had a nonexistent component. |
---|
729 | |
---|
730 | @item EACCES |
---|
731 | A component of a path was not searchable. Or, mounting a read-only |
---|
732 | filesystem was attempted without giving the MS_RDONLY flag. Or, the |
---|
733 | block device @code{specialfile} is located on a filesystem mounted with |
---|
734 | the MS_NODEV option. |
---|
735 | |
---|
736 | @item ENXIO |
---|
737 | The major number of the block device @code{specialfile} is out of |
---|
738 | range. |
---|
739 | |
---|
740 | @item EMFILE |
---|
741 | (In case no block device is required:) Table of dummy devices is full. |
---|
742 | |
---|
743 | @end table |
---|
744 | |
---|
745 | @subheading DESCRIPTION: |
---|
746 | |
---|
747 | @code{Mount} attaches the filesystem specified by @code{specialfile} |
---|
748 | (which is often a device name) to the directory specified by @code{dir}. |
---|
749 | |
---|
750 | Only the super-user may mount filesystems. |
---|
751 | |
---|
752 | The @code{filesystemtype} argument may take one of the values listed in |
---|
753 | /proc/filesystems (link "minix", "ext2", "msdos", "proc", "nfs", |
---|
754 | "iso9660" etc.). |
---|
755 | |
---|
756 | The @code{rwflag} argument has the magic number 0xCOED in the top 16 bits, |
---|
757 | and various mount flags in the low order 16 bits. If the magic number is |
---|
758 | absent, then the last two arguments are not used. |
---|
759 | |
---|
760 | The @code{data} argument is interpreted by the different file systems. |
---|
761 | |
---|
762 | @subheading NOTES: |
---|
763 | |
---|
764 | NONE |
---|
765 | |
---|
766 | @page |
---|
767 | @subsection umount - Umount file systems |
---|
768 | |
---|
769 | @subheading CALLING SEQUENCE: |
---|
770 | |
---|
771 | @ifset is-C |
---|
772 | @example |
---|
773 | #include <sys/mount.h> |
---|
774 | #include <linux/fs.h> |
---|
775 | |
---|
776 | int umount( |
---|
777 | const char *specialfile |
---|
778 | ); |
---|
779 | @end example |
---|
780 | @end ifset |
---|
781 | |
---|
782 | @ifset is-Ada |
---|
783 | @end ifset |
---|
784 | |
---|
785 | @subheading STATUS CODES: |
---|
786 | |
---|
787 | @table @b |
---|
788 | @item EPERM |
---|
789 | The user is not the super-user. |
---|
790 | |
---|
791 | @item ENODEV |
---|
792 | @code{Filesystemtype} not configured in the kernel. |
---|
793 | |
---|
794 | @item ENOTBLK |
---|
795 | @code{Specialfile} is not a block device (if a device was required). |
---|
796 | |
---|
797 | @item EBUSY |
---|
798 | @code{Specialfile} is already mounted. Or, it cannot be remounted |
---|
799 | read-only, because it still holds files open for writing. Or, it |
---|
800 | cannot be mounted on @code{dir} because @code{dir} is still busy |
---|
801 | (it is the working directory of some task, the mount point of another |
---|
802 | device, has open files, etc.). |
---|
803 | |
---|
804 | @item EINVAL |
---|
805 | @code{specialfile} had an invalid superblock. Or, a remount was |
---|
806 | attempted, while @code{specialfile} was not already mounted on @code{dir}. |
---|
807 | Or, an umount was attempted, while @code{dir} was not a mount point. |
---|
808 | |
---|
809 | @item EFAULT |
---|
810 | One of the pointer arguments points outside the user address space. |
---|
811 | |
---|
812 | @item ENOMEM |
---|
813 | The kernel could not allocate a free page to copy filenames or data into. |
---|
814 | |
---|
815 | @item ENAMETOOLONG |
---|
816 | A pathname was longer than MAXPATHLEN. |
---|
817 | |
---|
818 | @item ENOTDIR |
---|
819 | A pathname was empty or had a nonexistent component. |
---|
820 | |
---|
821 | @item EACCES |
---|
822 | A component of a path was not searchable. Or, mounting a read-only |
---|
823 | filesystem was attempted without giving the MS_RDONLY flag. Or, the |
---|
824 | block device @code{specialfile} is located on a filesystem mounted with |
---|
825 | the MS_NODEV option. |
---|
826 | |
---|
827 | @item ENXIO |
---|
828 | The major number of the block device @code{specialfile} is out of |
---|
829 | range. |
---|
830 | |
---|
831 | @item EMFILE |
---|
832 | (In case no block device is required:) Table of dummy devices is full. |
---|
833 | |
---|
834 | @end table |
---|
835 | |
---|
836 | @subheading DESCRIPTION: |
---|
837 | |
---|
838 | @code{Umount} removes the attachment of the filesystem specified |
---|
839 | by @code{specialfile} or @code{dir}. |
---|
840 | |
---|
841 | Only the super-user may umount filesystems. |
---|
842 | |
---|
843 | @subheading NOTES: |
---|
844 | |
---|
845 | NONE |
---|
846 | |
---|
847 | @page |
---|
848 | @subsection aio_read - |
---|
849 | |
---|
850 | @subheading CALLING SEQUENCE: |
---|
851 | |
---|
852 | @ifset is-C |
---|
853 | @example |
---|
854 | int aio_read( |
---|
855 | ); |
---|
856 | @end example |
---|
857 | @end ifset |
---|
858 | |
---|
859 | @ifset is-Ada |
---|
860 | @end ifset |
---|
861 | |
---|
862 | @subheading STATUS CODES: |
---|
863 | |
---|
864 | @table @b |
---|
865 | @item E |
---|
866 | The |
---|
867 | |
---|
868 | @end table |
---|
869 | |
---|
870 | @subheading DESCRIPTION: |
---|
871 | |
---|
872 | @subheading NOTES: |
---|
873 | |
---|
874 | This routine is not currently supported by RTEMS but could be |
---|
875 | in a future version. |
---|
876 | |
---|
877 | @page |
---|
878 | @subsection aio_write - |
---|
879 | |
---|
880 | @subheading CALLING SEQUENCE: |
---|
881 | |
---|
882 | @ifset is-C |
---|
883 | @example |
---|
884 | int aio_write( |
---|
885 | ); |
---|
886 | @end example |
---|
887 | @end ifset |
---|
888 | |
---|
889 | @ifset is-Ada |
---|
890 | @end ifset |
---|
891 | |
---|
892 | @subheading STATUS CODES: |
---|
893 | |
---|
894 | @table @b |
---|
895 | @item E |
---|
896 | The |
---|
897 | |
---|
898 | @end table |
---|
899 | |
---|
900 | @subheading DESCRIPTION: |
---|
901 | |
---|
902 | @subheading NOTES: |
---|
903 | |
---|
904 | This routine is not currently supported by RTEMS but could be |
---|
905 | in a future version. |
---|
906 | |
---|
907 | @page |
---|
908 | @subsection lio_listio - |
---|
909 | |
---|
910 | @subheading CALLING SEQUENCE: |
---|
911 | |
---|
912 | @ifset is-C |
---|
913 | @example |
---|
914 | int lio_listio( |
---|
915 | ); |
---|
916 | @end example |
---|
917 | @end ifset |
---|
918 | |
---|
919 | @ifset is-Ada |
---|
920 | @end ifset |
---|
921 | |
---|
922 | @subheading STATUS CODES: |
---|
923 | |
---|
924 | @table @b |
---|
925 | @item E |
---|
926 | The |
---|
927 | |
---|
928 | @end table |
---|
929 | |
---|
930 | @subheading DESCRIPTION: |
---|
931 | |
---|
932 | @subheading NOTES: |
---|
933 | |
---|
934 | This routine is not currently supported by RTEMS but could be |
---|
935 | in a future version. |
---|
936 | |
---|
937 | @page |
---|
938 | @subsection aio_error - |
---|
939 | |
---|
940 | @subheading CALLING SEQUENCE: |
---|
941 | |
---|
942 | @ifset is-C |
---|
943 | @example |
---|
944 | int aio_error( |
---|
945 | ); |
---|
946 | @end example |
---|
947 | @end ifset |
---|
948 | |
---|
949 | @ifset is-Ada |
---|
950 | @end ifset |
---|
951 | |
---|
952 | @subheading STATUS CODES: |
---|
953 | |
---|
954 | @table @b |
---|
955 | @item E |
---|
956 | The |
---|
957 | |
---|
958 | @end table |
---|
959 | |
---|
960 | @subheading DESCRIPTION: |
---|
961 | |
---|
962 | @subheading NOTES: |
---|
963 | |
---|
964 | This routine is not currently supported by RTEMS but could be |
---|
965 | in a future version. |
---|
966 | |
---|
967 | @page |
---|
968 | @subsection aio_return - |
---|
969 | |
---|
970 | @subheading CALLING SEQUENCE: |
---|
971 | |
---|
972 | @ifset is-C |
---|
973 | @example |
---|
974 | int aio_return( |
---|
975 | ); |
---|
976 | @end example |
---|
977 | @end ifset |
---|
978 | |
---|
979 | @ifset is-Ada |
---|
980 | @end ifset |
---|
981 | |
---|
982 | @subheading STATUS CODES: |
---|
983 | |
---|
984 | @table @b |
---|
985 | @item E |
---|
986 | The |
---|
987 | |
---|
988 | @end table |
---|
989 | |
---|
990 | @subheading DESCRIPTION: |
---|
991 | |
---|
992 | @subheading NOTES: |
---|
993 | |
---|
994 | This routine is not currently supported by RTEMS but could be |
---|
995 | in a future version. |
---|
996 | |
---|
997 | @page |
---|
998 | @subsection aio_cancel - |
---|
999 | |
---|
1000 | @subheading CALLING SEQUENCE: |
---|
1001 | |
---|
1002 | @ifset is-C |
---|
1003 | @example |
---|
1004 | int aio_cancel( |
---|
1005 | ); |
---|
1006 | @end example |
---|
1007 | @end ifset |
---|
1008 | |
---|
1009 | @ifset is-Ada |
---|
1010 | @end ifset |
---|
1011 | |
---|
1012 | @subheading STATUS CODES: |
---|
1013 | |
---|
1014 | @table @b |
---|
1015 | @item E |
---|
1016 | The |
---|
1017 | |
---|
1018 | @end table |
---|
1019 | |
---|
1020 | @subheading DESCRIPTION: |
---|
1021 | |
---|
1022 | @subheading NOTES: |
---|
1023 | |
---|
1024 | This routine is not currently supported by RTEMS but could be |
---|
1025 | in a future version. |
---|
1026 | |
---|
1027 | @page |
---|
1028 | @subsection aio_suspend - |
---|
1029 | |
---|
1030 | @subheading CALLING SEQUENCE: |
---|
1031 | |
---|
1032 | @ifset is-C |
---|
1033 | @example |
---|
1034 | int aio_suspend( |
---|
1035 | ); |
---|
1036 | @end example |
---|
1037 | @end ifset |
---|
1038 | |
---|
1039 | @ifset is-Ada |
---|
1040 | @end ifset |
---|
1041 | |
---|
1042 | @subheading STATUS CODES: |
---|
1043 | |
---|
1044 | @table @b |
---|
1045 | @item E |
---|
1046 | The |
---|
1047 | |
---|
1048 | @end table |
---|
1049 | |
---|
1050 | @subheading DESCRIPTION: |
---|
1051 | |
---|
1052 | @subheading NOTES: |
---|
1053 | |
---|
1054 | This routine is not currently supported by RTEMS but could be |
---|
1055 | in a future version. |
---|
1056 | |
---|
1057 | @page |
---|
1058 | @subsection aio_fsync - |
---|
1059 | |
---|
1060 | @subheading CALLING SEQUENCE: |
---|
1061 | |
---|
1062 | @ifset is-C |
---|
1063 | @example |
---|
1064 | int aio_fsync( |
---|
1065 | ); |
---|
1066 | @end example |
---|
1067 | @end ifset |
---|
1068 | |
---|
1069 | @ifset is-Ada |
---|
1070 | @end ifset |
---|
1071 | |
---|
1072 | @subheading STATUS CODES: |
---|
1073 | |
---|
1074 | @table @b |
---|
1075 | @item E |
---|
1076 | The |
---|
1077 | |
---|
1078 | @end table |
---|
1079 | |
---|
1080 | @subheading DESCRIPTION: |
---|
1081 | |
---|
1082 | @subheading NOTES: |
---|
1083 | |
---|
1084 | This routine is not currently supported by RTEMS but could be |
---|
1085 | in a future version. |
---|