Update.
[glibc/history.git] / rt / aio_misc.h
blobaf8e2479baa456402aaf490d7bd8f564a106ecb4
1 /* Copyright (C) 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. */
19 #ifndef _AIO_MISC_H
20 #define _AIO_MISC_H 1
22 #include <aio.h>
23 #include <pthread.h>
26 /* Extend the operation enum. */
27 enum
29 LIO_DSYNC = LIO_READ + 1,
30 LIO_SYNC,
31 LIO_READ64 = LIO_READ | 128,
32 LIO_WRITE64 = LIO_WRITE | 128
36 /* Union of the two request types. */
37 typedef union
39 struct aiocb aiocb;
40 struct aiocb64 aiocb64;
41 } aiocb_union;
44 /* Used to synchronize. */
45 struct waitlist
47 struct waitlist *next;
49 pthread_cond_t *cond;
50 volatile int *counterp;
51 /* The next field is used in asynchronous `lio_listio' operations. */
52 struct sigevent *sigevp;
56 /* Status of a request. */
57 enum
59 no,
60 queued,
61 yes,
62 allocated
66 /* Used to queue requests.. */
67 struct requestlist
69 int running;
71 struct requestlist *last_fd;
72 struct requestlist *next_fd;
73 struct requestlist *next_prio;
74 struct requestlist *next_run;
76 /* Pointer to the actual data. */
77 aiocb_union *aiocbp;
79 /* List of waiting processes. */
80 struct waitlist *waiting;
84 /* Lock for global I/O list of requests. */
85 extern pthread_mutex_t __aio_requests_mutex;
88 /* Enqueue request. */
89 extern struct requestlist *__aio_enqueue_request (aiocb_union *aiocbp,
90 int operation)
91 internal_function;
93 /* Find request entry for given AIO control block. */
94 extern struct requestlist *__aio_find_req (aiocb_union *elem)
95 internal_function;
97 /* Find request entry for given file descriptor. */
98 extern struct requestlist *__aio_find_req_fd (int fildes) internal_function;
100 /* Release the entry for the request. */
101 extern void __aio_free_request (struct requestlist *req) internal_function;
103 /* Notify initiator of request and tell this everybody listening. */
104 extern void __aio_notify (struct requestlist *req) internal_function;
106 /* Notify initiator of request. */
107 extern int __aio_notify_only (struct sigevent *sigev) internal_function;
109 /* Send the signal. */
110 extern int __aio_sigqueue (int sig, const union sigval val) internal_function;
112 #endif /* aio_misc.h */