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 55b024a5bSbatschul * Common Development and Distribution License (the "License"). 65b024a5bSbatschul * 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 */ 21019c3c43Sraf 227c478bd9Sstevel@tonic-gate /* 23*ba3594baSGarrett D'Amore * Copyright 2014 Garrett D'Amore <garrett@damore.org> 24*ba3594baSGarrett D'Amore * 25019c3c43Sraf * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 267c478bd9Sstevel@tonic-gate * Use is subject to license terms. 277c478bd9Sstevel@tonic-gate */ 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate /* Copyright (c) 1988 AT&T */ 307c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate #ifndef _FCNTL_H 337c478bd9Sstevel@tonic-gate #define _FCNTL_H 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h> 367c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || defined(_XPG4) 377c478bd9Sstevel@tonic-gate #include <sys/stat.h> 387c478bd9Sstevel@tonic-gate #endif 397c478bd9Sstevel@tonic-gate #include <sys/types.h> 407c478bd9Sstevel@tonic-gate #include <sys/fcntl.h> 417c478bd9Sstevel@tonic-gate 427c478bd9Sstevel@tonic-gate #ifdef __cplusplus 437c478bd9Sstevel@tonic-gate extern "C" { 447c478bd9Sstevel@tonic-gate #endif 457c478bd9Sstevel@tonic-gate 467c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || defined(_XPG4) 477c478bd9Sstevel@tonic-gate 487c478bd9Sstevel@tonic-gate /* Symbolic constants for the "lseek" routine. */ 497c478bd9Sstevel@tonic-gate 507c478bd9Sstevel@tonic-gate #ifndef SEEK_SET 517c478bd9Sstevel@tonic-gate #define SEEK_SET 0 /* Set file pointer to "offset" */ 527c478bd9Sstevel@tonic-gate #endif 537c478bd9Sstevel@tonic-gate 547c478bd9Sstevel@tonic-gate #ifndef SEEK_CUR 557c478bd9Sstevel@tonic-gate #define SEEK_CUR 1 /* Set file pointer to current plus "offset" */ 567c478bd9Sstevel@tonic-gate #endif 577c478bd9Sstevel@tonic-gate 587c478bd9Sstevel@tonic-gate #ifndef SEEK_END 597c478bd9Sstevel@tonic-gate #define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ 607c478bd9Sstevel@tonic-gate #endif 617c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || defined(_XPG4) */ 627c478bd9Sstevel@tonic-gate 637c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 647c478bd9Sstevel@tonic-gate #ifndef SEEK_DATA 657c478bd9Sstevel@tonic-gate #define SEEK_DATA 3 /* Set file pointer to next data past offset */ 667c478bd9Sstevel@tonic-gate #endif 677c478bd9Sstevel@tonic-gate 687c478bd9Sstevel@tonic-gate #ifndef SEEK_HOLE 697c478bd9Sstevel@tonic-gate #define SEEK_HOLE 4 /* Set file pointer to next hole past offset */ 707c478bd9Sstevel@tonic-gate #endif 717c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 727c478bd9Sstevel@tonic-gate 737c478bd9Sstevel@tonic-gate 747c478bd9Sstevel@tonic-gate /* large file compilation environment setup */ 757c478bd9Sstevel@tonic-gate #if !defined(_LP64) && _FILE_OFFSET_BITS == 64 767c478bd9Sstevel@tonic-gate #ifdef __PRAGMA_REDEFINE_EXTNAME 777c478bd9Sstevel@tonic-gate #pragma redefine_extname open open64 787c478bd9Sstevel@tonic-gate #pragma redefine_extname creat creat64 79019c3c43Sraf #if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__) 80019c3c43Sraf #pragma redefine_extname posix_fadvise posix_fadvise64 81303bf60bSsdebnath #pragma redefine_extname posix_fallocate posix_fallocate64 82019c3c43Sraf #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || ... */ 837c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \ 847c478bd9Sstevel@tonic-gate defined(_ATFILE_SOURCE) 857c478bd9Sstevel@tonic-gate #pragma redefine_extname openat openat64 867c478bd9Sstevel@tonic-gate #pragma redefine_extname attropen attropen64 877c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) ... */ 887c478bd9Sstevel@tonic-gate #else 897c478bd9Sstevel@tonic-gate #define open open64 907c478bd9Sstevel@tonic-gate #define creat creat64 91019c3c43Sraf #if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__) 92019c3c43Sraf #define posix_fadvise posix_fadvise64 93303bf60bSsdebnath #define posix_fallocate posix_fallocate64 94019c3c43Sraf #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || ... */ 957c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \ 967c478bd9Sstevel@tonic-gate defined(_ATFILE_SOURCE) 977c478bd9Sstevel@tonic-gate #define openat openat64 987c478bd9Sstevel@tonic-gate #define attropen attropen64 997c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) ... */ 1007c478bd9Sstevel@tonic-gate #endif 1017c478bd9Sstevel@tonic-gate #endif /* !_LP64 && _FILE_OFFSET_BITS == 64 */ 1027c478bd9Sstevel@tonic-gate 1037c478bd9Sstevel@tonic-gate #if defined(_LP64) && defined(_LARGEFILE64_SOURCE) 1047c478bd9Sstevel@tonic-gate #ifdef __PRAGMA_REDEFINE_EXTNAME 1057c478bd9Sstevel@tonic-gate #pragma redefine_extname open64 open 1067c478bd9Sstevel@tonic-gate #pragma redefine_extname creat64 creat 107019c3c43Sraf #if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__) 108019c3c43Sraf #pragma redefine_extname posix_fadvise64 posix_fadvise 109303bf60bSsdebnath #pragma redefine_extname posix_fallocate64 posix_fallocate 110019c3c43Sraf #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || ... */ 1117c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \ 1127c478bd9Sstevel@tonic-gate defined(_ATFILE_SOURCE) 1137c478bd9Sstevel@tonic-gate #pragma redefine_extname openat64 openat 1147c478bd9Sstevel@tonic-gate #pragma redefine_extname attropen64 attropen 1157c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) ... */ 1167c478bd9Sstevel@tonic-gate #else 1177c478bd9Sstevel@tonic-gate #define open64 open 1187c478bd9Sstevel@tonic-gate #define creat64 creat 119019c3c43Sraf #if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__) 120019c3c43Sraf #define posix_fadvise64 posix_fadvise 121303bf60bSsdebnath #define posix_fallocate64 posix_fallocate 122019c3c43Sraf #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || ... */ 1237c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \ 1247c478bd9Sstevel@tonic-gate defined(_ATFILE_SOURCE) 1257c478bd9Sstevel@tonic-gate #define openat64 openat 1267c478bd9Sstevel@tonic-gate #define attropen64 attropen 1277c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) ... */ 1287c478bd9Sstevel@tonic-gate #endif 1297c478bd9Sstevel@tonic-gate #endif /* _LP64 && _LARGEFILE64_SOURCE */ 1307c478bd9Sstevel@tonic-gate 1317c478bd9Sstevel@tonic-gate extern int fcntl(int, int, ...); 1327c478bd9Sstevel@tonic-gate extern int open(const char *, int, ...); 1337c478bd9Sstevel@tonic-gate extern int creat(const char *, mode_t); 134019c3c43Sraf #if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__) 135019c3c43Sraf extern int posix_fadvise(int, off_t, off_t, int); 1365b024a5bSbatschul extern int posix_fallocate(int, off_t, off_t); 137019c3c43Sraf #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || ... */ 1387c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \ 1397c478bd9Sstevel@tonic-gate defined(_ATFILE_SOURCE) 1407c478bd9Sstevel@tonic-gate extern int openat(int, const char *, int, ...); 1417c478bd9Sstevel@tonic-gate extern int attropen(const char *, const char *, int, ...); 1427c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) ... */ 1437c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) 1447c478bd9Sstevel@tonic-gate extern int directio(int, int); 1457c478bd9Sstevel@tonic-gate #endif 1467c478bd9Sstevel@tonic-gate 1477c478bd9Sstevel@tonic-gate /* transitional large file interface versions */ 1487c478bd9Sstevel@tonic-gate #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ 1497c478bd9Sstevel@tonic-gate !defined(__PRAGMA_REDEFINE_EXTNAME)) 1507c478bd9Sstevel@tonic-gate extern int open64(const char *, int, ...); 1517c478bd9Sstevel@tonic-gate extern int creat64(const char *, mode_t); 152019c3c43Sraf #if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__) 153019c3c43Sraf extern int posix_fadvise64(int, off64_t, off64_t, int); 1545b024a5bSbatschul extern int posix_fallocate64(int, off64_t, off64_t); 155019c3c43Sraf #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || ... */ 1567c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \ 1577c478bd9Sstevel@tonic-gate defined(_ATFILE_SOURCE) 1587c478bd9Sstevel@tonic-gate extern int openat64(int, const char *, int, ...); 1597c478bd9Sstevel@tonic-gate extern int attropen64(const char *, const char *, int, ...); 1607c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) ... */ 1617c478bd9Sstevel@tonic-gate #endif 1627c478bd9Sstevel@tonic-gate 1637c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1647c478bd9Sstevel@tonic-gate } 1657c478bd9Sstevel@tonic-gate #endif 1667c478bd9Sstevel@tonic-gate 1677c478bd9Sstevel@tonic-gate #endif /* _FCNTL_H */ 168