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