xref: /onnv-gate/usr/src/head/aio.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24*0Sstevel@tonic-gate  * Use is subject to license terms.
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate 
27*0Sstevel@tonic-gate #ifndef _AIO_H
28*0Sstevel@tonic-gate #define	_AIO_H
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate #include <sys/feature_tests.h>
33*0Sstevel@tonic-gate #include <sys/types.h>
34*0Sstevel@tonic-gate #include <sys/fcntl.h>
35*0Sstevel@tonic-gate #include <sys/siginfo.h>
36*0Sstevel@tonic-gate #include <sys/aiocb.h>
37*0Sstevel@tonic-gate #include <time.h>
38*0Sstevel@tonic-gate 
39*0Sstevel@tonic-gate #ifdef	__cplusplus
40*0Sstevel@tonic-gate extern "C" {
41*0Sstevel@tonic-gate #endif
42*0Sstevel@tonic-gate 
43*0Sstevel@tonic-gate #if	(_POSIX_C_SOURCE - 0 > 0) && (_POSIX_C_SOURCE - 0 <= 2)
44*0Sstevel@tonic-gate #error	"POSIX Asynchronous I/O is not supported in POSIX.1-1990"
45*0Sstevel@tonic-gate #endif
46*0Sstevel@tonic-gate 
47*0Sstevel@tonic-gate /* large file compilation environment setup */
48*0Sstevel@tonic-gate #if !defined(_LP64) && _FILE_OFFSET_BITS == 64
49*0Sstevel@tonic-gate #ifdef __PRAGMA_REDEFINE_EXTNAME
50*0Sstevel@tonic-gate #pragma	redefine_extname	aio_read	aio_read64
51*0Sstevel@tonic-gate #pragma	redefine_extname	aio_write	aio_write64
52*0Sstevel@tonic-gate #pragma	redefine_extname	lio_listio	lio_listio64
53*0Sstevel@tonic-gate #pragma	redefine_extname	aio_error	aio_error64
54*0Sstevel@tonic-gate #pragma	redefine_extname	aio_return	aio_return64
55*0Sstevel@tonic-gate #pragma	redefine_extname	aio_cancel	aio_cancel64
56*0Sstevel@tonic-gate #pragma	redefine_extname	aio_suspend	aio_suspend64
57*0Sstevel@tonic-gate #pragma	redefine_extname	aio_fsync	aio_fsync64
58*0Sstevel@tonic-gate #pragma	redefine_extname	aio_waitn	aio_waitn64
59*0Sstevel@tonic-gate #else
60*0Sstevel@tonic-gate #define	aiocb		aiocb64
61*0Sstevel@tonic-gate #define	aiocb_t		aiocb64_t
62*0Sstevel@tonic-gate #define	aio_read	aio_read64
63*0Sstevel@tonic-gate #define	aio_write	aio_write64
64*0Sstevel@tonic-gate #define	lio_listio	lio_listio64
65*0Sstevel@tonic-gate #define	aio_error	aio_error64
66*0Sstevel@tonic-gate #define	aio_return	aio_return64
67*0Sstevel@tonic-gate #define	aio_cancel	aio_cancel64
68*0Sstevel@tonic-gate #define	aio_suspend	aio_suspend64
69*0Sstevel@tonic-gate #define	aio_fsync	aio_fsync64
70*0Sstevel@tonic-gate #define	aio_waitn	aio_waitn64
71*0Sstevel@tonic-gate #endif
72*0Sstevel@tonic-gate #endif /* !_LP64 && _FILE_OFFSET_BITS == 64 */
73*0Sstevel@tonic-gate 
74*0Sstevel@tonic-gate #if defined(_LP64) && defined(_LARGEFILE64_SOURCE)
75*0Sstevel@tonic-gate /*
76*0Sstevel@tonic-gate  * In the LP64 compilation environment, map the 64-bit-explicit versions
77*0Sstevel@tonic-gate  * back to the generic versions: all i/o operations are already "large file"
78*0Sstevel@tonic-gate  */
79*0Sstevel@tonic-gate #ifdef __PRAGMA_REDEFINE_EXTNAME
80*0Sstevel@tonic-gate #pragma	redefine_extname	aio_read64	aio_read
81*0Sstevel@tonic-gate #pragma	redefine_extname	aio_write64	aio_write
82*0Sstevel@tonic-gate #pragma	redefine_extname	lio_listio64	lio_listio
83*0Sstevel@tonic-gate #pragma	redefine_extname	aio_error64	aio_error
84*0Sstevel@tonic-gate #pragma	redefine_extname	aio_return64	aio_return
85*0Sstevel@tonic-gate #pragma	redefine_extname	aio_cancel64	aio_cancel
86*0Sstevel@tonic-gate #pragma	redefine_extname	aio_suspend64	aio_suspend
87*0Sstevel@tonic-gate #pragma	redefine_extname	aio_fsync64	aio_fsync
88*0Sstevel@tonic-gate #pragma	redefine_extname	aio_waitn64	aio_waitn
89*0Sstevel@tonic-gate #else
90*0Sstevel@tonic-gate #define	aiocb64		aiocb
91*0Sstevel@tonic-gate #define	aiocb64_t	aiocb_t
92*0Sstevel@tonic-gate #define	aio_read64	aio_read
93*0Sstevel@tonic-gate #define	aio_write64	aio_write
94*0Sstevel@tonic-gate #define	lio_listio64	lio_listio
95*0Sstevel@tonic-gate #define	aio_error64	aio_error
96*0Sstevel@tonic-gate #define	aio_return64	aio_return
97*0Sstevel@tonic-gate #define	aio_cancel64	aio_cancel
98*0Sstevel@tonic-gate #define	aio_suspend64	aio_suspend
99*0Sstevel@tonic-gate #define	aio_fsync64	aio_fsync
100*0Sstevel@tonic-gate #define	aio_waitn64	aio_waitn
101*0Sstevel@tonic-gate #endif
102*0Sstevel@tonic-gate #endif	/* _LP64 && _LARGEFILE64_SOURCE */
103*0Sstevel@tonic-gate 
104*0Sstevel@tonic-gate /*
105*0Sstevel@tonic-gate  * function prototypes
106*0Sstevel@tonic-gate  */
107*0Sstevel@tonic-gate #if	defined(__STDC__)
108*0Sstevel@tonic-gate extern int	aio_read(aiocb_t *);
109*0Sstevel@tonic-gate extern int	aio_write(aiocb_t *);
110*0Sstevel@tonic-gate extern int	lio_listio(int,
111*0Sstevel@tonic-gate 		    aiocb_t *_RESTRICT_KYWD const *_RESTRICT_KYWD,
112*0Sstevel@tonic-gate 		    int, struct sigevent *_RESTRICT_KYWD);
113*0Sstevel@tonic-gate extern int	aio_error(const aiocb_t *);
114*0Sstevel@tonic-gate extern ssize_t	aio_return(aiocb_t *);
115*0Sstevel@tonic-gate extern int	aio_cancel(int, aiocb_t *);
116*0Sstevel@tonic-gate extern int	aio_suspend(const aiocb_t *const[], int,
117*0Sstevel@tonic-gate 		    const struct timespec *);
118*0Sstevel@tonic-gate extern int	aio_fsync(int, aiocb_t *);
119*0Sstevel@tonic-gate extern int	aio_waitn(aiocb_t *[], uint_t, uint_t *,
120*0Sstevel@tonic-gate 		    const struct timespec *);
121*0Sstevel@tonic-gate 
122*0Sstevel@tonic-gate 
123*0Sstevel@tonic-gate #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
124*0Sstevel@tonic-gate 	!defined(__PRAGMA_REDEFINE_EXTNAME))
125*0Sstevel@tonic-gate extern int	aio_read64(aiocb64_t *);
126*0Sstevel@tonic-gate extern int	aio_write64(aiocb64_t *);
127*0Sstevel@tonic-gate extern int	lio_listio64(int,
128*0Sstevel@tonic-gate 			aiocb64_t *_RESTRICT_KYWD const *_RESTRICT_KYWD,
129*0Sstevel@tonic-gate 			int, struct sigevent *_RESTRICT_KYWD);
130*0Sstevel@tonic-gate extern int	aio_error64(const aiocb64_t *);
131*0Sstevel@tonic-gate extern ssize_t	aio_return64(aiocb64_t *);
132*0Sstevel@tonic-gate extern int	aio_cancel64(int, aiocb64_t *);
133*0Sstevel@tonic-gate extern int	aio_suspend64(const aiocb64_t *const[], int,
134*0Sstevel@tonic-gate 			const struct timespec *);
135*0Sstevel@tonic-gate extern int	aio_fsync64(int, aiocb64_t *);
136*0Sstevel@tonic-gate extern int	aio_waitn64(aiocb64_t *[], uint_t, uint_t *,
137*0Sstevel@tonic-gate 		    const struct timespec *);
138*0Sstevel@tonic-gate #endif	/* _LARGEFILE64_SOURCE */
139*0Sstevel@tonic-gate 
140*0Sstevel@tonic-gate #else
141*0Sstevel@tonic-gate extern int	aio_read();
142*0Sstevel@tonic-gate extern int	aio_write();
143*0Sstevel@tonic-gate extern int	lio_listio();
144*0Sstevel@tonic-gate extern int	aio_error();
145*0Sstevel@tonic-gate extern ssize_t	aio_return();
146*0Sstevel@tonic-gate extern int	aio_cancel();
147*0Sstevel@tonic-gate extern int	aio_suspend();
148*0Sstevel@tonic-gate extern int	aio_fsync();
149*0Sstevel@tonic-gate extern int	aio_waitn();
150*0Sstevel@tonic-gate 
151*0Sstevel@tonic-gate #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
152*0Sstevel@tonic-gate 	!defined(__PRAGMA_REDEFINE_EXTNAME))
153*0Sstevel@tonic-gate extern int	aio_read64();
154*0Sstevel@tonic-gate extern int	aio_write64();
155*0Sstevel@tonic-gate extern int	lio_listio64();
156*0Sstevel@tonic-gate extern int	aio_error64();
157*0Sstevel@tonic-gate extern ssize_t	aio_return64();
158*0Sstevel@tonic-gate extern int	aio_cancel64();
159*0Sstevel@tonic-gate extern int	aio_suspend64();
160*0Sstevel@tonic-gate extern int	aio_fsync64();
161*0Sstevel@tonic-gate extern int	aio_waitn64();
162*0Sstevel@tonic-gate #endif	/* _LARGEFILE64_SOURCE */
163*0Sstevel@tonic-gate 
164*0Sstevel@tonic-gate #endif	/* __STDC__ */
165*0Sstevel@tonic-gate 
166*0Sstevel@tonic-gate #ifdef	__cplusplus
167*0Sstevel@tonic-gate }
168*0Sstevel@tonic-gate #endif
169*0Sstevel@tonic-gate 
170*0Sstevel@tonic-gate #endif	/* _AIO_H */
171