Merge from vendor branch NCURSES:
[dragonfly.git] / sys / emulation / posix4 / aio.h
1 /* XXX Conflicts with John's - not installed.
2  */
3 /*-
4  * Copyright (c) 1996, 1997
5  *      HD Associates, Inc.  All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. All advertising materials mentioning features or use of this software
16  *    must display the following acknowledgement:
17  *      This product includes software developed by HD Associates, Inc
18  * 4. Neither the name of the author nor the names of any co-contributors
19  *    may be used to endorse or promote products derived from this software
20  *    without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY HD ASSOCIATES AND CONTRIBUTORS ``AS IS'' AND
23  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  * ARE DISCLAIMED.  IN NO EVENT SHALL HD ASSOCIATES OR CONTRIBUTORS BE LIABLE
26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32  * SUCH DAMAGE.
33  *
34  * $FreeBSD: src/sys/posix4/aio.h,v 1.6 1999/12/29 04:55:01 peter Exp $
35  * $DragonFly: src/sys/emulation/posix4/Attic/aio.h,v 1.3 2003/08/27 06:30:04 rob Exp $
36  */
37
38 /* aio.h: P1003.1B-1993 Asynchronous I/O */
39
40 #ifndef _P1003_1B_AIO_H_
41 #define _P1003_1B_AIO_H_
42
43 #include <sys/_posix.h>
44 #include <sys/types.h>
45
46 /* For struct sigevent:
47  */
48 #ifdef _KERNEL
49 #include <sys/signal.h>
50 #else
51 #include <signal.h>
52
53 #ifdef _P1003_1B_INCLUDE_MAYBES
54 #include <time.h>
55 #include <fcntl.h>
56 #else
57 struct timespec;
58 #endif
59 #endif
60
61 /* Return values: */
62
63 #define AIO_CANCELED            0x01    /* All operations cancelled */
64 #define AIO_NOTCANCELLED        0x02    /* Some not cancelled */
65 #define AIO_ALLDONE             0x04    /* None were cancelled */
66
67 /* lio_listio synchronization options */
68
69 #define LIO_WAIT                0x08    /* Suspend until complete */
70 #define LIO_NOWAIT              0x10    /* Continue operation */
71
72 /* lio_listio element operations */
73
74 #define LIO_READ                0x20
75 #define LIO_WRITE               0x40
76 #define LIO_NOP                 0x80
77
78 typedef struct aiocb * const aio_listio_ctl;
79 typedef const struct aiocb * const caio_listio_ctl;
80
81 struct aiocb {
82         int             aio_fildes;     /* File descriptor */
83         off_t           aio_offset;     /* File offset */
84         volatile void * aio_buf;        /* Location of buffer */
85         size_t          aio_nbytes;     /* Length of transfer */
86         int             aio_reqprio;    /* Request priority offset */
87         struct sigevent aio_sigevent;   /* Signal number and value */
88         int             aio_lio_opcode; /* Operation to be performed */
89 };
90
91 #ifndef _KERNEL
92 #include <sys/cdefs.h>
93
94 __BEGIN_DECLS
95 int aio_read (struct aiocb *);
96 int aio_write (struct aiocb *);
97
98 int lio_listio (int, aio_listio_ctl[], int, struct sigevent *);
99
100 int aio_error (const struct aiocb *);
101 ssize_t aio_return (struct aiocb *);
102 int aio_cancel (int, struct aiocb *);
103
104 int aio_suspend (caio_listio_ctl[], int, const struct timespec *);
105
106 int aio_fsync (int, struct aiocb *);
107 __END_DECLS
108
109 #endif /* _KERNEL */
110
111 #endif /* _P1003_1B_AIO_H_ */