1 /* Copyright (C) 1996, 1997, 1998 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
30 #include <sys/types.h>
34 /* Asynchronous I/O control block. */
37 int aio_fildes
; /* File desriptor. */
38 int aio_lio_opcode
; /* Operation to be performed. */
39 int aio_reqprio
; /* Request priority offset. */
40 volatile void *aio_buf
; /* Location of buffer. */
41 size_t aio_nbytes
; /* Length of transfer. */
42 struct sigevent aio_sigevent
; /* Signal number and value. */
44 /* Internal members. */
45 struct aiocb
*__next_prio
;
49 __ssize_t __return_value
;
51 #ifndef __USE_FILE_OFFSET64
52 __off_t aio_offset
; /* File offset. */
53 char __pad
[sizeof (__off64_t
) - sizeof (__off_t
)];
55 __off64_t aio_offset
; /* File offset. */
60 /* The same for the 64bit offsets. */
61 #ifdef __USE_LARGEFILE64
64 int aio_fildes
; /* File desriptor. */
65 int aio_lio_opcode
; /* Operation to be performed. */
66 int aio_reqprio
; /* Request priority offset. */
67 volatile void *aio_buf
; /* Location of buffer. */
68 size_t aio_nbytes
; /* Length of transfer. */
69 struct sigevent aio_sigevent
; /* Signal number and value. */
71 /* Internal members. */
75 __ssize_t __return_value
;
77 __off64_t aio_offset
; /* File offset. */
84 /* To customize the implementation one can use the following struct.
85 This implementation follows the one in Irix. */
88 int aio_threads
; /* Maximal number of threads. */
89 int aio_num
; /* Number of expected simultanious requests. */
90 int aio_locks
; /* Not used. */
91 int aio_usedba
; /* Not used. */
92 int aio_debug
; /* Not used. */
93 int aio_numusers
; /* Not used. */
99 /* Return values of cancelation function. */
103 #define AIO_CANCELED AIO_CANCELED
105 #define AIO_NOTCANCELED AIO_NOTCANCELED
107 #define AIO_ALLDONE AIO_ALLDONE
111 /* Operation codes for `aio_lio_opcode'. */
115 #define LIO_READ LIO_READ
117 #define LIO_WRITE LIO_WRITE
119 #define LIO_NOP LIO_NOP
123 /* Synchronization options for `lio_listio' function. */
127 #define LIO_WAIT LIO_WAIT
129 #define LIO_NOWAIT LIO_NOWAIT
133 /* Allow user to specify optimization. */
135 extern void __aio_init
__P ((__const
struct aioinit
*__init
));
136 extern void aio_init
__P ((__const
struct aioinit
*__init
));
140 #ifndef __USE_FILE_OFFSET64
141 /* Enqueue read request for given number of bytes and the given priority. */
142 extern int aio_read
__P ((struct aiocb
*__aiocbp
));
143 /* Enqueue write request for given number of bytes and the given priority. */
144 extern int aio_write
__P ((struct aiocb
*__aiocbp
));
146 /* Initiate list of I/O requests. */
147 extern int lio_listio
__P ((int __mode
, struct aiocb
*__const __list
[],
148 int __nent
, struct sigevent
*__sig
));
150 /* Retrieve error status associated with AIOCBP. */
151 extern int aio_error
__P ((__const
struct aiocb
*__aiocbp
));
152 /* Return status associated with AIOCBP. */
153 extern __ssize_t aio_return
__P ((struct aiocb
*__aiocbp
));
155 /* Try to cancel asynchronous I/O requests outstanding against file
156 descriptor FILDES. */
157 extern int aio_cancel
__P ((int __fildes
, struct aiocb
*__aiocbp
));
159 /* Suspend calling thread until at least one of the asynchronous I/O
160 operations referenced by LIST has completed. */
161 extern int aio_suspend
__P ((__const
struct aiocb
*__const __list
[],
162 int __nent
, __const
struct timespec
*__timeout
));
164 /* Force all operations associated with file desriptor described by
165 `aio_fildes' member of AIOCBP. */
166 extern int aio_fsync
__P ((int __operation
, struct aiocb
*__aiocbp
));
169 extern int __REDIRECT (aio_read
, __P ((struct aiocb
*__aiocbp
)), aio_read64
);
170 extern int __REDIRECT (aio_write
, __P ((struct aiocb
*__aiocbp
)), aio_write64
);
172 extern int __REDIRECT (lio_listio
, __P ((int __mode
,
173 struct aiocb
*__const __list
[],
174 int __nent
, struct sigevent
*__sig
)),
177 extern int __REDIRECT (aio_error
, __P ((__const
struct aiocb
*__aiocbp
)),
179 extern __ssize_t
__REDIRECT (aio_return
, __P ((struct aiocb
*__aiocbp
)),
182 extern int __REDIRECT (aio_cancel
, __P ((int __fildes
,
183 struct aiocb
*__aiocbp
)),
186 extern int __REDIRECT (aio_suspend
,
187 __P ((__const
struct aiocb
*__const __list
[],
188 int __nent
, __const
struct timespec
*__timeout
)),
191 extern int __REDIRECT (aio_fsync
__P ((int __operation
,
192 struct aiocb
*__aiocbp
)),
196 # define aio_read aio_read64
197 # define aio_write aio_write64
198 # define lio_listio lio_listio64
199 # define aio_error aio_error64
200 # define aio_return aio_return64
201 # define aio_cancel aio_cancel64
202 # define aio_suspend aio_suspend64
203 # define aio_fsync aio_fsync64
207 #ifdef __USE_LARGEFILE64
208 extern int aio_read64
__P ((struct aiocb64
*__aiocbp
));
209 extern int aio_write64
__P ((struct aiocb64
*__aiocbp
));
211 extern int lio_listio64
__P ((int __mode
, struct aiocb64
*__const __list
[],
212 int __nent
, struct sigevent
*__sig
));
214 extern int aio_error64
__P ((__const
struct aiocb64
*__aiocbp
));
215 extern __ssize_t aio_return64
__P ((struct aiocb64
*__aiocbp
));
217 extern int aio_cancel64
__P ((int __fildes
, struct aiocb64
*__aiocbp
));
219 extern int aio_suspend64
__P ((__const
struct aiocb64
*__const __list
[],
221 __const
struct timespec
*__timeout
));
223 extern int aio_fsync64
__P ((int __operation
, struct aiocb64
*__aiocbp
));