xref: /illumos-gate/usr/src/uts/common/sys/aiocb.h (revision ba3594ba)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
534709573Sraf  * Common Development and Distribution License (the "License").
634709573Sraf  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
2134709573Sraf 
227c478bd9Sstevel@tonic-gate /*
23*ba3594baSGarrett D'Amore  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
24*ba3594baSGarrett D'Amore  *
2534709573Sraf  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
267c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
277c478bd9Sstevel@tonic-gate  */
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #ifndef _SYS_AIOCB_H
307c478bd9Sstevel@tonic-gate #define	_SYS_AIOCB_H
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate #include <sys/types.h>
337c478bd9Sstevel@tonic-gate #include <sys/fcntl.h>
347c478bd9Sstevel@tonic-gate #include <sys/siginfo.h>
357c478bd9Sstevel@tonic-gate #include <sys/aio.h>
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate #ifdef __cplusplus
387c478bd9Sstevel@tonic-gate extern "C" {
397c478bd9Sstevel@tonic-gate #endif
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate typedef struct aiocb {
427c478bd9Sstevel@tonic-gate 	int 		aio_fildes;
437c478bd9Sstevel@tonic-gate 	volatile void	*aio_buf;		/* buffer location */
447c478bd9Sstevel@tonic-gate 	size_t 		aio_nbytes;		/* length of transfer */
457c478bd9Sstevel@tonic-gate 	off_t 		aio_offset;		/* file offset */
467c478bd9Sstevel@tonic-gate 	int		aio_reqprio;		/* request priority offset */
4734709573Sraf 	struct sigevent	aio_sigevent;		/* notification type */
487c478bd9Sstevel@tonic-gate 	int 		aio_lio_opcode;		/* listio operation */
497c478bd9Sstevel@tonic-gate 	aio_result_t	aio_resultp;		/* results */
507c478bd9Sstevel@tonic-gate 	int 		aio_state;		/* state flag for List I/O */
517c478bd9Sstevel@tonic-gate 	int		aio__pad[1];		/* extension padding */
527c478bd9Sstevel@tonic-gate } aiocb_t;
537c478bd9Sstevel@tonic-gate 
547c478bd9Sstevel@tonic-gate #ifdef _LARGEFILE64_SOURCE
557c478bd9Sstevel@tonic-gate #if	!defined(_KERNEL)
567c478bd9Sstevel@tonic-gate typedef struct aiocb64 {
577c478bd9Sstevel@tonic-gate 	int 		aio_fildes;
587c478bd9Sstevel@tonic-gate 	volatile void	*aio_buf;		/* buffer location */
597c478bd9Sstevel@tonic-gate 	size_t 		aio_nbytes;		/* length of transfer */
607c478bd9Sstevel@tonic-gate 	off64_t		aio_offset;		/* file offset */
617c478bd9Sstevel@tonic-gate 	int		aio_reqprio;		/* request priority offset */
6234709573Sraf 	struct sigevent	aio_sigevent;		/* notification type */
637c478bd9Sstevel@tonic-gate 	int 		aio_lio_opcode;		/* listio operation */
647c478bd9Sstevel@tonic-gate 	aio_result_t	aio_resultp;		/* results */
657c478bd9Sstevel@tonic-gate 	int 		aio_state;		/* state flag for List I/O */
667c478bd9Sstevel@tonic-gate 	int		aio__pad[1];		/* extension padding */
677c478bd9Sstevel@tonic-gate } aiocb64_t;
687c478bd9Sstevel@tonic-gate #else
697c478bd9Sstevel@tonic-gate 
707c478bd9Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
717c478bd9Sstevel@tonic-gate #pragma pack(4)
727c478bd9Sstevel@tonic-gate #endif
737c478bd9Sstevel@tonic-gate 
747c478bd9Sstevel@tonic-gate typedef struct aiocb64_32 {
757c478bd9Sstevel@tonic-gate 	int 		aio_fildes;
767c478bd9Sstevel@tonic-gate 	caddr32_t	aio_buf;		/* buffer location */
777c478bd9Sstevel@tonic-gate 	uint32_t 	aio_nbytes;		/* length of transfer */
787c478bd9Sstevel@tonic-gate 	off64_t 	aio_offset;		/* file offset */
797c478bd9Sstevel@tonic-gate 	int		aio_reqprio;		/* request priority offset */
8034709573Sraf 	struct sigevent32 aio_sigevent;		/* notification type */
817c478bd9Sstevel@tonic-gate 	int 		aio_lio_opcode;		/* listio operation */
827c478bd9Sstevel@tonic-gate 	aio_result32_t	aio_resultp;		/* results */
837c478bd9Sstevel@tonic-gate 	int 		aio_state;		/* state flag for List I/O */
847c478bd9Sstevel@tonic-gate 	int		aio__pad[1];		/* extension padding */
857c478bd9Sstevel@tonic-gate } aiocb64_32_t;
867c478bd9Sstevel@tonic-gate 
877c478bd9Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
887c478bd9Sstevel@tonic-gate #pragma pack()
897c478bd9Sstevel@tonic-gate #endif
907c478bd9Sstevel@tonic-gate 
917c478bd9Sstevel@tonic-gate #endif /* !defined(_KERNEL) */
927c478bd9Sstevel@tonic-gate #endif /* _LARGEFILE64_SOURCE */
937c478bd9Sstevel@tonic-gate 
947c478bd9Sstevel@tonic-gate #ifdef	_SYSCALL32
957c478bd9Sstevel@tonic-gate typedef struct aiocb32 {
967c478bd9Sstevel@tonic-gate 	int 		aio_fildes;
977c478bd9Sstevel@tonic-gate 	caddr32_t	aio_buf;		/* buffer location */
987c478bd9Sstevel@tonic-gate 	uint32_t	aio_nbytes;		/* length of transfer */
997c478bd9Sstevel@tonic-gate 	uint32_t	aio_offset;		/* file offset */
1007c478bd9Sstevel@tonic-gate 	int		aio_reqprio;		/* request priority offset */
10134709573Sraf 	struct sigevent32 aio_sigevent;		/* notification type */
1027c478bd9Sstevel@tonic-gate 	int 		aio_lio_opcode;		/* listio operation */
1037c478bd9Sstevel@tonic-gate 	aio_result32_t	aio_resultp;		/* results */
1047c478bd9Sstevel@tonic-gate 	int 		aio_state;		/* state flag for List I/O */
1057c478bd9Sstevel@tonic-gate 	int		aio__pad[1];		/* extension padding */
1067c478bd9Sstevel@tonic-gate } aiocb32_t;
1077c478bd9Sstevel@tonic-gate 
1087c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */
1097c478bd9Sstevel@tonic-gate /*
1107c478bd9Sstevel@tonic-gate  * return values for aiocancel()
1117c478bd9Sstevel@tonic-gate  */
1127c478bd9Sstevel@tonic-gate #define	AIO_CANCELED	0
1137c478bd9Sstevel@tonic-gate #define	AIO_ALLDONE	1
1147c478bd9Sstevel@tonic-gate #define	AIO_NOTCANCELED	2
1157c478bd9Sstevel@tonic-gate 
1167c478bd9Sstevel@tonic-gate /*
1177c478bd9Sstevel@tonic-gate  * mode values for lio_listio()
1187c478bd9Sstevel@tonic-gate  */
1197c478bd9Sstevel@tonic-gate #define	LIO_NOWAIT	0
1207c478bd9Sstevel@tonic-gate #define	LIO_WAIT	1
1217c478bd9Sstevel@tonic-gate 
1227c478bd9Sstevel@tonic-gate 
1237c478bd9Sstevel@tonic-gate /*
1247c478bd9Sstevel@tonic-gate  * listio operation codes
1257c478bd9Sstevel@tonic-gate  *
1267c478bd9Sstevel@tonic-gate  * LIO_READ and LIO_WRITE were previously defined as FREAD and FWRITE as
1277c478bd9Sstevel@tonic-gate  * defined in <sys/file.h>.  However, inclusion of <sys/file.h> results
1287c478bd9Sstevel@tonic-gate  * in X/Open namespace pollution and as such is no longer included in
1297c478bd9Sstevel@tonic-gate  * this header.  The values of LIO_READ and LIO_WRITE must be identical
1307c478bd9Sstevel@tonic-gate  * to the values of FREAD and FWRITE in <sys/file.h>.  Any change to one
1317c478bd9Sstevel@tonic-gate  * will require a change to the other.
1327c478bd9Sstevel@tonic-gate  */
1337c478bd9Sstevel@tonic-gate 
1347c478bd9Sstevel@tonic-gate #define	LIO_NOP		0
1357c478bd9Sstevel@tonic-gate #define	LIO_READ	0x01	/* Must match value of FREAD in sys/file.h */
1367c478bd9Sstevel@tonic-gate #define	LIO_WRITE	0x02	/* Must match value of FWRITE in sys/file.h */
1377c478bd9Sstevel@tonic-gate 
1387c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1397c478bd9Sstevel@tonic-gate }
1407c478bd9Sstevel@tonic-gate #endif
1417c478bd9Sstevel@tonic-gate 
1427c478bd9Sstevel@tonic-gate #endif /* _SYS_AIOCB_H */
143