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 57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 77c478bd9Sstevel@tonic-gate * with the License. 87c478bd9Sstevel@tonic-gate * 97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate * and limitations under the License. 137c478bd9Sstevel@tonic-gate * 147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * CDDL HEADER END 217c478bd9Sstevel@tonic-gate */ 227c478bd9Sstevel@tonic-gate /* 23*ba3594baSGarrett D'Amore * Copyright 2014 Garrett D'Amore <garrett@damore.org> 24*ba3594baSGarrett D'Amore * 257c478bd9Sstevel@tonic-gate * Copyright 2004 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 _AIO_H 307c478bd9Sstevel@tonic-gate #define _AIO_H 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h> 337c478bd9Sstevel@tonic-gate #include <sys/types.h> 347c478bd9Sstevel@tonic-gate #include <sys/fcntl.h> 357c478bd9Sstevel@tonic-gate #include <sys/siginfo.h> 367c478bd9Sstevel@tonic-gate #include <sys/aiocb.h> 377c478bd9Sstevel@tonic-gate #include <time.h> 387c478bd9Sstevel@tonic-gate 397c478bd9Sstevel@tonic-gate #ifdef __cplusplus 407c478bd9Sstevel@tonic-gate extern "C" { 417c478bd9Sstevel@tonic-gate #endif 427c478bd9Sstevel@tonic-gate 437c478bd9Sstevel@tonic-gate #if (_POSIX_C_SOURCE - 0 > 0) && (_POSIX_C_SOURCE - 0 <= 2) 447c478bd9Sstevel@tonic-gate #error "POSIX Asynchronous I/O is not supported in POSIX.1-1990" 457c478bd9Sstevel@tonic-gate #endif 467c478bd9Sstevel@tonic-gate 477c478bd9Sstevel@tonic-gate /* large file compilation environment setup */ 487c478bd9Sstevel@tonic-gate #if !defined(_LP64) && _FILE_OFFSET_BITS == 64 497c478bd9Sstevel@tonic-gate #ifdef __PRAGMA_REDEFINE_EXTNAME 507c478bd9Sstevel@tonic-gate #pragma redefine_extname aio_read aio_read64 517c478bd9Sstevel@tonic-gate #pragma redefine_extname aio_write aio_write64 527c478bd9Sstevel@tonic-gate #pragma redefine_extname lio_listio lio_listio64 537c478bd9Sstevel@tonic-gate #pragma redefine_extname aio_error aio_error64 547c478bd9Sstevel@tonic-gate #pragma redefine_extname aio_return aio_return64 557c478bd9Sstevel@tonic-gate #pragma redefine_extname aio_cancel aio_cancel64 567c478bd9Sstevel@tonic-gate #pragma redefine_extname aio_suspend aio_suspend64 577c478bd9Sstevel@tonic-gate #pragma redefine_extname aio_fsync aio_fsync64 587c478bd9Sstevel@tonic-gate #pragma redefine_extname aio_waitn aio_waitn64 597c478bd9Sstevel@tonic-gate #else 607c478bd9Sstevel@tonic-gate #define aiocb aiocb64 617c478bd9Sstevel@tonic-gate #define aiocb_t aiocb64_t 627c478bd9Sstevel@tonic-gate #define aio_read aio_read64 637c478bd9Sstevel@tonic-gate #define aio_write aio_write64 647c478bd9Sstevel@tonic-gate #define lio_listio lio_listio64 657c478bd9Sstevel@tonic-gate #define aio_error aio_error64 667c478bd9Sstevel@tonic-gate #define aio_return aio_return64 677c478bd9Sstevel@tonic-gate #define aio_cancel aio_cancel64 687c478bd9Sstevel@tonic-gate #define aio_suspend aio_suspend64 697c478bd9Sstevel@tonic-gate #define aio_fsync aio_fsync64 707c478bd9Sstevel@tonic-gate #define aio_waitn aio_waitn64 717c478bd9Sstevel@tonic-gate #endif 727c478bd9Sstevel@tonic-gate #endif /* !_LP64 && _FILE_OFFSET_BITS == 64 */ 737c478bd9Sstevel@tonic-gate 747c478bd9Sstevel@tonic-gate #if defined(_LP64) && defined(_LARGEFILE64_SOURCE) 757c478bd9Sstevel@tonic-gate /* 767c478bd9Sstevel@tonic-gate * In the LP64 compilation environment, map the 64-bit-explicit versions 777c478bd9Sstevel@tonic-gate * back to the generic versions: all i/o operations are already "large file" 787c478bd9Sstevel@tonic-gate */ 797c478bd9Sstevel@tonic-gate #ifdef __PRAGMA_REDEFINE_EXTNAME 807c478bd9Sstevel@tonic-gate #pragma redefine_extname aio_read64 aio_read 817c478bd9Sstevel@tonic-gate #pragma redefine_extname aio_write64 aio_write 827c478bd9Sstevel@tonic-gate #pragma redefine_extname lio_listio64 lio_listio 837c478bd9Sstevel@tonic-gate #pragma redefine_extname aio_error64 aio_error 847c478bd9Sstevel@tonic-gate #pragma redefine_extname aio_return64 aio_return 857c478bd9Sstevel@tonic-gate #pragma redefine_extname aio_cancel64 aio_cancel 867c478bd9Sstevel@tonic-gate #pragma redefine_extname aio_suspend64 aio_suspend 877c478bd9Sstevel@tonic-gate #pragma redefine_extname aio_fsync64 aio_fsync 887c478bd9Sstevel@tonic-gate #pragma redefine_extname aio_waitn64 aio_waitn 897c478bd9Sstevel@tonic-gate #else 907c478bd9Sstevel@tonic-gate #define aiocb64 aiocb 917c478bd9Sstevel@tonic-gate #define aiocb64_t aiocb_t 927c478bd9Sstevel@tonic-gate #define aio_read64 aio_read 937c478bd9Sstevel@tonic-gate #define aio_write64 aio_write 947c478bd9Sstevel@tonic-gate #define lio_listio64 lio_listio 957c478bd9Sstevel@tonic-gate #define aio_error64 aio_error 967c478bd9Sstevel@tonic-gate #define aio_return64 aio_return 977c478bd9Sstevel@tonic-gate #define aio_cancel64 aio_cancel 987c478bd9Sstevel@tonic-gate #define aio_suspend64 aio_suspend 997c478bd9Sstevel@tonic-gate #define aio_fsync64 aio_fsync 1007c478bd9Sstevel@tonic-gate #define aio_waitn64 aio_waitn 1017c478bd9Sstevel@tonic-gate #endif 1027c478bd9Sstevel@tonic-gate #endif /* _LP64 && _LARGEFILE64_SOURCE */ 1037c478bd9Sstevel@tonic-gate 1047c478bd9Sstevel@tonic-gate /* 1057c478bd9Sstevel@tonic-gate * function prototypes 1067c478bd9Sstevel@tonic-gate */ 1077c478bd9Sstevel@tonic-gate extern int aio_read(aiocb_t *); 1087c478bd9Sstevel@tonic-gate extern int aio_write(aiocb_t *); 1097c478bd9Sstevel@tonic-gate extern int lio_listio(int, 1107c478bd9Sstevel@tonic-gate aiocb_t *_RESTRICT_KYWD const *_RESTRICT_KYWD, 1117c478bd9Sstevel@tonic-gate int, struct sigevent *_RESTRICT_KYWD); 1127c478bd9Sstevel@tonic-gate extern int aio_error(const aiocb_t *); 1137c478bd9Sstevel@tonic-gate extern ssize_t aio_return(aiocb_t *); 1147c478bd9Sstevel@tonic-gate extern int aio_cancel(int, aiocb_t *); 1157c478bd9Sstevel@tonic-gate extern int aio_suspend(const aiocb_t *const[], int, 1167c478bd9Sstevel@tonic-gate const struct timespec *); 1177c478bd9Sstevel@tonic-gate extern int aio_fsync(int, aiocb_t *); 1187c478bd9Sstevel@tonic-gate extern int aio_waitn(aiocb_t *[], uint_t, uint_t *, 1197c478bd9Sstevel@tonic-gate const struct timespec *); 1207c478bd9Sstevel@tonic-gate 1217c478bd9Sstevel@tonic-gate 1227c478bd9Sstevel@tonic-gate #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ 1237c478bd9Sstevel@tonic-gate !defined(__PRAGMA_REDEFINE_EXTNAME)) 1247c478bd9Sstevel@tonic-gate extern int aio_read64(aiocb64_t *); 1257c478bd9Sstevel@tonic-gate extern int aio_write64(aiocb64_t *); 1267c478bd9Sstevel@tonic-gate extern int lio_listio64(int, 1277c478bd9Sstevel@tonic-gate aiocb64_t *_RESTRICT_KYWD const *_RESTRICT_KYWD, 1287c478bd9Sstevel@tonic-gate int, struct sigevent *_RESTRICT_KYWD); 1297c478bd9Sstevel@tonic-gate extern int aio_error64(const aiocb64_t *); 1307c478bd9Sstevel@tonic-gate extern ssize_t aio_return64(aiocb64_t *); 1317c478bd9Sstevel@tonic-gate extern int aio_cancel64(int, aiocb64_t *); 1327c478bd9Sstevel@tonic-gate extern int aio_suspend64(const aiocb64_t *const[], int, 1337c478bd9Sstevel@tonic-gate const struct timespec *); 1347c478bd9Sstevel@tonic-gate extern int aio_fsync64(int, aiocb64_t *); 1357c478bd9Sstevel@tonic-gate extern int aio_waitn64(aiocb64_t *[], uint_t, uint_t *, 1367c478bd9Sstevel@tonic-gate const struct timespec *); 1377c478bd9Sstevel@tonic-gate #endif /* _LARGEFILE64_SOURCE */ 1387c478bd9Sstevel@tonic-gate 1397c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1407c478bd9Sstevel@tonic-gate } 1417c478bd9Sstevel@tonic-gate #endif 1427c478bd9Sstevel@tonic-gate 1437c478bd9Sstevel@tonic-gate #endif /* _AIO_H */ 144