1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright 2003 Sun Microsystems, Inc. All rights reserved. 24*0Sstevel@tonic-gate * Use is subject to license terms. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #ifndef _SYS_STAT_IMPL_H 28*0Sstevel@tonic-gate #define _SYS_STAT_IMPL_H 29*0Sstevel@tonic-gate 30*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gate #include <sys/feature_tests.h> 33*0Sstevel@tonic-gate #include <sys/types.h> 34*0Sstevel@tonic-gate 35*0Sstevel@tonic-gate #ifdef __cplusplus 36*0Sstevel@tonic-gate extern "C" { 37*0Sstevel@tonic-gate #endif 38*0Sstevel@tonic-gate 39*0Sstevel@tonic-gate #if !defined(_KERNEL) 40*0Sstevel@tonic-gate 41*0Sstevel@tonic-gate #if defined(__i386) 42*0Sstevel@tonic-gate /* 43*0Sstevel@tonic-gate * The implementation specific header for <sys/stat.h> 44*0Sstevel@tonic-gate * When compiling outside of the large file environment, the *stat source 45*0Sstevel@tonic-gate * symbols must lead to calls to corresponding _x*stat functions that supply 46*0Sstevel@tonic-gate * an initial version number argument identifying which binary stat structure 47*0Sstevel@tonic-gate * representation to use. In the large file compilation environment, the 48*0Sstevel@tonic-gate * intermediate _x*stat functions and version numbers are unnecessary. 49*0Sstevel@tonic-gate * Instead, the source symbols map onto invocations of corresponding *stat64 50*0Sstevel@tonic-gate * functions with identical arguments. 51*0Sstevel@tonic-gate */ 52*0Sstevel@tonic-gate 53*0Sstevel@tonic-gate #if defined(__STDC__) 54*0Sstevel@tonic-gate 55*0Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) || \ 56*0Sstevel@tonic-gate defined(_ATFILE_SOURCE) 57*0Sstevel@tonic-gate extern int fstatat(int, const char *, struct stat *, int); 58*0Sstevel@tonic-gate #endif /* defined (_ATFILE_SOURCE) */ 59*0Sstevel@tonic-gate 60*0Sstevel@tonic-gate #if _FILE_OFFSET_BITS == 32 && !defined(_LP64) && !defined(__lint) 61*0Sstevel@tonic-gate static int fstat(int, struct stat *); 62*0Sstevel@tonic-gate static int stat(const char *_RESTRICT_KYWD, struct stat *_RESTRICT_KYWD); 63*0Sstevel@tonic-gate int _fxstat(const int, int, struct stat *); 64*0Sstevel@tonic-gate int _xstat(const int, const char *, struct stat *); 65*0Sstevel@tonic-gate #else 66*0Sstevel@tonic-gate extern int fstat(int, struct stat *); 67*0Sstevel@tonic-gate extern int stat(const char *_RESTRICT_KYWD, struct stat *_RESTRICT_KYWD); 68*0Sstevel@tonic-gate #endif 69*0Sstevel@tonic-gate 70*0Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 71*0Sstevel@tonic-gate #if _FILE_OFFSET_BITS == 32 && !defined(_LP64) && !defined(__lint) 72*0Sstevel@tonic-gate static int lstat(const char *_RESTRICT_KYWD, struct stat *_RESTRICT_KYWD); 73*0Sstevel@tonic-gate #else 74*0Sstevel@tonic-gate extern int lstat(const char *_RESTRICT_KYWD, struct stat *_RESTRICT_KYWD); 75*0Sstevel@tonic-gate #endif 76*0Sstevel@tonic-gate #if !defined(_LP64) && !defined(__lint) 77*0Sstevel@tonic-gate static int mknod(const char *, mode_t, dev_t); 78*0Sstevel@tonic-gate #else 79*0Sstevel@tonic-gate extern int mknod(const char *, mode_t, dev_t); 80*0Sstevel@tonic-gate #endif 81*0Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 82*0Sstevel@tonic-gate 83*0Sstevel@tonic-gate #if !defined(_LP64) && (!defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \ 84*0Sstevel@tonic-gate defined(__EXTENSIONS__)) 85*0Sstevel@tonic-gate #if _FILE_OFFSET_BITS == 32 86*0Sstevel@tonic-gate int _lxstat(const int, const char *, struct stat *); 87*0Sstevel@tonic-gate #endif 88*0Sstevel@tonic-gate int _xmknod(const int, const char *, mode_t, dev_t); 89*0Sstevel@tonic-gate #endif /* !defined(_LP64) && (!defined(__XOPEN_OR_POSIX)... */ 90*0Sstevel@tonic-gate 91*0Sstevel@tonic-gate 92*0Sstevel@tonic-gate #else /* !__STDC__ */ 93*0Sstevel@tonic-gate 94*0Sstevel@tonic-gate extern int fstatat(); 95*0Sstevel@tonic-gate 96*0Sstevel@tonic-gate 97*0Sstevel@tonic-gate #if _FILE_OFFSET_BITS == 32 && !defined(_LP64) && !defined(__lint) 98*0Sstevel@tonic-gate static int fstat(), stat(); 99*0Sstevel@tonic-gate int _fxstat(), _xstat(); 100*0Sstevel@tonic-gate #else 101*0Sstevel@tonic-gate extern int fstat(), stat(); 102*0Sstevel@tonic-gate #endif 103*0Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 104*0Sstevel@tonic-gate #if _FILE_OFFSET_BITS == 32 && !defined(_LP64) && !defined(__lint) 105*0Sstevel@tonic-gate static int lstat(); 106*0Sstevel@tonic-gate #else 107*0Sstevel@tonic-gate extern int lstat(); 108*0Sstevel@tonic-gate #endif 109*0Sstevel@tonic-gate #if !defined(_LP64) && !defined(__lint) 110*0Sstevel@tonic-gate static int mknod(); 111*0Sstevel@tonic-gate #else 112*0Sstevel@tonic-gate extern int mknod(); 113*0Sstevel@tonic-gate #endif 114*0Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) ... */ 115*0Sstevel@tonic-gate 116*0Sstevel@tonic-gate #if !defined(_LP64) && (!defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \ 117*0Sstevel@tonic-gate defined(__EXTENSIONS__)) 118*0Sstevel@tonic-gate #if _FILE_OFFSET_BITS == 32 119*0Sstevel@tonic-gate int _lxstat(); 120*0Sstevel@tonic-gate #endif 121*0Sstevel@tonic-gate int _xmknod(); 122*0Sstevel@tonic-gate #endif /* !defined(_LP64) && (!defined(__XOPEN_OR_POSIX) ... */ 123*0Sstevel@tonic-gate 124*0Sstevel@tonic-gate #endif /* defined(__STDC__) */ 125*0Sstevel@tonic-gate 126*0Sstevel@tonic-gate /* 127*0Sstevel@tonic-gate * NOTE: Application software should NOT program 128*0Sstevel@tonic-gate * to the _xstat interface. 129*0Sstevel@tonic-gate */ 130*0Sstevel@tonic-gate 131*0Sstevel@tonic-gate #if _FILE_OFFSET_BITS == 32 && !defined(_LP64) && !defined(__lint) 132*0Sstevel@tonic-gate 133*0Sstevel@tonic-gate static int 134*0Sstevel@tonic-gate #ifdef __STDC__ 135*0Sstevel@tonic-gate stat(const char *_RESTRICT_KYWD _path, struct stat *_RESTRICT_KYWD _buf) 136*0Sstevel@tonic-gate #else 137*0Sstevel@tonic-gate stat(_path, _buf) 138*0Sstevel@tonic-gate char *_path; 139*0Sstevel@tonic-gate struct stat *_buf; 140*0Sstevel@tonic-gate #endif 141*0Sstevel@tonic-gate { 142*0Sstevel@tonic-gate return (_xstat(_STAT_VER, _path, _buf)); 143*0Sstevel@tonic-gate } 144*0Sstevel@tonic-gate 145*0Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 146*0Sstevel@tonic-gate static int 147*0Sstevel@tonic-gate #ifdef __STDC__ 148*0Sstevel@tonic-gate lstat(const char *_RESTRICT_KYWD _path, struct stat *_RESTRICT_KYWD _buf) 149*0Sstevel@tonic-gate #else 150*0Sstevel@tonic-gate lstat(_path, _buf) 151*0Sstevel@tonic-gate char *_path; 152*0Sstevel@tonic-gate struct stat *_buf; 153*0Sstevel@tonic-gate #endif 154*0Sstevel@tonic-gate { 155*0Sstevel@tonic-gate return (_lxstat(_STAT_VER, _path, _buf)); 156*0Sstevel@tonic-gate } 157*0Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 158*0Sstevel@tonic-gate 159*0Sstevel@tonic-gate static int 160*0Sstevel@tonic-gate #ifdef __STDC__ 161*0Sstevel@tonic-gate fstat(int _fd, struct stat *_buf) 162*0Sstevel@tonic-gate #else 163*0Sstevel@tonic-gate fstat(_fd, _buf) 164*0Sstevel@tonic-gate int _fd; 165*0Sstevel@tonic-gate struct stat *_buf; 166*0Sstevel@tonic-gate #endif 167*0Sstevel@tonic-gate { 168*0Sstevel@tonic-gate return (_fxstat(_STAT_VER, _fd, _buf)); 169*0Sstevel@tonic-gate } 170*0Sstevel@tonic-gate 171*0Sstevel@tonic-gate #endif /* _FILE_OFFSET_BITS == 32 && !defined(_LP64) ... */ 172*0Sstevel@tonic-gate 173*0Sstevel@tonic-gate #if !defined(_LP64) && !defined(__lint) && (!defined(__XOPEN_OR_POSIX) || \ 174*0Sstevel@tonic-gate defined(_XPG4_2) || defined(__EXTENSIONS__)) 175*0Sstevel@tonic-gate static int 176*0Sstevel@tonic-gate #ifdef __STDC__ 177*0Sstevel@tonic-gate mknod(const char *_path, mode_t _mode, dev_t _dev) 178*0Sstevel@tonic-gate #else 179*0Sstevel@tonic-gate mknod(_path, _mode, _dev) 180*0Sstevel@tonic-gate char *_path; 181*0Sstevel@tonic-gate mode_t _mode; 182*0Sstevel@tonic-gate dev_t _dev; 183*0Sstevel@tonic-gate #endif 184*0Sstevel@tonic-gate { 185*0Sstevel@tonic-gate return (_xmknod(_MKNOD_VER, _path, _mode, _dev)); 186*0Sstevel@tonic-gate } 187*0Sstevel@tonic-gate #endif /* !defined(_LP64) && !defined(__lint) && ... */ 188*0Sstevel@tonic-gate 189*0Sstevel@tonic-gate #else /* !__i386 */ 190*0Sstevel@tonic-gate 191*0Sstevel@tonic-gate #if defined(__STDC__) 192*0Sstevel@tonic-gate 193*0Sstevel@tonic-gate extern int fstat(int, struct stat *); 194*0Sstevel@tonic-gate extern int stat(const char *_RESTRICT_KYWD, struct stat *_RESTRICT_KYWD); 195*0Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) || \ 196*0Sstevel@tonic-gate defined(_ATFILE_SOURCE) 197*0Sstevel@tonic-gate extern int fstatat(int, const char *, struct stat *, int); 198*0Sstevel@tonic-gate #endif /* defined (_ATFILE_SOURCE) */ 199*0Sstevel@tonic-gate 200*0Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 201*0Sstevel@tonic-gate extern int lstat(const char *_RESTRICT_KYWD, struct stat *_RESTRICT_KYWD); 202*0Sstevel@tonic-gate extern int mknod(const char *, mode_t, dev_t); 203*0Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) ... */ 204*0Sstevel@tonic-gate 205*0Sstevel@tonic-gate #else /* !__STDC__ */ 206*0Sstevel@tonic-gate 207*0Sstevel@tonic-gate extern int fstat(), stat(), fstatat(); 208*0Sstevel@tonic-gate 209*0Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 210*0Sstevel@tonic-gate extern int lstat(), mknod(); 211*0Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 212*0Sstevel@tonic-gate 213*0Sstevel@tonic-gate #endif /* !__STDC__ */ 214*0Sstevel@tonic-gate 215*0Sstevel@tonic-gate #endif /* !__i386 */ 216*0Sstevel@tonic-gate 217*0Sstevel@tonic-gate #endif /* !defined(_KERNEL) */ 218*0Sstevel@tonic-gate 219*0Sstevel@tonic-gate #ifdef __cplusplus 220*0Sstevel@tonic-gate } 221*0Sstevel@tonic-gate #endif 222*0Sstevel@tonic-gate 223*0Sstevel@tonic-gate #endif /* _SYS_STAT_IMPL_H */ 224