RTEMS  5.0.0
aio.h
Go to the documentation of this file.
1 
10 /*
11  * COPYRIGHT (c) 1989-2011.
12  * On-Line Applications Research Corporation (OAR).
13  *
14  * The license and distribution terms for this file may be
15  * found in the file LICENSE in this distribution or at
16  * http://www.rtems.org/license/LICENSE.
17  */
18 
19 #ifndef _AIO_H
20 #define _AIO_H
21 
22 #include <sys/cdefs.h>
23 #include <unistd.h>
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
39 #if defined(_POSIX_ASYNCHRONOUS_IO)
40 
41 /*
42  * 6.7.1 Data Definitions for Asynchronous Input and Output,
43  * P1003.1b-1993, p. 151
44  */
45 
46 #include <sys/types.h>
47 #include <signal.h>
48 #include <time.h>
49 #include <fcntl.h>
50 
51 /*
52  * 6.7.1.2 Manifest Constants, P1003.1b-1993, p. 153
53  */
54 
55 #define AIO_CANCELED 0 /* all requested operations have been canceled */
56 #define AIO_NOTCANCELED 1 /* some of the operations could not be canceled */
57  /* since they are in progress */
58 #define AIO_ALLDONE 2 /* none of the requested operations could be */
59  /* canceled since they are already complete */
60 
61 /* lio_listio() options */
62 
63 /*
64  * LIO modes
65  */
66 #define LIO_WAIT 0 /* calling process is to suspend until the */
67  /* operation is complete */
68 #define LIO_NOWAIT 1 /* calling process is to continue execution while */
69  /* the operation is performed and no notification */
70  /* shall be given when the operation is completed */
71 
72 /*
73  * LIO opcodes
74  */
75 #define LIO_NOP 0 /* no transfer is requested */
76 #define LIO_READ 1 /* request a read() */
77 #define LIO_WRITE 2 /* request a write() */
78 #define LIO_SYNC 3 /* needed by aio_fsync() */
79 
80 /*
81  * 6.7.1.1 Asynchronous I/O Control Block, P1003.1b-1993, p. 151
82  */
83 
84 struct aiocb {
85  /* public */
86  int aio_fildes; /* File descriptor */
87  off_t aio_offset; /* File offset */
88  volatile void *aio_buf; /* Location of buffer */
89  size_t aio_nbytes; /* Length of transfer */
90  int aio_reqprio; /* Request priority offset */
91  struct sigevent aio_sigevent; /* Signal number and value */
92  int aio_lio_opcode; /* Operation to be performed */
93  /* private */
94  int error_code; /* Used for aio_error() */
95  ssize_t return_value; /* Used for aio_return() */
96 };
97 
98 /*
99  * 6.7.2 Asynchronous Read, P1003.1b-1993, p. 154
100  */
101 
102 int aio_read(
103  struct aiocb *aiocbp
104 );
105 
106 /*
107  * 6.7.3 Asynchronous Write, P1003.1b-1993, p. 155
108  */
109 
110 int aio_write(
111  struct aiocb *aiocbp
112 );
113 
114 /*
115  * 6.7.4 List Directed I/O, P1003.1b-1993, p. 158
116  */
117 
118 int lio_listio(
119  int mode,
120  struct aiocb *__restrict const list[__restrict],
121  int nent,
122  struct sigevent *__restrict sig
123 );
124 
125 /*
126  * 6.7.5 Retrieve Error of Asynchronous I/O Operation, P1003.1b-1993, p. 161
127  */
128 
129 int aio_error(
130  const struct aiocb *aiocbp
131 );
132 
133 /*
134  * 6.7.6 Retrieve Return Status of Asynchronous I/O Operation,
135  * P1003.1b-1993, p. 162
136  */
137 
138 ssize_t aio_return(
139  const struct aiocb *aiocbp
140 );
141 
156 int aio_cancel(
157  int filedes,
158  struct aiocb *aiocbp
159 );
160 
161 /*
162  * 6.7.7 Wait for Asynchronous I/O Request, P1003.1b-1993, p. 164
163  */
164 
165 int aio_suspend(
166  const struct aiocb * const list[],
167  int nent,
168  const struct timespec *timeout
169 );
170 
171 #if defined(_POSIX_SYNCHRONIZED_IO)
172 
173 /*
174  * 6.7.9 Asynchronous File Synchronization, P1003.1b-1993, p. 166
175  */
176 
177 int aio_fsync(
178  int op,
179  struct aiocb *aiocbp
180 );
181 
182 #endif /* _POSIX_SYNCHRONIZED_IO */
183 
184 #endif /* _POSIX_ASYNCHRONOUS_IO */
185 
188 #ifdef __cplusplus
189 }
190 #endif
191 
192 #endif
193 /* end of include file */