RTEMS 6.1-rc2
Loading...
Searching...
No Matches
aio.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
12/*
13 * COPYRIGHT (c) 1989-2011.
14 * On-Line Applications Research Corporation (OAR).
15 *
16 * Redistribution and use in source and binary forms, with or without
17 * modification, are permitted provided that the following conditions
18 * are met:
19 * 1. Redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer.
21 * 2. Redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the distribution.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
29 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 */
37
38#ifndef _AIO_H
39#define _AIO_H
40
41#include <sys/cdefs.h>
42#include <unistd.h>
43
44#ifdef __cplusplus
45extern "C" {
46#endif
47
58#if defined(_POSIX_ASYNCHRONOUS_IO)
59
60/*
61 * 6.7.1 Data Definitions for Asynchronous Input and Output,
62 * P1003.1b-1993, p. 151
63 */
64
65#include <sys/types.h>
66#include <signal.h>
67#include <time.h>
68#include <fcntl.h>
69
70/*
71 * 6.7.1.2 Manifest Constants, P1003.1b-1993, p. 153
72 */
73
74#define AIO_CANCELED 0 /* all requested operations have been canceled */
75#define AIO_NOTCANCELED 1 /* some of the operations could not be canceled */
76 /* since they are in progress */
77#define AIO_ALLDONE 2 /* none of the requested operations could be */
78 /* canceled since they are already complete */
79
80/* lio_listio() options */
81
82/*
83 * LIO modes
84 */
85#define LIO_WAIT 0 /* calling process is to suspend until the */
86 /* operation is complete */
87#define LIO_NOWAIT 1 /* calling process is to continue execution while */
88 /* the operation is performed and no notification */
89 /* shall be given when the operation is completed */
90
91/*
92 * LIO opcodes
93 */
94#define LIO_NOP 0 /* no transfer is requested */
95#define LIO_READ 1 /* request a read() */
96#define LIO_WRITE 2 /* request a write() */
97#define LIO_SYNC 3 /* needed by aio_fsync() */
98
99/*
100 * 6.7.1.1 Asynchronous I/O Control Block, P1003.1b-1993, p. 151
101 */
102
103struct aiocb {
104 /* public */
105 int aio_fildes; /* File descriptor */
106 off_t aio_offset; /* File offset */
107 volatile void *aio_buf; /* Location of buffer */
108 size_t aio_nbytes; /* Length of transfer */
109 int aio_reqprio; /* Request priority offset */
110 struct sigevent aio_sigevent; /* Signal number and value */
111 int aio_lio_opcode; /* Operation to be performed */
112 /* private */
113 int error_code; /* Used for aio_error() */
114 ssize_t return_value; /* Used for aio_return() */
115};
116
117/*
118 * 6.7.2 Asynchronous Read, P1003.1b-1993, p. 154
119 */
120
121int aio_read(
122 struct aiocb *aiocbp
123);
124
125/*
126 * 6.7.3 Asynchronous Write, P1003.1b-1993, p. 155
127 */
128
129int aio_write(
130 struct aiocb *aiocbp
131);
132
133/*
134 * 6.7.4 List Directed I/O, P1003.1b-1993, p. 158
135 */
136
137int lio_listio(
138 int mode,
139 struct aiocb *__restrict const list[__restrict],
140 int nent,
141 struct sigevent *__restrict sig
142);
143
144/*
145 * 6.7.5 Retrieve Error of Asynchronous I/O Operation, P1003.1b-1993, p. 161
146 */
147
148int aio_error(
149 const struct aiocb *aiocbp
150);
151
152/*
153 * 6.7.6 Retrieve Return Status of Asynchronous I/O Operation,
154 * P1003.1b-1993, p. 162
155 */
156
157ssize_t aio_return(
158 const struct aiocb *aiocbp
159);
160
175int aio_cancel(
176 int filedes,
177 struct aiocb *aiocbp
178);
179
180/*
181 * 6.7.7 Wait for Asynchronous I/O Request, P1003.1b-1993, p. 164
182 */
183
184int aio_suspend(
185 const struct aiocb * const list[],
186 int nent,
187 const struct timespec *timeout
188);
189
190#if defined(_POSIX_SYNCHRONIZED_IO)
191
192/*
193 * 6.7.9 Asynchronous File Synchronization, P1003.1b-1993, p. 166
194 */
195
196int aio_fsync(
197 int op,
198 struct aiocb *aiocbp
199);
200
201#endif /* _POSIX_SYNCHRONIZED_IO */
202
203#endif /* _POSIX_ASYNCHRONOUS_IO */
204
207#ifdef __cplusplus
208}
209#endif
210
211#endif
212/* end of include file */