xref: /onnv-gate/usr/src/uts/common/sys/aiocb.h (revision 1885:7bbaa5935f99)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*1885Sraf  * Common Development and Distribution License (the "License").
6*1885Sraf  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
21*1885Sraf 
220Sstevel@tonic-gate /*
23*1885Sraf  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
240Sstevel@tonic-gate  * Use is subject to license terms.
250Sstevel@tonic-gate  */
260Sstevel@tonic-gate 
270Sstevel@tonic-gate #ifndef _SYS_AIOCB_H
280Sstevel@tonic-gate #define	_SYS_AIOCB_H
290Sstevel@tonic-gate 
300Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
310Sstevel@tonic-gate 
320Sstevel@tonic-gate #include <sys/types.h>
330Sstevel@tonic-gate #include <sys/fcntl.h>
340Sstevel@tonic-gate #include <sys/siginfo.h>
350Sstevel@tonic-gate #include <sys/aio.h>
360Sstevel@tonic-gate 
370Sstevel@tonic-gate #ifdef __cplusplus
380Sstevel@tonic-gate extern "C" {
390Sstevel@tonic-gate #endif
400Sstevel@tonic-gate 
410Sstevel@tonic-gate typedef struct aiocb {
420Sstevel@tonic-gate 	int 		aio_fildes;
430Sstevel@tonic-gate #if	defined(__STDC__)
440Sstevel@tonic-gate 	volatile void	*aio_buf;		/* buffer location */
450Sstevel@tonic-gate #else
460Sstevel@tonic-gate 	void		*aio_buf;		/* buffer location */
470Sstevel@tonic-gate #endif
480Sstevel@tonic-gate 	size_t 		aio_nbytes;		/* length of transfer */
490Sstevel@tonic-gate 	off_t 		aio_offset;		/* file offset */
500Sstevel@tonic-gate 	int		aio_reqprio;		/* request priority offset */
51*1885Sraf 	struct sigevent	aio_sigevent;		/* notification type */
520Sstevel@tonic-gate 	int 		aio_lio_opcode;		/* listio operation */
530Sstevel@tonic-gate 	aio_result_t	aio_resultp;		/* results */
540Sstevel@tonic-gate 	int 		aio_state;		/* state flag for List I/O */
550Sstevel@tonic-gate 	int		aio__pad[1];		/* extension padding */
560Sstevel@tonic-gate } aiocb_t;
570Sstevel@tonic-gate 
580Sstevel@tonic-gate #ifdef _LARGEFILE64_SOURCE
590Sstevel@tonic-gate #if	!defined(_KERNEL)
600Sstevel@tonic-gate typedef struct aiocb64 {
610Sstevel@tonic-gate 	int 		aio_fildes;
620Sstevel@tonic-gate #if	defined(__STDC__)
630Sstevel@tonic-gate 	volatile void	*aio_buf;		/* buffer location */
640Sstevel@tonic-gate #else
650Sstevel@tonic-gate 	void		*aio_buf;		/* buffer location */
660Sstevel@tonic-gate #endif
670Sstevel@tonic-gate 	size_t 		aio_nbytes;		/* length of transfer */
680Sstevel@tonic-gate 	off64_t		aio_offset;		/* file offset */
690Sstevel@tonic-gate 	int		aio_reqprio;		/* request priority offset */
70*1885Sraf 	struct sigevent	aio_sigevent;		/* notification type */
710Sstevel@tonic-gate 	int 		aio_lio_opcode;		/* listio operation */
720Sstevel@tonic-gate 	aio_result_t	aio_resultp;		/* results */
730Sstevel@tonic-gate 	int 		aio_state;		/* state flag for List I/O */
740Sstevel@tonic-gate 	int		aio__pad[1];		/* extension padding */
750Sstevel@tonic-gate } aiocb64_t;
760Sstevel@tonic-gate #else
770Sstevel@tonic-gate 
780Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
790Sstevel@tonic-gate #pragma pack(4)
800Sstevel@tonic-gate #endif
810Sstevel@tonic-gate 
820Sstevel@tonic-gate typedef struct aiocb64_32 {
830Sstevel@tonic-gate 	int 		aio_fildes;
840Sstevel@tonic-gate 	caddr32_t	aio_buf;		/* buffer location */
850Sstevel@tonic-gate 	uint32_t 	aio_nbytes;		/* length of transfer */
860Sstevel@tonic-gate 	off64_t 	aio_offset;		/* file offset */
870Sstevel@tonic-gate 	int		aio_reqprio;		/* request priority offset */
88*1885Sraf 	struct sigevent32 aio_sigevent;		/* notification type */
890Sstevel@tonic-gate 	int 		aio_lio_opcode;		/* listio operation */
900Sstevel@tonic-gate 	aio_result32_t	aio_resultp;		/* results */
910Sstevel@tonic-gate 	int 		aio_state;		/* state flag for List I/O */
920Sstevel@tonic-gate 	int		aio__pad[1];		/* extension padding */
930Sstevel@tonic-gate } aiocb64_32_t;
940Sstevel@tonic-gate 
950Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
960Sstevel@tonic-gate #pragma pack()
970Sstevel@tonic-gate #endif
980Sstevel@tonic-gate 
990Sstevel@tonic-gate #endif /* !defined(_KERNEL) */
1000Sstevel@tonic-gate #endif /* _LARGEFILE64_SOURCE */
1010Sstevel@tonic-gate 
1020Sstevel@tonic-gate #ifdef	_SYSCALL32
1030Sstevel@tonic-gate typedef struct aiocb32 {
1040Sstevel@tonic-gate 	int 		aio_fildes;
1050Sstevel@tonic-gate 	caddr32_t	aio_buf;		/* buffer location */
1060Sstevel@tonic-gate 	uint32_t	aio_nbytes;		/* length of transfer */
1070Sstevel@tonic-gate 	uint32_t	aio_offset;		/* file offset */
1080Sstevel@tonic-gate 	int		aio_reqprio;		/* request priority offset */
109*1885Sraf 	struct sigevent32 aio_sigevent;		/* notification type */
1100Sstevel@tonic-gate 	int 		aio_lio_opcode;		/* listio operation */
1110Sstevel@tonic-gate 	aio_result32_t	aio_resultp;		/* results */
1120Sstevel@tonic-gate 	int 		aio_state;		/* state flag for List I/O */
1130Sstevel@tonic-gate 	int		aio__pad[1];		/* extension padding */
1140Sstevel@tonic-gate } aiocb32_t;
1150Sstevel@tonic-gate 
1160Sstevel@tonic-gate #endif /* _SYSCALL32 */
1170Sstevel@tonic-gate /*
1180Sstevel@tonic-gate  * return values for aiocancel()
1190Sstevel@tonic-gate  */
1200Sstevel@tonic-gate #define	AIO_CANCELED	0
1210Sstevel@tonic-gate #define	AIO_ALLDONE	1
1220Sstevel@tonic-gate #define	AIO_NOTCANCELED	2
1230Sstevel@tonic-gate 
1240Sstevel@tonic-gate /*
1250Sstevel@tonic-gate  * mode values for lio_listio()
1260Sstevel@tonic-gate  */
1270Sstevel@tonic-gate #define	LIO_NOWAIT	0
1280Sstevel@tonic-gate #define	LIO_WAIT	1
1290Sstevel@tonic-gate 
1300Sstevel@tonic-gate 
1310Sstevel@tonic-gate /*
1320Sstevel@tonic-gate  * listio operation codes
1330Sstevel@tonic-gate  *
1340Sstevel@tonic-gate  * LIO_READ and LIO_WRITE were previously defined as FREAD and FWRITE as
1350Sstevel@tonic-gate  * defined in <sys/file.h>.  However, inclusion of <sys/file.h> results
1360Sstevel@tonic-gate  * in X/Open namespace pollution and as such is no longer included in
1370Sstevel@tonic-gate  * this header.  The values of LIO_READ and LIO_WRITE must be identical
1380Sstevel@tonic-gate  * to the values of FREAD and FWRITE in <sys/file.h>.  Any change to one
1390Sstevel@tonic-gate  * will require a change to the other.
1400Sstevel@tonic-gate  */
1410Sstevel@tonic-gate 
1420Sstevel@tonic-gate #define	LIO_NOP		0
1430Sstevel@tonic-gate #define	LIO_READ	0x01	/* Must match value of FREAD in sys/file.h */
1440Sstevel@tonic-gate #define	LIO_WRITE	0x02	/* Must match value of FWRITE in sys/file.h */
1450Sstevel@tonic-gate 
1460Sstevel@tonic-gate #ifdef	__cplusplus
1470Sstevel@tonic-gate }
1480Sstevel@tonic-gate #endif
1490Sstevel@tonic-gate 
1500Sstevel@tonic-gate #endif /* _SYS_AIOCB_H */
151