10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 510440SRoger.Faulkner@Sun.COM * Common Development and Distribution License (the "License"). 610440SRoger.Faulkner@Sun.COM * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 2110440SRoger.Faulkner@Sun.COM 220Sstevel@tonic-gate /* 23*12789SRoger.Faulkner@Oracle.COM * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate /* Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */ 270Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T */ 280Sstevel@tonic-gate /* All Rights Reserved */ 290Sstevel@tonic-gate 300Sstevel@tonic-gate #ifndef _SYS_STAT_H 310Sstevel@tonic-gate #define _SYS_STAT_H 320Sstevel@tonic-gate 330Sstevel@tonic-gate #include <sys/feature_tests.h> 340Sstevel@tonic-gate #include <sys/types.h> 350Sstevel@tonic-gate 360Sstevel@tonic-gate #ifdef __cplusplus 370Sstevel@tonic-gate extern "C" { 380Sstevel@tonic-gate #endif 390Sstevel@tonic-gate 400Sstevel@tonic-gate /* 410Sstevel@tonic-gate * The implementation specific header <sys/time_impl.h> includes a 420Sstevel@tonic-gate * definition for timestruc_t needed by the stat structure. However, 430Sstevel@tonic-gate * including either <time.h>, which includes <sys/time_impl.h>, or 440Sstevel@tonic-gate * including <sys/time_impl.h> directly will break both X/Open and 450Sstevel@tonic-gate * POSIX namespace. Preceeding tag, structure, and structure member 460Sstevel@tonic-gate * names with underscores eliminates the namespace breakage and at the 470Sstevel@tonic-gate * same time, with unique type names, eliminates the possibility of 480Sstevel@tonic-gate * timespec_t or timestruct_t naming conflicts that could otherwise 490Sstevel@tonic-gate * result based on the order of inclusion of <sys/stat.h> and 500Sstevel@tonic-gate * <sys/time.h>. The header <sys/time_std_impl.h> contains the 510Sstevel@tonic-gate * standards namespace safe versions of these definitions. 520Sstevel@tonic-gate */ 530Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 540Sstevel@tonic-gate #include <sys/time_impl.h> 550Sstevel@tonic-gate #else 560Sstevel@tonic-gate #include <sys/time_std_impl.h> 570Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 580Sstevel@tonic-gate 590Sstevel@tonic-gate #define _ST_FSTYPSZ 16 /* array size for file system type name */ 600Sstevel@tonic-gate 610Sstevel@tonic-gate /* 620Sstevel@tonic-gate * stat structure, used by stat(2) and fstat(2) 630Sstevel@tonic-gate */ 640Sstevel@tonic-gate 650Sstevel@tonic-gate #if defined(_KERNEL) 660Sstevel@tonic-gate 670Sstevel@tonic-gate /* Expanded stat structure */ 680Sstevel@tonic-gate 690Sstevel@tonic-gate #if defined(_LP64) 700Sstevel@tonic-gate 710Sstevel@tonic-gate struct stat { 720Sstevel@tonic-gate dev_t st_dev; 730Sstevel@tonic-gate ino_t st_ino; 740Sstevel@tonic-gate mode_t st_mode; 750Sstevel@tonic-gate nlink_t st_nlink; 760Sstevel@tonic-gate uid_t st_uid; 770Sstevel@tonic-gate gid_t st_gid; 780Sstevel@tonic-gate dev_t st_rdev; 790Sstevel@tonic-gate off_t st_size; 800Sstevel@tonic-gate timestruc_t st_atim; 810Sstevel@tonic-gate timestruc_t st_mtim; 820Sstevel@tonic-gate timestruc_t st_ctim; 830Sstevel@tonic-gate blksize_t st_blksize; 840Sstevel@tonic-gate blkcnt_t st_blocks; 850Sstevel@tonic-gate char st_fstype[_ST_FSTYPSZ]; 860Sstevel@tonic-gate }; 870Sstevel@tonic-gate 880Sstevel@tonic-gate struct stat64 { 890Sstevel@tonic-gate dev_t st_dev; 900Sstevel@tonic-gate ino_t st_ino; 910Sstevel@tonic-gate mode_t st_mode; 920Sstevel@tonic-gate nlink_t st_nlink; 930Sstevel@tonic-gate uid_t st_uid; 940Sstevel@tonic-gate gid_t st_gid; 950Sstevel@tonic-gate dev_t st_rdev; 960Sstevel@tonic-gate off_t st_size; 970Sstevel@tonic-gate timestruc_t st_atim; 980Sstevel@tonic-gate timestruc_t st_mtim; 990Sstevel@tonic-gate timestruc_t st_ctim; 1000Sstevel@tonic-gate blksize_t st_blksize; 1010Sstevel@tonic-gate blkcnt_t st_blocks; 1020Sstevel@tonic-gate char st_fstype[_ST_FSTYPSZ]; 1030Sstevel@tonic-gate }; 1040Sstevel@tonic-gate 1050Sstevel@tonic-gate #else /* _LP64 */ 1060Sstevel@tonic-gate 1070Sstevel@tonic-gate struct stat { 1080Sstevel@tonic-gate dev_t st_dev; 1090Sstevel@tonic-gate long st_pad1[3]; /* reserve for dev expansion, */ 1100Sstevel@tonic-gate /* sysid definition */ 1110Sstevel@tonic-gate ino_t st_ino; 1120Sstevel@tonic-gate mode_t st_mode; 1130Sstevel@tonic-gate nlink_t st_nlink; 1140Sstevel@tonic-gate uid_t st_uid; 1150Sstevel@tonic-gate gid_t st_gid; 1160Sstevel@tonic-gate dev_t st_rdev; 1170Sstevel@tonic-gate long st_pad2[2]; 1180Sstevel@tonic-gate off_t st_size; 1190Sstevel@tonic-gate long st_pad3; /* pad for future off_t expansion */ 1200Sstevel@tonic-gate timestruc_t st_atim; 1210Sstevel@tonic-gate timestruc_t st_mtim; 1220Sstevel@tonic-gate timestruc_t st_ctim; 1230Sstevel@tonic-gate blksize_t st_blksize; 1240Sstevel@tonic-gate blkcnt_t st_blocks; 1250Sstevel@tonic-gate char st_fstype[_ST_FSTYPSZ]; 1260Sstevel@tonic-gate long st_pad4[8]; /* expansion area */ 1270Sstevel@tonic-gate }; 1280Sstevel@tonic-gate 1290Sstevel@tonic-gate struct stat64 { 1300Sstevel@tonic-gate dev_t st_dev; 1310Sstevel@tonic-gate long st_pad1[3]; /* reserve for dev expansion, */ 1320Sstevel@tonic-gate /* sysid definition */ 1330Sstevel@tonic-gate ino64_t st_ino; 1340Sstevel@tonic-gate mode_t st_mode; 1350Sstevel@tonic-gate nlink_t st_nlink; 1360Sstevel@tonic-gate uid_t st_uid; 1370Sstevel@tonic-gate gid_t st_gid; 1380Sstevel@tonic-gate dev_t st_rdev; 1390Sstevel@tonic-gate long st_pad2[2]; 1400Sstevel@tonic-gate off64_t st_size; /* large file support */ 1410Sstevel@tonic-gate timestruc_t st_atim; 1420Sstevel@tonic-gate timestruc_t st_mtim; 1430Sstevel@tonic-gate timestruc_t st_ctim; 1440Sstevel@tonic-gate blksize_t st_blksize; 1450Sstevel@tonic-gate blkcnt64_t st_blocks; /* large file support */ 1460Sstevel@tonic-gate char st_fstype[_ST_FSTYPSZ]; 1470Sstevel@tonic-gate long st_pad4[8]; /* expansion area */ 1480Sstevel@tonic-gate }; 1490Sstevel@tonic-gate 1500Sstevel@tonic-gate #endif /* _LP64 */ 1510Sstevel@tonic-gate 1520Sstevel@tonic-gate #else /* !defined(_KERNEL) */ 1530Sstevel@tonic-gate 1540Sstevel@tonic-gate /* 1550Sstevel@tonic-gate * large file compilation environment setup 1560Sstevel@tonic-gate */ 1570Sstevel@tonic-gate #if !defined(_LP64) && _FILE_OFFSET_BITS == 64 1580Sstevel@tonic-gate #ifdef __PRAGMA_REDEFINE_EXTNAME 1590Sstevel@tonic-gate #pragma redefine_extname fstat fstat64 1600Sstevel@tonic-gate #pragma redefine_extname stat stat64 1610Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) || \ 1620Sstevel@tonic-gate defined(_ATFILE_SOURCE) 1630Sstevel@tonic-gate #pragma redefine_extname fstatat fstatat64 1640Sstevel@tonic-gate #endif /* defined (_ATFILE_SOURCE) */ 1650Sstevel@tonic-gate 1660Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(_XPG_2) || defined(__EXTENSIONS__) 1670Sstevel@tonic-gate #pragma redefine_extname lstat lstat64 1680Sstevel@tonic-gate #endif 1690Sstevel@tonic-gate #else /* __PRAGMA_REDEFINE_EXTNAME */ 1700Sstevel@tonic-gate #define fstat fstat64 1710Sstevel@tonic-gate #define stat stat64 1720Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) || \ 1730Sstevel@tonic-gate defined(_ATFILE_SOURCE) 1740Sstevel@tonic-gate #define fstatat fstatat64 1750Sstevel@tonic-gate #endif /* defined (_ATFILE_SOURCE) */ 1760Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(_XPG_2) || defined(__EXTENSIONS__) 1770Sstevel@tonic-gate #define lstat lstat64 1780Sstevel@tonic-gate #endif 1790Sstevel@tonic-gate #endif /* __PRAGMA_REDEFINE_EXTNAME */ 1800Sstevel@tonic-gate #endif /* !_LP64 && _FILE_OFFSET_BITS == 64 */ 1810Sstevel@tonic-gate 1820Sstevel@tonic-gate /* 1830Sstevel@tonic-gate * In the LP64 compilation environment, map large file interfaces 1840Sstevel@tonic-gate * back to native versions where possible. 1850Sstevel@tonic-gate */ 1860Sstevel@tonic-gate #if defined(_LP64) && defined(_LARGEFILE64_SOURCE) 1870Sstevel@tonic-gate #ifdef __PRAGMA_REDEFINE_EXTNAME 1880Sstevel@tonic-gate #pragma redefine_extname fstat64 fstat 1890Sstevel@tonic-gate #pragma redefine_extname stat64 stat 1900Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) || \ 1910Sstevel@tonic-gate defined(_ATFILE_SOURCE) 1920Sstevel@tonic-gate #pragma redefine_extname fstatat64 fstatat 1930Sstevel@tonic-gate #endif /* defined (_ATFILE_SOURCE) */ 1940Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(_XPG_2) || defined(__EXTENSIONS__) 1950Sstevel@tonic-gate #pragma redefine_extname lstat64 lstat 1960Sstevel@tonic-gate #endif 1970Sstevel@tonic-gate #else /* __PRAGMA_REDEFINE_EXTNAME */ 1980Sstevel@tonic-gate #define fstat64 fstat 1990Sstevel@tonic-gate #define stat64 stat 2000Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) || \ 2010Sstevel@tonic-gate defined(_ATFILE_SOURCE) 2020Sstevel@tonic-gate #define fstatat64 fstatat 2030Sstevel@tonic-gate #endif /* defined (_ATFILE_SOURCE) */ 2040Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(_XPG_2) || defined(__EXTENSIONS__) 2050Sstevel@tonic-gate #define lstat64 lstat 2060Sstevel@tonic-gate #endif 2070Sstevel@tonic-gate #endif /* __PRAGMA_REDEFINE_EXTNAME */ 2080Sstevel@tonic-gate #endif /* _LP64 && _LARGEFILE64_SOURCE */ 2090Sstevel@tonic-gate 2100Sstevel@tonic-gate /* 2110Sstevel@tonic-gate * User level stat structure definitions. 2120Sstevel@tonic-gate */ 2130Sstevel@tonic-gate 2140Sstevel@tonic-gate #if defined(_LP64) 2150Sstevel@tonic-gate 2160Sstevel@tonic-gate struct stat { 2170Sstevel@tonic-gate dev_t st_dev; 2180Sstevel@tonic-gate ino_t st_ino; 2190Sstevel@tonic-gate mode_t st_mode; 2200Sstevel@tonic-gate nlink_t st_nlink; 2210Sstevel@tonic-gate uid_t st_uid; 2220Sstevel@tonic-gate gid_t st_gid; 2230Sstevel@tonic-gate dev_t st_rdev; 2240Sstevel@tonic-gate off_t st_size; 2250Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 2260Sstevel@tonic-gate timestruc_t st_atim; 2270Sstevel@tonic-gate timestruc_t st_mtim; 2280Sstevel@tonic-gate timestruc_t st_ctim; 2290Sstevel@tonic-gate #else 2300Sstevel@tonic-gate _timestruc_t st_atim; 2310Sstevel@tonic-gate _timestruc_t st_mtim; 2320Sstevel@tonic-gate _timestruc_t st_ctim; 2330Sstevel@tonic-gate #endif 2340Sstevel@tonic-gate blksize_t st_blksize; 2350Sstevel@tonic-gate blkcnt_t st_blocks; 2360Sstevel@tonic-gate char st_fstype[_ST_FSTYPSZ]; 2370Sstevel@tonic-gate }; 2380Sstevel@tonic-gate 2390Sstevel@tonic-gate #else /* _LP64 */ 2400Sstevel@tonic-gate 2410Sstevel@tonic-gate struct stat { 2420Sstevel@tonic-gate dev_t st_dev; 2430Sstevel@tonic-gate long st_pad1[3]; /* reserved for network id */ 2440Sstevel@tonic-gate ino_t st_ino; 2450Sstevel@tonic-gate mode_t st_mode; 2460Sstevel@tonic-gate nlink_t st_nlink; 2470Sstevel@tonic-gate uid_t st_uid; 2480Sstevel@tonic-gate gid_t st_gid; 2490Sstevel@tonic-gate dev_t st_rdev; 2500Sstevel@tonic-gate long st_pad2[2]; 2510Sstevel@tonic-gate off_t st_size; 2520Sstevel@tonic-gate #if _FILE_OFFSET_BITS != 64 2530Sstevel@tonic-gate long st_pad3; /* future off_t expansion */ 2540Sstevel@tonic-gate #endif 2550Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 2560Sstevel@tonic-gate timestruc_t st_atim; 2570Sstevel@tonic-gate timestruc_t st_mtim; 2580Sstevel@tonic-gate timestruc_t st_ctim; 2590Sstevel@tonic-gate #else 2600Sstevel@tonic-gate _timestruc_t st_atim; 2610Sstevel@tonic-gate _timestruc_t st_mtim; 2620Sstevel@tonic-gate _timestruc_t st_ctim; 2630Sstevel@tonic-gate #endif 2640Sstevel@tonic-gate blksize_t st_blksize; 2650Sstevel@tonic-gate blkcnt_t st_blocks; 2660Sstevel@tonic-gate char st_fstype[_ST_FSTYPSZ]; 2670Sstevel@tonic-gate long st_pad4[8]; /* expansion area */ 2680Sstevel@tonic-gate }; 2690Sstevel@tonic-gate 2700Sstevel@tonic-gate #endif /* _LP64 */ 2710Sstevel@tonic-gate 2720Sstevel@tonic-gate /* transitional large file interface version */ 2730Sstevel@tonic-gate #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ 2740Sstevel@tonic-gate !defined(__PRAGMA_REDEFINE_EXTNAME)) 2750Sstevel@tonic-gate #if defined(_LP64) 2760Sstevel@tonic-gate 2770Sstevel@tonic-gate struct stat64 { 2780Sstevel@tonic-gate dev_t st_dev; 2790Sstevel@tonic-gate ino_t st_ino; 2800Sstevel@tonic-gate mode_t st_mode; 2810Sstevel@tonic-gate nlink_t st_nlink; 2820Sstevel@tonic-gate uid_t st_uid; 2830Sstevel@tonic-gate gid_t st_gid; 2840Sstevel@tonic-gate dev_t st_rdev; 2850Sstevel@tonic-gate off_t st_size; 2860Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 2870Sstevel@tonic-gate timestruc_t st_atim; 2880Sstevel@tonic-gate timestruc_t st_mtim; 2890Sstevel@tonic-gate timestruc_t st_ctim; 2900Sstevel@tonic-gate #else 2910Sstevel@tonic-gate _timestruc_t st_atim; 2920Sstevel@tonic-gate _timestruc_t st_mtim; 2930Sstevel@tonic-gate _timestruc_t st_ctim; 2940Sstevel@tonic-gate #endif 2950Sstevel@tonic-gate blksize_t st_blksize; 2960Sstevel@tonic-gate blkcnt_t st_blocks; 2970Sstevel@tonic-gate char st_fstype[_ST_FSTYPSZ]; 2980Sstevel@tonic-gate }; 2990Sstevel@tonic-gate 3000Sstevel@tonic-gate #else /* _LP64 */ 3010Sstevel@tonic-gate 3020Sstevel@tonic-gate struct stat64 { 3030Sstevel@tonic-gate dev_t st_dev; 3040Sstevel@tonic-gate long st_pad1[3]; /* reserved for network id */ 3050Sstevel@tonic-gate ino64_t st_ino; 3060Sstevel@tonic-gate mode_t st_mode; 3070Sstevel@tonic-gate nlink_t st_nlink; 3080Sstevel@tonic-gate uid_t st_uid; 3090Sstevel@tonic-gate gid_t st_gid; 3100Sstevel@tonic-gate dev_t st_rdev; 3110Sstevel@tonic-gate long st_pad2[2]; 3120Sstevel@tonic-gate off64_t st_size; 3130Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 3140Sstevel@tonic-gate timestruc_t st_atim; 3150Sstevel@tonic-gate timestruc_t st_mtim; 3160Sstevel@tonic-gate timestruc_t st_ctim; 3170Sstevel@tonic-gate #else 3180Sstevel@tonic-gate _timestruc_t st_atim; 3190Sstevel@tonic-gate _timestruc_t st_mtim; 3200Sstevel@tonic-gate _timestruc_t st_ctim; 3210Sstevel@tonic-gate #endif 3220Sstevel@tonic-gate blksize_t st_blksize; 3230Sstevel@tonic-gate blkcnt64_t st_blocks; 3240Sstevel@tonic-gate char st_fstype[_ST_FSTYPSZ]; 3250Sstevel@tonic-gate long st_pad4[8]; /* expansion area */ 3260Sstevel@tonic-gate }; 3270Sstevel@tonic-gate 3280Sstevel@tonic-gate #endif /* _LP64 */ 3290Sstevel@tonic-gate #endif 3300Sstevel@tonic-gate 3310Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 3320Sstevel@tonic-gate #define st_atime st_atim.tv_sec 3330Sstevel@tonic-gate #define st_mtime st_mtim.tv_sec 3340Sstevel@tonic-gate #define st_ctime st_ctim.tv_sec 3350Sstevel@tonic-gate #else 3360Sstevel@tonic-gate #define st_atime st_atim.__tv_sec 3370Sstevel@tonic-gate #define st_mtime st_mtim.__tv_sec 3380Sstevel@tonic-gate #define st_ctime st_ctim.__tv_sec 3390Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 3400Sstevel@tonic-gate 3410Sstevel@tonic-gate #endif /* end defined(_KERNEL) */ 3420Sstevel@tonic-gate 3430Sstevel@tonic-gate #if defined(_SYSCALL32) 3440Sstevel@tonic-gate 3450Sstevel@tonic-gate /* 3460Sstevel@tonic-gate * Kernel's view of user ILP32 stat and stat64 structures 3470Sstevel@tonic-gate */ 3480Sstevel@tonic-gate 3490Sstevel@tonic-gate struct stat32 { 3500Sstevel@tonic-gate dev32_t st_dev; 3510Sstevel@tonic-gate int32_t st_pad1[3]; 3520Sstevel@tonic-gate ino32_t st_ino; 3530Sstevel@tonic-gate mode32_t st_mode; 3540Sstevel@tonic-gate nlink32_t st_nlink; 3550Sstevel@tonic-gate uid32_t st_uid; 3560Sstevel@tonic-gate gid32_t st_gid; 3570Sstevel@tonic-gate dev32_t st_rdev; 3580Sstevel@tonic-gate int32_t st_pad2[2]; 3590Sstevel@tonic-gate off32_t st_size; 3600Sstevel@tonic-gate int32_t st_pad3; 3610Sstevel@tonic-gate timestruc32_t st_atim; 3620Sstevel@tonic-gate timestruc32_t st_mtim; 3630Sstevel@tonic-gate timestruc32_t st_ctim; 3640Sstevel@tonic-gate int32_t st_blksize; 3650Sstevel@tonic-gate blkcnt32_t st_blocks; 3660Sstevel@tonic-gate char st_fstype[_ST_FSTYPSZ]; 3670Sstevel@tonic-gate int32_t st_pad4[8]; 3680Sstevel@tonic-gate }; 3690Sstevel@tonic-gate 3700Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 3710Sstevel@tonic-gate #pragma pack(4) 3720Sstevel@tonic-gate #endif 3730Sstevel@tonic-gate 3740Sstevel@tonic-gate struct stat64_32 { 3750Sstevel@tonic-gate dev32_t st_dev; 3760Sstevel@tonic-gate int32_t st_pad1[3]; 3770Sstevel@tonic-gate ino64_t st_ino; 3780Sstevel@tonic-gate mode32_t st_mode; 3790Sstevel@tonic-gate nlink32_t st_nlink; 3800Sstevel@tonic-gate uid32_t st_uid; 3810Sstevel@tonic-gate gid32_t st_gid; 3820Sstevel@tonic-gate dev32_t st_rdev; 3830Sstevel@tonic-gate int32_t st_pad2[2]; 3840Sstevel@tonic-gate off64_t st_size; 3850Sstevel@tonic-gate timestruc32_t st_atim; 3860Sstevel@tonic-gate timestruc32_t st_mtim; 3870Sstevel@tonic-gate timestruc32_t st_ctim; 3880Sstevel@tonic-gate int32_t st_blksize; 3890Sstevel@tonic-gate blkcnt64_t st_blocks; 3900Sstevel@tonic-gate char st_fstype[_ST_FSTYPSZ]; 3910Sstevel@tonic-gate int32_t st_pad4[8]; 3920Sstevel@tonic-gate }; 3930Sstevel@tonic-gate 3940Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 3950Sstevel@tonic-gate #pragma pack() 3960Sstevel@tonic-gate #endif 3970Sstevel@tonic-gate 3980Sstevel@tonic-gate #endif /* _SYSCALL32 */ 3990Sstevel@tonic-gate 4000Sstevel@tonic-gate /* MODE MASKS */ 4010Sstevel@tonic-gate 4020Sstevel@tonic-gate /* de facto standard definitions */ 4030Sstevel@tonic-gate 4040Sstevel@tonic-gate #define S_IFMT 0xF000 /* type of file */ 4050Sstevel@tonic-gate #define S_IAMB 0x1FF /* access mode bits */ 4060Sstevel@tonic-gate #define S_IFIFO 0x1000 /* fifo */ 4070Sstevel@tonic-gate #define S_IFCHR 0x2000 /* character special */ 4080Sstevel@tonic-gate #define S_IFDIR 0x4000 /* directory */ 4090Sstevel@tonic-gate /* XENIX definitions are not relevant to Solaris */ 4100Sstevel@tonic-gate #define S_IFNAM 0x5000 /* XENIX special named file */ 4110Sstevel@tonic-gate #define S_INSEM 0x1 /* XENIX semaphore subtype of IFNAM */ 4120Sstevel@tonic-gate #define S_INSHD 0x2 /* XENIX shared data subtype of IFNAM */ 4130Sstevel@tonic-gate #define S_IFBLK 0x6000 /* block special */ 4140Sstevel@tonic-gate #define S_IFREG 0x8000 /* regular */ 4150Sstevel@tonic-gate #define S_IFLNK 0xA000 /* symbolic link */ 4160Sstevel@tonic-gate #define S_IFSOCK 0xC000 /* socket */ 4170Sstevel@tonic-gate #define S_IFDOOR 0xD000 /* door */ 4180Sstevel@tonic-gate #define S_IFPORT 0xE000 /* event port */ 4190Sstevel@tonic-gate #define S_ISUID 0x800 /* set user id on execution */ 4200Sstevel@tonic-gate #define S_ISGID 0x400 /* set group id on execution */ 4210Sstevel@tonic-gate #define S_ISVTX 0x200 /* save swapped text even after use */ 4220Sstevel@tonic-gate #define S_IREAD 00400 /* read permission, owner */ 4230Sstevel@tonic-gate #define S_IWRITE 00200 /* write permission, owner */ 4240Sstevel@tonic-gate #define S_IEXEC 00100 /* execute/search permission, owner */ 4250Sstevel@tonic-gate #define S_ENFMT S_ISGID /* record locking enforcement flag */ 4260Sstevel@tonic-gate 4270Sstevel@tonic-gate /* the following macros are for POSIX conformance */ 4280Sstevel@tonic-gate 4290Sstevel@tonic-gate #define S_IRWXU 00700 /* read, write, execute: owner */ 4300Sstevel@tonic-gate #define S_IRUSR 00400 /* read permission: owner */ 4310Sstevel@tonic-gate #define S_IWUSR 00200 /* write permission: owner */ 4320Sstevel@tonic-gate #define S_IXUSR 00100 /* execute permission: owner */ 4330Sstevel@tonic-gate #define S_IRWXG 00070 /* read, write, execute: group */ 4340Sstevel@tonic-gate #define S_IRGRP 00040 /* read permission: group */ 4350Sstevel@tonic-gate #define S_IWGRP 00020 /* write permission: group */ 4360Sstevel@tonic-gate #define S_IXGRP 00010 /* execute permission: group */ 4370Sstevel@tonic-gate #define S_IRWXO 00007 /* read, write, execute: other */ 4380Sstevel@tonic-gate #define S_IROTH 00004 /* read permission: other */ 4390Sstevel@tonic-gate #define S_IWOTH 00002 /* write permission: other */ 4400Sstevel@tonic-gate #define S_IXOTH 00001 /* execute permission: other */ 4410Sstevel@tonic-gate 4420Sstevel@tonic-gate 4430Sstevel@tonic-gate #define S_ISFIFO(mode) (((mode)&0xF000) == 0x1000) 4440Sstevel@tonic-gate #define S_ISCHR(mode) (((mode)&0xF000) == 0x2000) 4450Sstevel@tonic-gate #define S_ISDIR(mode) (((mode)&0xF000) == 0x4000) 4460Sstevel@tonic-gate #define S_ISBLK(mode) (((mode)&0xF000) == 0x6000) 4470Sstevel@tonic-gate #define S_ISREG(mode) (((mode)&0xF000) == 0x8000) 4480Sstevel@tonic-gate #define S_ISLNK(mode) (((mode)&0xF000) == 0xa000) 4490Sstevel@tonic-gate #define S_ISSOCK(mode) (((mode)&0xF000) == 0xc000) 4500Sstevel@tonic-gate #define S_ISDOOR(mode) (((mode)&0xF000) == 0xd000) 4510Sstevel@tonic-gate #define S_ISPORT(mode) (((mode)&0xF000) == 0xe000) 4520Sstevel@tonic-gate 4530Sstevel@tonic-gate /* POSIX.4 macros */ 4540Sstevel@tonic-gate #define S_TYPEISMQ(_buf) (0) 4550Sstevel@tonic-gate #define S_TYPEISSEM(_buf) (0) 4560Sstevel@tonic-gate #define S_TYPEISSHM(_buf) (0) 4570Sstevel@tonic-gate 4580Sstevel@tonic-gate #if defined(__i386) || (defined(__i386_COMPAT) && defined(_KERNEL)) 4590Sstevel@tonic-gate 4600Sstevel@tonic-gate /* 4610Sstevel@tonic-gate * A version number is included in the x86 SVR4 stat and mknod interfaces 4620Sstevel@tonic-gate * so that SVR4 binaries can be supported. An LP64 kernel that supports 4630Sstevel@tonic-gate * the i386 ABI need to be aware of this too. 4640Sstevel@tonic-gate */ 4650Sstevel@tonic-gate 4660Sstevel@tonic-gate #define _R3_MKNOD_VER 1 /* SVR3.0 mknod */ 4670Sstevel@tonic-gate #define _MKNOD_VER 2 /* current version of mknod */ 4680Sstevel@tonic-gate #define _R3_STAT_VER 1 /* SVR3.0 stat */ 4690Sstevel@tonic-gate #define _STAT_VER 2 /* current version of stat */ 4700Sstevel@tonic-gate 4710Sstevel@tonic-gate #endif /* __i386 || (__i386_COMPAT && _KERNEL) */ 4720Sstevel@tonic-gate 47310440SRoger.Faulkner@Sun.COM #if defined(__EXTENSIONS__) || \ 47410440SRoger.Faulkner@Sun.COM (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) 47510440SRoger.Faulkner@Sun.COM /* || defined(_XPG7) */ 47610440SRoger.Faulkner@Sun.COM /* for use with futimens() and utimensat() */ 47710440SRoger.Faulkner@Sun.COM #define UTIME_NOW -1L 47810440SRoger.Faulkner@Sun.COM #define UTIME_OMIT -2L 47910440SRoger.Faulkner@Sun.COM #endif /* defined(__EXTENSIONS__) ... */ 48010440SRoger.Faulkner@Sun.COM 4810Sstevel@tonic-gate #if !defined(_KERNEL) || defined(_BOOT) 4820Sstevel@tonic-gate 4830Sstevel@tonic-gate #if defined(__STDC__) 4840Sstevel@tonic-gate 4850Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || \ 4860Sstevel@tonic-gate defined(_XPG4_2) || defined(__EXTENSIONS__) 4870Sstevel@tonic-gate extern int fchmod(int, mode_t); 4880Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2)... */ 4890Sstevel@tonic-gate 4900Sstevel@tonic-gate extern int chmod(const char *, mode_t); 4910Sstevel@tonic-gate extern int mkdir(const char *, mode_t); 4920Sstevel@tonic-gate extern int mkfifo(const char *, mode_t); 4930Sstevel@tonic-gate extern mode_t umask(mode_t); 4940Sstevel@tonic-gate 4950Sstevel@tonic-gate /* transitional large file interfaces */ 4960Sstevel@tonic-gate #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ 4970Sstevel@tonic-gate !defined(__PRAGMA_REDEFINE_EXTNAME)) 4980Sstevel@tonic-gate extern int fstat64(int, struct stat64 *); 4990Sstevel@tonic-gate extern int stat64(const char *_RESTRICT_KYWD, struct stat64 *_RESTRICT_KYWD); 5000Sstevel@tonic-gate extern int lstat64(const char *_RESTRICT_KYWD, struct stat64 *_RESTRICT_KYWD); 5010Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) || \ 5020Sstevel@tonic-gate defined(_ATFILE_SOURCE) 5030Sstevel@tonic-gate extern int fstatat64(int, const char *, struct stat64 *, int); 5040Sstevel@tonic-gate #endif /* defined (_ATFILE_SOURCE) */ 5050Sstevel@tonic-gate #endif 5060Sstevel@tonic-gate 507*12789SRoger.Faulkner@Oracle.COM #if defined(__EXTENSIONS__) || defined(_ATFILE_SOURCE) || \ 50810440SRoger.Faulkner@Sun.COM (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) 50910440SRoger.Faulkner@Sun.COM /* || defined(_XPG7) */ 510*12789SRoger.Faulkner@Oracle.COM extern int mkdirat(int, const char *, mode_t); 511*12789SRoger.Faulkner@Oracle.COM extern int mkfifoat(int, const char *, mode_t); 512*12789SRoger.Faulkner@Oracle.COM extern int mknodat(int, const char *, mode_t, dev_t); 513*12789SRoger.Faulkner@Oracle.COM extern int fchmodat(int, const char *, mode_t, int); 51410440SRoger.Faulkner@Sun.COM extern int futimens(int, const struct timespec[2]); 51510440SRoger.Faulkner@Sun.COM extern int utimensat(int, const char *, const struct timespec[2], int); 51610440SRoger.Faulkner@Sun.COM #endif /* defined(__EXTENSIONS__) ... */ 51710440SRoger.Faulkner@Sun.COM 5180Sstevel@tonic-gate #else /* !__STDC__ */ 5190Sstevel@tonic-gate 5200Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || \ 5210Sstevel@tonic-gate defined(_XPG4_2) || defined(__EXTENSIONS__) 5220Sstevel@tonic-gate extern int fchmod(); 5230Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2)... */ 5240Sstevel@tonic-gate 5250Sstevel@tonic-gate extern int chmod(); 5260Sstevel@tonic-gate extern int mkdir(); 5270Sstevel@tonic-gate extern int mkfifo(); 5280Sstevel@tonic-gate extern mode_t umask(); 5290Sstevel@tonic-gate 5300Sstevel@tonic-gate /* transitional large file interfaces */ 5310Sstevel@tonic-gate #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ 5320Sstevel@tonic-gate !defined(__PRAGMA_REDEFINE_EXTNAME)) 5330Sstevel@tonic-gate extern int fstat64(); 5340Sstevel@tonic-gate extern int stat64(); 5350Sstevel@tonic-gate extern int lstat64(); 5360Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) || \ 5370Sstevel@tonic-gate defined(_ATFILE_SOURCE) 5380Sstevel@tonic-gate extern int fstatat64(); 5390Sstevel@tonic-gate #endif /* defined (_ATFILE_SOURCE) */ 5400Sstevel@tonic-gate #endif 5410Sstevel@tonic-gate 542*12789SRoger.Faulkner@Oracle.COM #if defined(__EXTENSIONS__) || defined(_ATFILE_SOURCE) || \ 54310440SRoger.Faulkner@Sun.COM (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) 54410440SRoger.Faulkner@Sun.COM /* || defined(_XPG7) */ 545*12789SRoger.Faulkner@Oracle.COM extern int mkdirat(); 546*12789SRoger.Faulkner@Oracle.COM extern int mkfifoat(); 547*12789SRoger.Faulkner@Oracle.COM extern int mknodat(); 548*12789SRoger.Faulkner@Oracle.COM extern int fchmodat(); 54910440SRoger.Faulkner@Sun.COM extern int futimens(); 55010440SRoger.Faulkner@Sun.COM extern int utimensat(); 55110440SRoger.Faulkner@Sun.COM #endif /* defined(__EXTENSIONS__) ... */ 55210440SRoger.Faulkner@Sun.COM 5530Sstevel@tonic-gate #endif /* defined(__STDC__) */ 5540Sstevel@tonic-gate 5550Sstevel@tonic-gate #include <sys/stat_impl.h> 5560Sstevel@tonic-gate 5570Sstevel@tonic-gate #endif /* !defined(_KERNEL) */ 5580Sstevel@tonic-gate 5590Sstevel@tonic-gate #ifdef __cplusplus 5600Sstevel@tonic-gate } 5610Sstevel@tonic-gate #endif 5620Sstevel@tonic-gate 5630Sstevel@tonic-gate #endif /* _SYS_STAT_H */ 564