X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/e5568f75972dfc723778653c11cb6b4dc825716a..bd504ef0e0b883cdd7917b73b3574eb9ce669905:/bsd/sys/aio.h?ds=sidebyside diff --git a/bsd/sys/aio.h b/bsd/sys/aio.h index 57b3e3d17..d4f7e7a68 100644 --- a/bsd/sys/aio.h +++ b/bsd/sys/aio.h @@ -1,23 +1,29 @@ /* - * Copyright (c) 2003 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2003-2006 Apple Computer, Inc. All rights reserved. * - * @APPLE_LICENSE_HEADER_START@ + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * - * The contents of this file constitute Original Code as defined in and - * are subject to the Apple Public Source License Version 1.1 (the - * "License"). You may not use this file except in compliance with the - * License. Please obtain a copy of the License at - * http://www.apple.com/publicsource and read it before using this file. + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. * - * This Original Code and all software distributed under the License are - * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the - * License for the specific language governing rights and limitations - * under the License. + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. * - * @APPLE_LICENSE_HEADER_END@ + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ /* * File: sys/aio.h @@ -32,17 +38,92 @@ #define _SYS_AIO_H_ #include +#include +#include + +/* + * [XSI] Inclusion of the header may make visible symbols defined + * in the headers , , , and . + * + * In our case, this is limited to struct timespec, off_t and ssize_t. + */ +#define __need_struct_timespec +#ifdef KERNEL +#define __need_struct_user64_timespec +#define __need_struct_user32_timespec +#endif /* KERNEL */ +#include + +#ifndef _OFF_T +typedef __darwin_off_t off_t; +#define _OFF_T +#endif + +#ifndef _SSIZE_T +#define _SSIZE_T +typedef __darwin_ssize_t ssize_t; +#endif + +/* + * A aio_fsync() options that the calling thread is to continue execution + * while the lio_listio() operation is being performed, and no notification + * is given when the operation is complete + * + * [XSI] from + */ +#ifndef O_SYNC /* allow simultaneous inclusion of */ +#define O_SYNC 0x0080 /* synch I/O file integrity */ +#endif + +#ifndef O_DSYNC /* allow simultaneous inclusion of */ +#define O_DSYNC 0x400000 /* synch I/O data integrity */ +#endif + struct aiocb { - int aio_fildes; /* File descriptor */ - off_t aio_offset; /* File offset */ - volatile void *aio_buf; /* Location of buffer */ - size_t aio_nbytes; /* Length of transfer */ - int aio_reqprio; /* Request priority offset */ - struct sigevent aio_sigevent; /* Signal number and value */ - int aio_lio_opcode; /* Operation to be performed */ + int aio_fildes; /* File descriptor */ + off_t aio_offset; /* File offset */ + volatile void *aio_buf; /* Location of buffer */ + size_t aio_nbytes; /* Length of transfer */ + int aio_reqprio; /* Request priority offset */ + struct sigevent aio_sigevent; /* Signal number and value */ + int aio_lio_opcode; /* Operation to be performed */ }; +#ifdef KERNEL + +struct user_aiocb { + int aio_fildes; /* File descriptor */ + off_t aio_offset; /* File offset */ + user_addr_t aio_buf; /* Location of buffer */ + user_size_t aio_nbytes; /* Length of transfer */ + int aio_reqprio; /* Request priority offset */ + struct user_sigevent aio_sigevent; /* Signal number and value */ + int aio_lio_opcode; /* Operation to be performed */ +}; + +struct user64_aiocb { + int aio_fildes; /* File descriptor */ + user64_off_t aio_offset; /* File offset */ + user64_addr_t aio_buf; /* Location of buffer */ + user64_size_t aio_nbytes; /* Length of transfer */ + int aio_reqprio; /* Request priority offset */ + struct user64_sigevent aio_sigevent; /* Signal number and value */ + int aio_lio_opcode; /* Operation to be performed */ +}; + +struct user32_aiocb { + int aio_fildes; /* File descriptor */ + user32_off_t aio_offset; /* File offset */ + user32_addr_t aio_buf; /* Location of buffer */ + user32_size_t aio_nbytes; /* Length of transfer */ + int aio_reqprio; /* Request priority offset */ + struct user32_sigevent aio_sigevent; /* Signal number and value */ + int aio_lio_opcode; /* Operation to be performed */ +}; + +#endif // KERNEL + /* * aio_cancel() return values */ @@ -95,23 +176,14 @@ struct aiocb { */ #define AIO_LISTIO_MAX 16 -/* - * A aio_fsync() options - * that the calling thread is to continue execution while - * the lio_listio() operation is being performed, and no - * notification is given when the operation is complete - */ - -#define O_SYNC 0x0 /* queued IO is completed as if by fsync() */ -#if 0 /* O_DSYNC - NOT SUPPORTED */ -#define O_DSYNC 0x1 /* queued async IO is completed as if by fdatasync() */ -#endif #ifndef KERNEL /* * Prototypes */ +__BEGIN_DECLS + /* * Attempt to cancel one or more asynchronous I/O requests currently outstanding * against file descriptor fd. The aiocbp argument points to the asynchronous I/O @@ -195,7 +267,7 @@ ssize_t aio_return( struct aiocb * aiocbp ); */ int aio_suspend( const struct aiocb *const aiocblist[], int nent, - const struct timespec * timeoutp ); + const struct timespec * timeoutp ) __DARWIN_ALIAS_C(aio_suspend); /* * Write aiocbp->aio_nbytes to the file associated with aiocbp->aio_fildes from @@ -223,5 +295,7 @@ int lio_listio( int mode, struct aiocb *const aiocblist[], int nent, struct sigevent *sigp ); +__END_DECLS + #endif /* KERNEL */ #endif /* _SYS_AIO_H_ */