(glob_in_dir): Add support for cases insensitive VMS.
[glibc.git] / rt / aio.h
blobc854e97dd34eb8c3afc48da7498aab85d40e5961
1 /* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If not,
16 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
20 * ISO/IEC 9945-1:1996 6.7: Asynchronous Input and Output
23 #ifndef _AIO_H
24 #define _AIO_H 1
26 #include <features.h>
27 #include <fcntl.h>
28 #include <signal.h>
29 #define __need_timespec
30 #include <time.h>
31 #include <sys/types.h>
33 __BEGIN_DECLS
35 /* Asynchronous I/O control block. */
36 struct aiocb
38 int aio_fildes; /* File desriptor. */
39 int aio_lio_opcode; /* Operation to be performed. */
40 int aio_reqprio; /* Request priority offset. */
41 volatile void *aio_buf; /* Location of buffer. */
42 size_t aio_nbytes; /* Length of transfer. */
43 struct sigevent aio_sigevent; /* Signal number and value. */
45 /* Internal members. */
46 struct aiocb *__next_prio;
47 int __abs_prio;
48 int __policy;
49 int __error_code;
50 __ssize_t __return_value;
52 #ifndef __USE_FILE_OFFSET64
53 __off_t aio_offset; /* File offset. */
54 char __pad[sizeof (__off64_t) - sizeof (__off_t)];
55 #else
56 __off64_t aio_offset; /* File offset. */
57 #endif
58 char __unused[32];
61 /* The same for the 64bit offsets. */
62 #ifdef __USE_LARGEFILE64
63 struct aiocb64
65 int aio_fildes; /* File desriptor. */
66 int aio_lio_opcode; /* Operation to be performed. */
67 int aio_reqprio; /* Request priority offset. */
68 volatile void *aio_buf; /* Location of buffer. */
69 size_t aio_nbytes; /* Length of transfer. */
70 struct sigevent aio_sigevent; /* Signal number and value. */
72 /* Internal members. */
73 int __abs_prio;
74 int __policy;
75 int __error_code;
76 __ssize_t __return_value;
78 __off64_t aio_offset; /* File offset. */
79 char __unused[32];
81 #endif
84 #ifdef __USE_GNU
85 /* To customize the implementation one can use the following struct.
86 This implementation follows the one in Irix. */
87 struct aioinit
89 int aio_threads; /* Maximal number of threads. */
90 int aio_num; /* Number of expected simultanious requests. */
91 int aio_locks; /* Not used. */
92 int aio_usedba; /* Not used. */
93 int aio_debug; /* Not used. */
94 int aio_numusers; /* Not used. */
95 int aio_reserved[2];
97 #endif
100 /* Return values of cancelation function. */
101 enum
103 AIO_CANCELED,
104 #define AIO_CANCELED AIO_CANCELED
105 AIO_NOTCANCELED,
106 #define AIO_NOTCANCELED AIO_NOTCANCELED
107 AIO_ALLDONE
108 #define AIO_ALLDONE AIO_ALLDONE
112 /* Operation codes for `aio_lio_opcode'. */
113 enum
115 LIO_READ,
116 #define LIO_READ LIO_READ
117 LIO_WRITE,
118 #define LIO_WRITE LIO_WRITE
119 LIO_NOP
120 #define LIO_NOP LIO_NOP
124 /* Synchronization options for `lio_listio' function. */
125 enum
127 LIO_WAIT,
128 #define LIO_WAIT LIO_WAIT
129 LIO_NOWAIT
130 #define LIO_NOWAIT LIO_NOWAIT
134 /* Allow user to specify optimization. */
135 #ifdef __USE_GNU
136 extern void __aio_init __P ((__const struct aioinit *__init));
137 extern void aio_init __P ((__const struct aioinit *__init));
138 #endif
141 /* Enqueue read request for given number of bytes and the given priority. */
142 #ifndef __USE_FILE_OFFSET64
143 extern int aio_read __P ((struct aiocb *__aiocbp));
144 #else
145 extern int aio_read __P ((struct aiocb *__aiocbp)) __asm__ ("aio_read64");
146 #endif
147 #ifdef __USE_LARGEFILE64
148 extern int aio_read64 __P ((struct aiocb64 *__aiocbp));
149 #endif
151 /* Enqueue write request for given number of bytes and the given priority. */
152 #ifndef __USE_FILE_OFFSET64
153 extern int aio_write __P ((struct aiocb *__aiocbp));
154 #else
155 extern int aio_write __P ((struct aiocb *__aiocbp)) __asm__ ("aio_write64");
156 #endif
157 #ifdef __USE_LARGEFILE64
158 extern int aio_write64 __P ((struct aiocb64 *__aiocbp));
159 #endif
162 /* Initiate list of I/O requests. */
163 #ifndef __USE_FILE_OFFSET64
164 extern int lio_listio __P ((int __mode, struct aiocb *__const __list[],
165 int __nent, struct sigevent *__sig));
166 #else
167 extern int lio_listio __P ((int __mode, struct aiocb *__const __list[],
168 int __nent, struct sigevent *__sig))
169 __asm__ ("lio_listio64");
170 #endif
171 #ifdef __USE_LARGEFILE64
172 extern int lio_listio64 __P ((int __mode, struct aiocb64 *__const __list[],
173 int __nent, struct sigevent *__sig));
174 #endif
177 /* Retrieve error status associated with AIOCBP. */
178 #ifndef __USE_FILE_OFFSET64
179 extern int aio_error __P ((__const struct aiocb *__aiocbp));
180 #else
181 extern int aio_error __P ((__const struct aiocb *__aiocbp))
182 __asm__ ("aio_error64");
183 #endif
184 #ifdef __USE_LARGEFILE64
185 extern int aio_error64 __P ((__const struct aiocb64 *__aiocbp));
186 #endif
189 /* Return status associated with AIOCBP. */
190 #ifndef __USE_FILE_OFFSET64
191 extern __ssize_t aio_return __P ((struct aiocb *__aiocbp));
192 #else
193 extern __ssize_t aio_return __P ((struct aiocb *__aiocbp))
194 __asm__ ("aio_return64");
195 #endif
196 #ifdef __USE_LARGEFILE64
197 extern __ssize_t aio_return64 __P ((struct aiocb64 *__aiocbp));
198 #endif
201 /* Try to cancel asynchronous I/O requests outstanding against file
202 descriptot FILDES. */
203 #ifndef __USE_FILE_OFFSET64
204 extern int aio_cancel __P ((int __fildes, struct aiocb *__aiocbp));
205 #else
206 extern int aio_cancel __P ((int __fildes, struct aiocb *__aiocbp))
207 __asm__ ("aio_cancel64");
208 #endif
209 #ifdef __USE_LARGEFILE64
210 extern int aio_cancel64 __P ((int __fildes, struct aiocb64 *__aiocbp));
211 #endif
214 /* Suspend calling thread until at least one of the asynchronous I/O
215 operations referenced by LIST has completed. */
216 #ifndef __USE_FILE_OFFSET64
217 extern int aio_suspend __P ((__const struct aiocb *__const __list[],
218 int __nent, __const struct timespec *__timeout));
219 #else
220 extern int aio_suspend __P ((__const struct aiocb *__const __list[],
221 int __nent, __const struct timespec *__timeout))
222 __asm__ ("aio_suspend64");
223 #endif
224 #ifdef __USE_LARGEFILE64
225 extern int aio_suspend64 __P ((__const struct aiocb64 *__const __list[],
226 int __nent,
227 __const struct timespec *__timeout));
228 #endif
231 /* Force all operations associated with file desriptor described by
232 `aio_fildes' member of AIOCBP. */
233 #ifndef __USE_FILE_OFFSET64
234 extern int aio_fsync __P ((int __op, struct aiocb *__aiocbp));
235 #else
236 extern int aio_fsync __P ((int __op, struct aiocb *__aiocbp))
237 __asm__ ("aio_fsync64");
238 #endif
239 #ifdef __USE_LARGEFILE64
240 extern int aio_fsync64 __P ((int __op, struct aiocb64 *__aiocbp));
241 #endif
244 __END_DECLS
246 #endif /* aio.h */