1 | /** |
---|
2 | * @file aio.h |
---|
3 | */ |
---|
4 | |
---|
5 | /* |
---|
6 | * COPYRIGHT (c) 1989-2007. |
---|
7 | * On-Line Applications Research Corporation (OAR). |
---|
8 | * |
---|
9 | * The license and distribution terms for this file may be |
---|
10 | * found in the file LICENSE in this distribution or at |
---|
11 | * http://www.rtems.com/license/LICENSE. |
---|
12 | * |
---|
13 | * $Id$ |
---|
14 | */ |
---|
15 | |
---|
16 | #ifndef _AIO_H |
---|
17 | #define _AIO_H |
---|
18 | |
---|
19 | #ifdef __cplusplus |
---|
20 | extern "C" { |
---|
21 | #endif |
---|
22 | |
---|
23 | #include <unistd.h> |
---|
24 | |
---|
25 | #if defined(_POSIX_ASYNCHRONOUS_IO) |
---|
26 | |
---|
27 | /* |
---|
28 | * 6.7.1 Data Definitions for Asynchronous Input and Output, |
---|
29 | * P1003.1b-1993, p. 151 |
---|
30 | */ |
---|
31 | |
---|
32 | #include <sys/types.h> |
---|
33 | #include <signal.h> |
---|
34 | #include <time.h> |
---|
35 | #include <fcntl.h> |
---|
36 | |
---|
37 | /* |
---|
38 | * 6.7.1.2 Manifest Constants, P1003.1b-1993, p. 153 |
---|
39 | */ |
---|
40 | |
---|
41 | #define AIO_CANCELED 0 /* all requested operations have been canceled */ |
---|
42 | #define AIO_NOTCANCELED 1 /* some of the operations could not be canceled */ |
---|
43 | /* since they are in progress */ |
---|
44 | #define AIO_ALLDONE 2 /* none of the requested operations could be */ |
---|
45 | /* canceled since they are already complete */ |
---|
46 | |
---|
47 | /* lio_listio() options */ |
---|
48 | |
---|
49 | #define LIO_WAIT 0 /* calling process is to suspend until the */ |
---|
50 | /* operation is complete */ |
---|
51 | #define LIO_NOWAIT 1 /* calling process is to continue execution while */ |
---|
52 | /* the operation is performed and no notification */ |
---|
53 | /* shall be given when the operation is completed */ |
---|
54 | #define LIO_READ 2 /* request a read() */ |
---|
55 | #define LIO_WRITE 3 /* request a write() */ |
---|
56 | #define LIO_NOP 4 /* no transfer is requested */ |
---|
57 | |
---|
58 | /* |
---|
59 | * 6.7.1.1 Asynchronous I/O Control Block, P1003.1b-1993, p. 151 |
---|
60 | */ |
---|
61 | |
---|
62 | struct aiocb { |
---|
63 | int aio_fildes; /* File descriptor */ |
---|
64 | off_t aio_offset; /* File offset */ |
---|
65 | volatile void *aio_buf; /* Location of buffer */ |
---|
66 | size_t aio_nbytes; /* Length of transfer */ |
---|
67 | int aio_reqprio; /* Request priority offset */ |
---|
68 | struct sigevent aio_sigevent; /* Signal number and value */ |
---|
69 | int aio_lio_opcode; /* Operation to be performed */ |
---|
70 | }; |
---|
71 | |
---|
72 | /* |
---|
73 | * 6.7.2 Asynchronous Read, P1003.1b-1993, p. 154 |
---|
74 | */ |
---|
75 | |
---|
76 | int aio_read( |
---|
77 | struct aiocb *aiocbp |
---|
78 | ); |
---|
79 | |
---|
80 | /* |
---|
81 | * 6.7.3 Asynchronous Write, P1003.1b-1993, p. 155 |
---|
82 | */ |
---|
83 | |
---|
84 | int aio_write( |
---|
85 | struct aiocb *aiocbp |
---|
86 | ); |
---|
87 | |
---|
88 | /* |
---|
89 | * 6.7.4 List Directed I/O, P1003.1b-1993, p. 158 |
---|
90 | */ |
---|
91 | |
---|
92 | int lio_listio( |
---|
93 | int mode, |
---|
94 | struct aiocb * const list[], |
---|
95 | int nent, |
---|
96 | struct sigevent *sig |
---|
97 | ); |
---|
98 | |
---|
99 | /* |
---|
100 | * 6.7.5 Retrieve Error of Asynchronous I/O Operation, P1003.1b-1993, p. 161 |
---|
101 | */ |
---|
102 | |
---|
103 | int aio_error( |
---|
104 | const struct aiocb *aiocbp |
---|
105 | ); |
---|
106 | |
---|
107 | /* |
---|
108 | * 6.7.6 Retrieve Return Status of Asynchronous I/O Operation, |
---|
109 | * P1003.1b-1993, p. 162 |
---|
110 | */ |
---|
111 | |
---|
112 | int aio_return( |
---|
113 | const struct aiocb *aiocbp |
---|
114 | ); |
---|
115 | |
---|
116 | /* |
---|
117 | * 6.7.7 Cancel Asynchronous I/O Operation, P1003.1b-1993, p. 163 |
---|
118 | */ |
---|
119 | |
---|
120 | int aio_cancel( |
---|
121 | int filedes, |
---|
122 | struct aiocb *aiocbp |
---|
123 | ); |
---|
124 | |
---|
125 | /* |
---|
126 | * 6.7.7 Wait for Asynchronous I/O Request, P1003.1b-1993, p. 164 |
---|
127 | */ |
---|
128 | |
---|
129 | int aio_suspend( |
---|
130 | const struct aiocb * const list[], |
---|
131 | int nent, |
---|
132 | const struct timespec *timeout |
---|
133 | ); |
---|
134 | |
---|
135 | #if defined(_POSIX_SYNCHRONIZED_IO) |
---|
136 | |
---|
137 | /* |
---|
138 | * 6.7.9 Asynchronous File Synchronization, P1003.1b-1993, p. 166 |
---|
139 | */ |
---|
140 | |
---|
141 | int aio_fsync( |
---|
142 | int op, |
---|
143 | struct aiocb *aiocbp |
---|
144 | ); |
---|
145 | |
---|
146 | #endif /* _POSIX_SYNCHRONIZED_IO */ |
---|
147 | |
---|
148 | #endif /* _POSIX_ASYNCHRONOUS_IO */ |
---|
149 | |
---|
150 | #ifdef __cplusplus |
---|
151 | } |
---|
152 | #endif |
---|
153 | |
---|
154 | #endif |
---|
155 | /* end of include file */ |
---|