xref: /titanic_51/usr/src/uts/common/sys/aiocb.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 _SYS_AIOCB_H
28*7c478bd9Sstevel@tonic-gate #define	_SYS_AIOCB_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/types.h>
33*7c478bd9Sstevel@tonic-gate #include <sys/fcntl.h>
34*7c478bd9Sstevel@tonic-gate #include <sys/siginfo.h>
35*7c478bd9Sstevel@tonic-gate #include <sys/aio.h>
36*7c478bd9Sstevel@tonic-gate 
37*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus
38*7c478bd9Sstevel@tonic-gate extern "C" {
39*7c478bd9Sstevel@tonic-gate #endif
40*7c478bd9Sstevel@tonic-gate 
41*7c478bd9Sstevel@tonic-gate typedef struct aiocb {
42*7c478bd9Sstevel@tonic-gate 	int 		aio_fildes;
43*7c478bd9Sstevel@tonic-gate #if	defined(__STDC__)
44*7c478bd9Sstevel@tonic-gate 	volatile void	*aio_buf;		/* buffer location */
45*7c478bd9Sstevel@tonic-gate #else
46*7c478bd9Sstevel@tonic-gate 	void		*aio_buf;		/* buffer location */
47*7c478bd9Sstevel@tonic-gate #endif
48*7c478bd9Sstevel@tonic-gate 	size_t 		aio_nbytes;		/* length of transfer */
49*7c478bd9Sstevel@tonic-gate 	off_t 		aio_offset;		/* file offset */
50*7c478bd9Sstevel@tonic-gate 	int		aio_reqprio;		/* request priority offset */
51*7c478bd9Sstevel@tonic-gate 	struct sigevent	aio_sigevent;		/* signal number and offset */
52*7c478bd9Sstevel@tonic-gate 	int 		aio_lio_opcode;		/* listio operation */
53*7c478bd9Sstevel@tonic-gate 	aio_result_t	aio_resultp;		/* results */
54*7c478bd9Sstevel@tonic-gate 	int 		aio_state;		/* state flag for List I/O */
55*7c478bd9Sstevel@tonic-gate 	int		aio__pad[1];		/* extension padding */
56*7c478bd9Sstevel@tonic-gate } aiocb_t;
57*7c478bd9Sstevel@tonic-gate 
58*7c478bd9Sstevel@tonic-gate #ifdef _LARGEFILE64_SOURCE
59*7c478bd9Sstevel@tonic-gate #if	!defined(_KERNEL)
60*7c478bd9Sstevel@tonic-gate typedef struct aiocb64 {
61*7c478bd9Sstevel@tonic-gate 	int 		aio_fildes;
62*7c478bd9Sstevel@tonic-gate #if	defined(__STDC__)
63*7c478bd9Sstevel@tonic-gate 	volatile void	*aio_buf;		/* buffer location */
64*7c478bd9Sstevel@tonic-gate #else
65*7c478bd9Sstevel@tonic-gate 	void		*aio_buf;		/* buffer location */
66*7c478bd9Sstevel@tonic-gate #endif
67*7c478bd9Sstevel@tonic-gate 	size_t 		aio_nbytes;		/* length of transfer */
68*7c478bd9Sstevel@tonic-gate 	off64_t		aio_offset;		/* file offset */
69*7c478bd9Sstevel@tonic-gate 	int		aio_reqprio;		/* request priority offset */
70*7c478bd9Sstevel@tonic-gate 	struct sigevent	aio_sigevent;		/* signal number and offset */
71*7c478bd9Sstevel@tonic-gate 	int 		aio_lio_opcode;		/* listio operation */
72*7c478bd9Sstevel@tonic-gate 	aio_result_t	aio_resultp;		/* results */
73*7c478bd9Sstevel@tonic-gate 	int 		aio_state;		/* state flag for List I/O */
74*7c478bd9Sstevel@tonic-gate 	int		aio__pad[1];		/* extension padding */
75*7c478bd9Sstevel@tonic-gate } aiocb64_t;
76*7c478bd9Sstevel@tonic-gate #else
77*7c478bd9Sstevel@tonic-gate 
78*7c478bd9Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
79*7c478bd9Sstevel@tonic-gate #pragma pack(4)
80*7c478bd9Sstevel@tonic-gate #endif
81*7c478bd9Sstevel@tonic-gate 
82*7c478bd9Sstevel@tonic-gate typedef struct aiocb64_32 {
83*7c478bd9Sstevel@tonic-gate 	int 		aio_fildes;
84*7c478bd9Sstevel@tonic-gate 	caddr32_t	aio_buf;		/* buffer location */
85*7c478bd9Sstevel@tonic-gate 	uint32_t 	aio_nbytes;		/* length of transfer */
86*7c478bd9Sstevel@tonic-gate 	off64_t 	aio_offset;		/* file offset */
87*7c478bd9Sstevel@tonic-gate 	int		aio_reqprio;		/* request priority offset */
88*7c478bd9Sstevel@tonic-gate 	struct sigevent32 aio_sigevent;		/* signal number and offset */
89*7c478bd9Sstevel@tonic-gate 	int 		aio_lio_opcode;		/* listio operation */
90*7c478bd9Sstevel@tonic-gate 	aio_result32_t	aio_resultp;		/* results */
91*7c478bd9Sstevel@tonic-gate 	int 		aio_state;		/* state flag for List I/O */
92*7c478bd9Sstevel@tonic-gate 	int		aio__pad[1];		/* extension padding */
93*7c478bd9Sstevel@tonic-gate } aiocb64_32_t;
94*7c478bd9Sstevel@tonic-gate 
95*7c478bd9Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
96*7c478bd9Sstevel@tonic-gate #pragma pack()
97*7c478bd9Sstevel@tonic-gate #endif
98*7c478bd9Sstevel@tonic-gate 
99*7c478bd9Sstevel@tonic-gate #endif /* !defined(_KERNEL) */
100*7c478bd9Sstevel@tonic-gate #endif /* _LARGEFILE64_SOURCE */
101*7c478bd9Sstevel@tonic-gate 
102*7c478bd9Sstevel@tonic-gate #ifdef	_SYSCALL32
103*7c478bd9Sstevel@tonic-gate typedef struct aiocb32 {
104*7c478bd9Sstevel@tonic-gate 	int 		aio_fildes;
105*7c478bd9Sstevel@tonic-gate 	caddr32_t	aio_buf;		/* buffer location */
106*7c478bd9Sstevel@tonic-gate 	uint32_t	aio_nbytes;		/* length of transfer */
107*7c478bd9Sstevel@tonic-gate 	uint32_t	aio_offset;		/* file offset */
108*7c478bd9Sstevel@tonic-gate 	int		aio_reqprio;		/* request priority offset */
109*7c478bd9Sstevel@tonic-gate 	struct sigevent32 aio_sigevent;		/* signal number and offset */
110*7c478bd9Sstevel@tonic-gate 	int 		aio_lio_opcode;		/* listio operation */
111*7c478bd9Sstevel@tonic-gate 	aio_result32_t	aio_resultp;		/* results */
112*7c478bd9Sstevel@tonic-gate 	int 		aio_state;		/* state flag for List I/O */
113*7c478bd9Sstevel@tonic-gate 	int		aio__pad[1];		/* extension padding */
114*7c478bd9Sstevel@tonic-gate } aiocb32_t;
115*7c478bd9Sstevel@tonic-gate 
116*7c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */
117*7c478bd9Sstevel@tonic-gate /*
118*7c478bd9Sstevel@tonic-gate  * return values for aiocancel()
119*7c478bd9Sstevel@tonic-gate  */
120*7c478bd9Sstevel@tonic-gate #define	AIO_CANCELED	0
121*7c478bd9Sstevel@tonic-gate #define	AIO_ALLDONE	1
122*7c478bd9Sstevel@tonic-gate #define	AIO_NOTCANCELED	2
123*7c478bd9Sstevel@tonic-gate 
124*7c478bd9Sstevel@tonic-gate /*
125*7c478bd9Sstevel@tonic-gate  * mode values for lio_listio()
126*7c478bd9Sstevel@tonic-gate  */
127*7c478bd9Sstevel@tonic-gate #define	LIO_NOWAIT	0
128*7c478bd9Sstevel@tonic-gate #define	LIO_WAIT	1
129*7c478bd9Sstevel@tonic-gate 
130*7c478bd9Sstevel@tonic-gate 
131*7c478bd9Sstevel@tonic-gate /*
132*7c478bd9Sstevel@tonic-gate  * listio operation codes
133*7c478bd9Sstevel@tonic-gate  *
134*7c478bd9Sstevel@tonic-gate  * LIO_READ and LIO_WRITE were previously defined as FREAD and FWRITE as
135*7c478bd9Sstevel@tonic-gate  * defined in <sys/file.h>.  However, inclusion of <sys/file.h> results
136*7c478bd9Sstevel@tonic-gate  * in X/Open namespace pollution and as such is no longer included in
137*7c478bd9Sstevel@tonic-gate  * this header.  The values of LIO_READ and LIO_WRITE must be identical
138*7c478bd9Sstevel@tonic-gate  * to the values of FREAD and FWRITE in <sys/file.h>.  Any change to one
139*7c478bd9Sstevel@tonic-gate  * will require a change to the other.
140*7c478bd9Sstevel@tonic-gate  */
141*7c478bd9Sstevel@tonic-gate 
142*7c478bd9Sstevel@tonic-gate #define	LIO_NOP		0
143*7c478bd9Sstevel@tonic-gate #define	LIO_READ	0x01	/* Must match value of FREAD in sys/file.h */
144*7c478bd9Sstevel@tonic-gate #define	LIO_WRITE	0x02	/* Must match value of FWRITE in sys/file.h */
145*7c478bd9Sstevel@tonic-gate 
146*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
147*7c478bd9Sstevel@tonic-gate }
148*7c478bd9Sstevel@tonic-gate #endif
149*7c478bd9Sstevel@tonic-gate 
150*7c478bd9Sstevel@tonic-gate #endif /* _SYS_AIOCB_H */
151