source: rtems/cpukit/posix/include/aio.h @ 3cf4031

4.115
Last change on this file since 3cf4031 was 3cf4031, checked in by Alex Ivanov <alexivanov97@…>, on 12/28/12 at 23:48:12

Header File Doxygen Enhancement Task #1

  • Property mode set to 100644
File size: 4.2 KB
Line 
1/**
2 * @file
3 *
4 * @brief POSIX Asynchronous Input and Output
5 *
6 * This file contains the definitions related to POSIX Asynchronous
7 * Input and Output,
8 */
9
10/*
11 *  COPYRIGHT (c) 1989-2011.
12 *  On-Line Applications Research Corporation (OAR).
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.com/license/LICENSE.
17 */
18
19#ifndef _AIO_H
20#define _AIO_H
21
22#include <unistd.h>
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28/**
29 * @defgroup POSIX_AIO POSIX Asynchronous I/O Support
30 *
31 * @ingroup POSIX
32 *
33 * @brief POSIX Asynchronous Input and Output
34 */
35
36#if defined(_POSIX_ASYNCHRONOUS_IO)
37
38/*
39 *  6.7.1 Data Definitions for Asynchronous Input and Output,
40 *        P1003.1b-1993, p. 151
41 */
42
43#include <sys/types.h>
44#include <signal.h>
45#include <time.h>
46#include <fcntl.h>
47
48/*
49 *  6.7.1.2 Manifest Constants, P1003.1b-1993, p. 153
50 */
51
52#define AIO_CANCELED    0 /* all requested operations have been canceled */
53#define AIO_NOTCANCELED 1 /* some of the operations could not be canceled */
54                          /*   since they are in progress */
55#define AIO_ALLDONE     2 /* none of the requested operations could be */
56                          /*   canceled since they are already complete */
57
58/* lio_listio() options */
59
60/*
61 * LIO modes
62 */
63#define LIO_WAIT        0 /* calling process is to suspend until the */
64                          /*   operation is complete */
65#define LIO_NOWAIT      1 /* calling process is to continue execution while */
66                          /*   the operation is performed and no notification */
67                          /*   shall be given when the operation is completed */
68
69/*
70 * LIO opcodes
71 */
72#define LIO_NOP         0 /* no transfer is requested */
73#define LIO_READ        1 /* request a read() */
74#define LIO_WRITE       2 /* request a write() */
75#define LIO_SYNC        3 /* needed by aio_fsync() */
76
77/*
78 *  6.7.1.1 Asynchronous I/O Control Block, P1003.1b-1993, p. 151
79 */
80
81struct aiocb {
82  /* public */
83  int             aio_fildes;     /* File descriptor */
84  off_t           aio_offset;     /* File offset */
85  volatile void  *aio_buf;        /* Location of buffer */
86  size_t          aio_nbytes;     /* Length of transfer */
87  int             aio_reqprio;    /* Request priority offset */
88  struct sigevent aio_sigevent;   /* Signal number and value */
89  int             aio_lio_opcode; /* Operation to be performed */
90  /* private */
91  int             error_code;      /* Used for aio_error() */
92  ssize_t         return_value;     /* Used for aio_return() */
93};
94
95/*
96 *  6.7.2 Asynchronous Read, P1003.1b-1993, p. 154
97 */
98
99int aio_read(
100  struct aiocb  *aiocbp
101);
102
103/*
104 *  6.7.3 Asynchronous Write, P1003.1b-1993, p. 155
105 */
106
107int aio_write(
108  struct aiocb  *aiocbp
109);
110
111/*
112 *  6.7.4 List Directed I/O, P1003.1b-1993, p. 158
113 */
114
115int lio_listio(
116  int                    mode,
117  struct aiocb  * const  list[],
118  int                    nent,
119  struct sigevent       *sig
120);
121
122/*
123 *  6.7.5 Retrieve Error of Asynchronous I/O Operation, P1003.1b-1993, p. 161
124 */
125
126int aio_error(
127  const struct aiocb  *aiocbp
128);
129
130/*
131 *  6.7.6 Retrieve Return Status of Asynchronous I/O Operation,
132 *        P1003.1b-1993, p. 162
133 */
134
135ssize_t aio_return(
136  const struct aiocb  *aiocbp
137);
138
139/**
140 *  @brief Cancel Asynchronous I/O Operation
141 *
142 *  6.7.7 Cancel Asynchronous I/O Operation, P1003.1b-1993, p. 163
143 *
144 *  @param[in] filedes is the file descriptor
145 *  @param[in] aiocbp is the asynchronous I/O control block
146 *
147 *  @return This method returns AIO_CANCELED if the requested operation(s)
148 *          were canceled. Otherwise, AIO_NOTCANCELED is returned indicating
149 *          that at least one of the requested operation(s) cannot be canceled
150 */
151int aio_cancel(
152  int            filedes,
153  struct aiocb  *aiocbp
154);
155
156/*
157 *  6.7.7 Wait for Asynchronous I/O Request, P1003.1b-1993, p. 164
158 */
159
160int aio_suspend(
161  const struct aiocb  * const   list[],
162  int                     nent,
163  const struct timespec  *timeout
164);
165
166#if defined(_POSIX_SYNCHRONIZED_IO)
167
168/*
169 *  6.7.9 Asynchronous File Synchronization, P1003.1b-1993, p. 166
170 */
171
172int aio_fsync(
173  int            op,
174  struct aiocb  *aiocbp
175);
176
177#endif /* _POSIX_SYNCHRONIZED_IO */
178
179#endif /* _POSIX_ASYNCHRONOUS_IO */
180
181#ifdef __cplusplus
182}
183#endif
184
185#endif
186/* end of include file */
Note: See TracBrowser for help on using the repository browser.