source: trunk/packages/xen-common/xen-common/tools/libaio/man/io_submit.3 @ 34

Last change on this file since 34 was 34, checked in by hartmans, 18 years ago

Add xen and xen-common

File size: 3.6 KB
Line 
1./"/* sys_io_submit:
2./" *      Queue the nr iocbs pointed to by iocbpp for processing.  Returns
3./" *      the number of iocbs queued.  May return -EINVAL if the aio_context
4./" *      specified by ctx_id is invalid, if nr is < 0, if the iocb at
5./" *      *iocbpp[0] is not properly initialized, if the operation specified
6./" *      is invalid for the file descriptor in the iocb.  May fail with
7./" *      -EFAULT if any of the data structures point to invalid data.  May
8./" *      fail with -EBADF if the file descriptor specified in the first
9./" *      iocb is invalid.  May fail with -EAGAIN if insufficient resources
10./" *      are available to queue any iocbs.  Will return 0 if nr is 0.  Will
11./" *      fail with -ENOSYS if not implemented.
12./" */
13.TH io_submit 2 2002-09-02 "Linux 2.4" "Linux AIO"
14.SH NAME
15io_submit \- Submit io requests
16.SH SYNOPSIS
17.nf
18.B #include <errno.h>
19.br
20.sp
21.B #include <libaio.h>
22.br
23.sp
24.BI "int io_submit(io_context_t " ctx ", long " nr ", struct iocb *" iocbs "[]);"
25.sp
26struct iocb {
27        void            *data;
28        unsigned        key;
29        short           aio_lio_opcode;
30        short           aio_reqprio;
31        int             aio_fildes;
32};
33.fi
34.SH DESCRIPTION
35.B io_submit
36submits
37.I nr
38iocbs for processing for a given io context ctx.
39
40The
41.IR "io_submit"
42function can be used to enqueue an arbitrary
43number of read and write requests at one time.  The requests can all be
44meant for the same file, all for different files or every solution in
45between.
46
47.IR "io_submit"
48gets the
49.IR "nr"
50requests from the array pointed to
51by
52.IR "iocbs"
53.  The operation to be performed is determined by the
54.IR "aio_lio_opcode"
55member in each element of
56.IR "iocbs"
57.  If this
58field is
59.B "IO_CMD_PREAD"
60a read operation is enqueued, similar to a call
61of
62.IR "io_prep_pread"
63for this element of the array (except that the way
64the termination is signalled is different, as we will see below).  If
65the
66.IR "aio_lio_opcode"
67member is
68.B "IO_CMD_PWRITE"
69a write operation
70is enqueued.  Otherwise the
71.IR "aio_lio_opcode"
72must be
73.B "IO_CMD_NOP"
74in which case this element of
75.IR "iocbs"
76is simply ignored.  This
77``operation'' is useful in situations where one has a fixed array of
78.IR "struct iocb"
79elements from which only a few need to be handled at
80a time.  Another situation is where the
81.IR "io_submit"
82call was
83canceled before all requests are processed  and the remaining requests have to be reissued.
84
85The other members of each element of the array pointed to by
86.IR "iocbs"
87must have values suitable for the operation as described in
88the documentation for
89.IR "io_prep_pread"
90and
91.IR "io_prep_pwrite"
92above.
93
94The function returns immediately after
95having enqueued all the requests. 
96On success,
97.B io_submit
98returns the number of iocbs submitted successfully.  Otherwise, -error is return, where
99error is one of the Exxx values defined in the Errors section.
100.PP
101If an error is detected, then the behavior is undefined.
102.PP
103Simultaneous asynchronous operations using the same iocb produce
104undefined results.
105.SH ERRORS
106.TP
107.B EFAULT
108.I iocbs
109referenced data outside of the program's accessible address space.
110.TP
111.B EINVAL
112.I ctx
113refers to an unitialized aio context, the iocb pointed to by
114.I iocbs
115contains an improperly initialized iocb,
116.TP
117.B EBADF
118The iocb contains a file descriptor that does not exist.
119.TP
120.B EINVAL
121The file specified in the iocb does not support the given io operation.
122.SH "SEE ALSO"
123.BR io(3),
124.BR io_cancel(3),
125.BR io_fsync(3),
126.BR io_getevents(3),
127.BR io_prep_fsync(3),
128.BR io_prep_pread(3),
129.BR io_prep_pwrite(3),
130.BR io_queue_init(3),
131.BR io_queue_release(3),
132.BR io_queue_run(3),
133.BR io_queue_wait(3),
134.BR io_set_callback(3),
135.BR errno(3)
Note: See TracBrowser for help on using the repository browser.