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