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 53b862e9aSRoger A. Faulkner * Common Development and Distribution License (the "License"). 63b862e9aSRoger A. Faulkner * 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 */ 213b862e9aSRoger A. Faulkner 227c478bd9Sstevel@tonic-gate /* 23*ba3594baSGarrett D'Amore * Copyright 2014 Garrett D'Amore <garrett@damore.org> 24794f0adbSRoger A. Faulkner * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate /* Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */ 287c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T */ 297c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate #ifndef _SYS_STAT_H 327c478bd9Sstevel@tonic-gate #define _SYS_STAT_H 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h> 357c478bd9Sstevel@tonic-gate #include <sys/types.h> 367c478bd9Sstevel@tonic-gate 377c478bd9Sstevel@tonic-gate #ifdef __cplusplus 387c478bd9Sstevel@tonic-gate extern "C" { 397c478bd9Sstevel@tonic-gate #endif 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate /* 427c478bd9Sstevel@tonic-gate * The implementation specific header <sys/time_impl.h> includes a 437c478bd9Sstevel@tonic-gate * definition for timestruc_t needed by the stat structure. However, 447c478bd9Sstevel@tonic-gate * including either <time.h>, which includes <sys/time_impl.h>, or 457c478bd9Sstevel@tonic-gate * including <sys/time_impl.h> directly will break both X/Open and 467c478bd9Sstevel@tonic-gate * POSIX namespace. Preceeding tag, structure, and structure member 477c478bd9Sstevel@tonic-gate * names with underscores eliminates the namespace breakage and at the 487c478bd9Sstevel@tonic-gate * same time, with unique type names, eliminates the possibility of 497c478bd9Sstevel@tonic-gate * timespec_t or timestruct_t naming conflicts that could otherwise 507c478bd9Sstevel@tonic-gate * result based on the order of inclusion of <sys/stat.h> and 517c478bd9Sstevel@tonic-gate * <sys/time.h>. The header <sys/time_std_impl.h> contains the 527c478bd9Sstevel@tonic-gate * standards namespace safe versions of these definitions. 537c478bd9Sstevel@tonic-gate */ 547c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 557c478bd9Sstevel@tonic-gate #include <sys/time_impl.h> 567c478bd9Sstevel@tonic-gate #else 577c478bd9Sstevel@tonic-gate #include <sys/time_std_impl.h> 587c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 597c478bd9Sstevel@tonic-gate 607c478bd9Sstevel@tonic-gate #define _ST_FSTYPSZ 16 /* array size for file system type name */ 617c478bd9Sstevel@tonic-gate 627c478bd9Sstevel@tonic-gate /* 637c478bd9Sstevel@tonic-gate * stat structure, used by stat(2) and fstat(2) 647c478bd9Sstevel@tonic-gate */ 657c478bd9Sstevel@tonic-gate 667c478bd9Sstevel@tonic-gate #if defined(_KERNEL) 677c478bd9Sstevel@tonic-gate 687c478bd9Sstevel@tonic-gate /* Expanded stat structure */ 697c478bd9Sstevel@tonic-gate 707c478bd9Sstevel@tonic-gate #if defined(_LP64) 717c478bd9Sstevel@tonic-gate 727c478bd9Sstevel@tonic-gate struct stat { 737c478bd9Sstevel@tonic-gate dev_t st_dev; 747c478bd9Sstevel@tonic-gate ino_t st_ino; 757c478bd9Sstevel@tonic-gate mode_t st_mode; 767c478bd9Sstevel@tonic-gate nlink_t st_nlink; 777c478bd9Sstevel@tonic-gate uid_t st_uid; 787c478bd9Sstevel@tonic-gate gid_t st_gid; 797c478bd9Sstevel@tonic-gate dev_t st_rdev; 807c478bd9Sstevel@tonic-gate off_t st_size; 817c478bd9Sstevel@tonic-gate timestruc_t st_atim; 827c478bd9Sstevel@tonic-gate timestruc_t st_mtim; 837c478bd9Sstevel@tonic-gate timestruc_t st_ctim; 847c478bd9Sstevel@tonic-gate blksize_t st_blksize; 857c478bd9Sstevel@tonic-gate blkcnt_t st_blocks; 867c478bd9Sstevel@tonic-gate char st_fstype[_ST_FSTYPSZ]; 877c478bd9Sstevel@tonic-gate }; 887c478bd9Sstevel@tonic-gate 897c478bd9Sstevel@tonic-gate struct stat64 { 907c478bd9Sstevel@tonic-gate dev_t st_dev; 917c478bd9Sstevel@tonic-gate ino_t st_ino; 927c478bd9Sstevel@tonic-gate mode_t st_mode; 937c478bd9Sstevel@tonic-gate nlink_t st_nlink; 947c478bd9Sstevel@tonic-gate uid_t st_uid; 957c478bd9Sstevel@tonic-gate gid_t st_gid; 967c478bd9Sstevel@tonic-gate dev_t st_rdev; 977c478bd9Sstevel@tonic-gate off_t st_size; 987c478bd9Sstevel@tonic-gate timestruc_t st_atim; 997c478bd9Sstevel@tonic-gate timestruc_t st_mtim; 1007c478bd9Sstevel@tonic-gate timestruc_t st_ctim; 1017c478bd9Sstevel@tonic-gate blksize_t st_blksize; 1027c478bd9Sstevel@tonic-gate blkcnt_t st_blocks; 1037c478bd9Sstevel@tonic-gate char st_fstype[_ST_FSTYPSZ]; 1047c478bd9Sstevel@tonic-gate }; 1057c478bd9Sstevel@tonic-gate 1067c478bd9Sstevel@tonic-gate #else /* _LP64 */ 1077c478bd9Sstevel@tonic-gate 1087c478bd9Sstevel@tonic-gate struct stat { 1097c478bd9Sstevel@tonic-gate dev_t st_dev; 1107c478bd9Sstevel@tonic-gate long st_pad1[3]; /* reserve for dev expansion, */ 1117c478bd9Sstevel@tonic-gate /* sysid definition */ 1127c478bd9Sstevel@tonic-gate ino_t st_ino; 1137c478bd9Sstevel@tonic-gate mode_t st_mode; 1147c478bd9Sstevel@tonic-gate nlink_t st_nlink; 1157c478bd9Sstevel@tonic-gate uid_t st_uid; 1167c478bd9Sstevel@tonic-gate gid_t st_gid; 1177c478bd9Sstevel@tonic-gate dev_t st_rdev; 1187c478bd9Sstevel@tonic-gate long st_pad2[2]; 1197c478bd9Sstevel@tonic-gate off_t st_size; 1207c478bd9Sstevel@tonic-gate long st_pad3; /* pad for future off_t expansion */ 1217c478bd9Sstevel@tonic-gate timestruc_t st_atim; 1227c478bd9Sstevel@tonic-gate timestruc_t st_mtim; 1237c478bd9Sstevel@tonic-gate timestruc_t st_ctim; 1247c478bd9Sstevel@tonic-gate blksize_t st_blksize; 1257c478bd9Sstevel@tonic-gate blkcnt_t st_blocks; 1267c478bd9Sstevel@tonic-gate char st_fstype[_ST_FSTYPSZ]; 1277c478bd9Sstevel@tonic-gate long st_pad4[8]; /* expansion area */ 1287c478bd9Sstevel@tonic-gate }; 1297c478bd9Sstevel@tonic-gate 1307c478bd9Sstevel@tonic-gate struct stat64 { 1317c478bd9Sstevel@tonic-gate dev_t st_dev; 1327c478bd9Sstevel@tonic-gate long st_pad1[3]; /* reserve for dev expansion, */ 1337c478bd9Sstevel@tonic-gate /* sysid definition */ 1347c478bd9Sstevel@tonic-gate ino64_t st_ino; 1357c478bd9Sstevel@tonic-gate mode_t st_mode; 1367c478bd9Sstevel@tonic-gate nlink_t st_nlink; 1377c478bd9Sstevel@tonic-gate uid_t st_uid; 1387c478bd9Sstevel@tonic-gate gid_t st_gid; 1397c478bd9Sstevel@tonic-gate dev_t st_rdev; 1407c478bd9Sstevel@tonic-gate long st_pad2[2]; 1417c478bd9Sstevel@tonic-gate off64_t st_size; /* large file support */ 1427c478bd9Sstevel@tonic-gate timestruc_t st_atim; 1437c478bd9Sstevel@tonic-gate timestruc_t st_mtim; 1447c478bd9Sstevel@tonic-gate timestruc_t st_ctim; 1457c478bd9Sstevel@tonic-gate blksize_t st_blksize; 1467c478bd9Sstevel@tonic-gate blkcnt64_t st_blocks; /* large file support */ 1477c478bd9Sstevel@tonic-gate char st_fstype[_ST_FSTYPSZ]; 1487c478bd9Sstevel@tonic-gate long st_pad4[8]; /* expansion area */ 1497c478bd9Sstevel@tonic-gate }; 1507c478bd9Sstevel@tonic-gate 1517c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 1527c478bd9Sstevel@tonic-gate 1537c478bd9Sstevel@tonic-gate #else /* !defined(_KERNEL) */ 1547c478bd9Sstevel@tonic-gate 1557c478bd9Sstevel@tonic-gate /* 1567c478bd9Sstevel@tonic-gate * large file compilation environment setup 1577c478bd9Sstevel@tonic-gate */ 1587c478bd9Sstevel@tonic-gate #if !defined(_LP64) && _FILE_OFFSET_BITS == 64 1597c478bd9Sstevel@tonic-gate #ifdef __PRAGMA_REDEFINE_EXTNAME 1607c478bd9Sstevel@tonic-gate #pragma redefine_extname fstat fstat64 1617c478bd9Sstevel@tonic-gate #pragma redefine_extname stat stat64 1627c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) || \ 1637c478bd9Sstevel@tonic-gate defined(_ATFILE_SOURCE) 1647c478bd9Sstevel@tonic-gate #pragma redefine_extname fstatat fstatat64 1657c478bd9Sstevel@tonic-gate #endif /* defined (_ATFILE_SOURCE) */ 1667c478bd9Sstevel@tonic-gate 1677c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(_XPG_2) || defined(__EXTENSIONS__) 1687c478bd9Sstevel@tonic-gate #pragma redefine_extname lstat lstat64 1697c478bd9Sstevel@tonic-gate #endif 1707c478bd9Sstevel@tonic-gate #else /* __PRAGMA_REDEFINE_EXTNAME */ 1717c478bd9Sstevel@tonic-gate #define fstat fstat64 1727c478bd9Sstevel@tonic-gate #define stat stat64 1737c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) || \ 1747c478bd9Sstevel@tonic-gate defined(_ATFILE_SOURCE) 1757c478bd9Sstevel@tonic-gate #define fstatat fstatat64 1767c478bd9Sstevel@tonic-gate #endif /* defined (_ATFILE_SOURCE) */ 1777c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(_XPG_2) || defined(__EXTENSIONS__) 1787c478bd9Sstevel@tonic-gate #define lstat lstat64 1797c478bd9Sstevel@tonic-gate #endif 1807c478bd9Sstevel@tonic-gate #endif /* __PRAGMA_REDEFINE_EXTNAME */ 1817c478bd9Sstevel@tonic-gate #endif /* !_LP64 && _FILE_OFFSET_BITS == 64 */ 1827c478bd9Sstevel@tonic-gate 1837c478bd9Sstevel@tonic-gate /* 1847c478bd9Sstevel@tonic-gate * In the LP64 compilation environment, map large file interfaces 1857c478bd9Sstevel@tonic-gate * back to native versions where possible. 1867c478bd9Sstevel@tonic-gate */ 1877c478bd9Sstevel@tonic-gate #if defined(_LP64) && defined(_LARGEFILE64_SOURCE) 1887c478bd9Sstevel@tonic-gate #ifdef __PRAGMA_REDEFINE_EXTNAME 1897c478bd9Sstevel@tonic-gate #pragma redefine_extname fstat64 fstat 1907c478bd9Sstevel@tonic-gate #pragma redefine_extname stat64 stat 1917c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) || \ 1927c478bd9Sstevel@tonic-gate defined(_ATFILE_SOURCE) 1937c478bd9Sstevel@tonic-gate #pragma redefine_extname fstatat64 fstatat 1947c478bd9Sstevel@tonic-gate #endif /* defined (_ATFILE_SOURCE) */ 1957c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(_XPG_2) || defined(__EXTENSIONS__) 1967c478bd9Sstevel@tonic-gate #pragma redefine_extname lstat64 lstat 1977c478bd9Sstevel@tonic-gate #endif 1987c478bd9Sstevel@tonic-gate #else /* __PRAGMA_REDEFINE_EXTNAME */ 1997c478bd9Sstevel@tonic-gate #define fstat64 fstat 2007c478bd9Sstevel@tonic-gate #define stat64 stat 2017c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) || \ 2027c478bd9Sstevel@tonic-gate defined(_ATFILE_SOURCE) 2037c478bd9Sstevel@tonic-gate #define fstatat64 fstatat 2047c478bd9Sstevel@tonic-gate #endif /* defined (_ATFILE_SOURCE) */ 2057c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(_XPG_2) || defined(__EXTENSIONS__) 2067c478bd9Sstevel@tonic-gate #define lstat64 lstat 2077c478bd9Sstevel@tonic-gate #endif 2087c478bd9Sstevel@tonic-gate #endif /* __PRAGMA_REDEFINE_EXTNAME */ 2097c478bd9Sstevel@tonic-gate #endif /* _LP64 && _LARGEFILE64_SOURCE */ 2107c478bd9Sstevel@tonic-gate 2117c478bd9Sstevel@tonic-gate /* 2127c478bd9Sstevel@tonic-gate * User level stat structure definitions. 2137c478bd9Sstevel@tonic-gate */ 2147c478bd9Sstevel@tonic-gate 2157c478bd9Sstevel@tonic-gate #if defined(_LP64) 2167c478bd9Sstevel@tonic-gate 2177c478bd9Sstevel@tonic-gate struct stat { 2187c478bd9Sstevel@tonic-gate dev_t st_dev; 2197c478bd9Sstevel@tonic-gate ino_t st_ino; 2207c478bd9Sstevel@tonic-gate mode_t st_mode; 2217c478bd9Sstevel@tonic-gate nlink_t st_nlink; 2227c478bd9Sstevel@tonic-gate uid_t st_uid; 2237c478bd9Sstevel@tonic-gate gid_t st_gid; 2247c478bd9Sstevel@tonic-gate dev_t st_rdev; 2257c478bd9Sstevel@tonic-gate off_t st_size; 2267c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 2277c478bd9Sstevel@tonic-gate timestruc_t st_atim; 2287c478bd9Sstevel@tonic-gate timestruc_t st_mtim; 2297c478bd9Sstevel@tonic-gate timestruc_t st_ctim; 2307c478bd9Sstevel@tonic-gate #else 2317c478bd9Sstevel@tonic-gate _timestruc_t st_atim; 2327c478bd9Sstevel@tonic-gate _timestruc_t st_mtim; 2337c478bd9Sstevel@tonic-gate _timestruc_t st_ctim; 2347c478bd9Sstevel@tonic-gate #endif 2357c478bd9Sstevel@tonic-gate blksize_t st_blksize; 2367c478bd9Sstevel@tonic-gate blkcnt_t st_blocks; 2377c478bd9Sstevel@tonic-gate char st_fstype[_ST_FSTYPSZ]; 2387c478bd9Sstevel@tonic-gate }; 2397c478bd9Sstevel@tonic-gate 2407c478bd9Sstevel@tonic-gate #else /* _LP64 */ 2417c478bd9Sstevel@tonic-gate 2427c478bd9Sstevel@tonic-gate struct stat { 2437c478bd9Sstevel@tonic-gate dev_t st_dev; 2447c478bd9Sstevel@tonic-gate long st_pad1[3]; /* reserved for network id */ 2457c478bd9Sstevel@tonic-gate ino_t st_ino; 2467c478bd9Sstevel@tonic-gate mode_t st_mode; 2477c478bd9Sstevel@tonic-gate nlink_t st_nlink; 2487c478bd9Sstevel@tonic-gate uid_t st_uid; 2497c478bd9Sstevel@tonic-gate gid_t st_gid; 2507c478bd9Sstevel@tonic-gate dev_t st_rdev; 2517c478bd9Sstevel@tonic-gate long st_pad2[2]; 2527c478bd9Sstevel@tonic-gate off_t st_size; 2537c478bd9Sstevel@tonic-gate #if _FILE_OFFSET_BITS != 64 2547c478bd9Sstevel@tonic-gate long st_pad3; /* future off_t expansion */ 2557c478bd9Sstevel@tonic-gate #endif 2567c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 2577c478bd9Sstevel@tonic-gate timestruc_t st_atim; 2587c478bd9Sstevel@tonic-gate timestruc_t st_mtim; 2597c478bd9Sstevel@tonic-gate timestruc_t st_ctim; 2607c478bd9Sstevel@tonic-gate #else 2617c478bd9Sstevel@tonic-gate _timestruc_t st_atim; 2627c478bd9Sstevel@tonic-gate _timestruc_t st_mtim; 2637c478bd9Sstevel@tonic-gate _timestruc_t st_ctim; 2647c478bd9Sstevel@tonic-gate #endif 2657c478bd9Sstevel@tonic-gate blksize_t st_blksize; 2667c478bd9Sstevel@tonic-gate blkcnt_t st_blocks; 2677c478bd9Sstevel@tonic-gate char st_fstype[_ST_FSTYPSZ]; 2687c478bd9Sstevel@tonic-gate long st_pad4[8]; /* expansion area */ 2697c478bd9Sstevel@tonic-gate }; 2707c478bd9Sstevel@tonic-gate 2717c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 2727c478bd9Sstevel@tonic-gate 2737c478bd9Sstevel@tonic-gate /* transitional large file interface version */ 2747c478bd9Sstevel@tonic-gate #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ 2757c478bd9Sstevel@tonic-gate !defined(__PRAGMA_REDEFINE_EXTNAME)) 2767c478bd9Sstevel@tonic-gate #if defined(_LP64) 2777c478bd9Sstevel@tonic-gate 2787c478bd9Sstevel@tonic-gate struct stat64 { 2797c478bd9Sstevel@tonic-gate dev_t st_dev; 2807c478bd9Sstevel@tonic-gate ino_t st_ino; 2817c478bd9Sstevel@tonic-gate mode_t st_mode; 2827c478bd9Sstevel@tonic-gate nlink_t st_nlink; 2837c478bd9Sstevel@tonic-gate uid_t st_uid; 2847c478bd9Sstevel@tonic-gate gid_t st_gid; 2857c478bd9Sstevel@tonic-gate dev_t st_rdev; 2867c478bd9Sstevel@tonic-gate off_t st_size; 2877c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 2887c478bd9Sstevel@tonic-gate timestruc_t st_atim; 2897c478bd9Sstevel@tonic-gate timestruc_t st_mtim; 2907c478bd9Sstevel@tonic-gate timestruc_t st_ctim; 2917c478bd9Sstevel@tonic-gate #else 2927c478bd9Sstevel@tonic-gate _timestruc_t st_atim; 2937c478bd9Sstevel@tonic-gate _timestruc_t st_mtim; 2947c478bd9Sstevel@tonic-gate _timestruc_t st_ctim; 2957c478bd9Sstevel@tonic-gate #endif 2967c478bd9Sstevel@tonic-gate blksize_t st_blksize; 2977c478bd9Sstevel@tonic-gate blkcnt_t st_blocks; 2987c478bd9Sstevel@tonic-gate char st_fstype[_ST_FSTYPSZ]; 2997c478bd9Sstevel@tonic-gate }; 3007c478bd9Sstevel@tonic-gate 3017c478bd9Sstevel@tonic-gate #else /* _LP64 */ 3027c478bd9Sstevel@tonic-gate 3037c478bd9Sstevel@tonic-gate struct stat64 { 3047c478bd9Sstevel@tonic-gate dev_t st_dev; 3057c478bd9Sstevel@tonic-gate long st_pad1[3]; /* reserved for network id */ 3067c478bd9Sstevel@tonic-gate ino64_t st_ino; 3077c478bd9Sstevel@tonic-gate mode_t st_mode; 3087c478bd9Sstevel@tonic-gate nlink_t st_nlink; 3097c478bd9Sstevel@tonic-gate uid_t st_uid; 3107c478bd9Sstevel@tonic-gate gid_t st_gid; 3117c478bd9Sstevel@tonic-gate dev_t st_rdev; 3127c478bd9Sstevel@tonic-gate long st_pad2[2]; 3137c478bd9Sstevel@tonic-gate off64_t st_size; 3147c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 3157c478bd9Sstevel@tonic-gate timestruc_t st_atim; 3167c478bd9Sstevel@tonic-gate timestruc_t st_mtim; 3177c478bd9Sstevel@tonic-gate timestruc_t st_ctim; 3187c478bd9Sstevel@tonic-gate #else 3197c478bd9Sstevel@tonic-gate _timestruc_t st_atim; 3207c478bd9Sstevel@tonic-gate _timestruc_t st_mtim; 3217c478bd9Sstevel@tonic-gate _timestruc_t st_ctim; 3227c478bd9Sstevel@tonic-gate #endif 3237c478bd9Sstevel@tonic-gate blksize_t st_blksize; 3247c478bd9Sstevel@tonic-gate blkcnt64_t st_blocks; 3257c478bd9Sstevel@tonic-gate char st_fstype[_ST_FSTYPSZ]; 3267c478bd9Sstevel@tonic-gate long st_pad4[8]; /* expansion area */ 3277c478bd9Sstevel@tonic-gate }; 3287c478bd9Sstevel@tonic-gate 3297c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 3307c478bd9Sstevel@tonic-gate #endif 3317c478bd9Sstevel@tonic-gate 3327c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 3337c478bd9Sstevel@tonic-gate #define st_atime st_atim.tv_sec 3347c478bd9Sstevel@tonic-gate #define st_mtime st_mtim.tv_sec 3357c478bd9Sstevel@tonic-gate #define st_ctime st_ctim.tv_sec 3367c478bd9Sstevel@tonic-gate #else 3377c478bd9Sstevel@tonic-gate #define st_atime st_atim.__tv_sec 3387c478bd9Sstevel@tonic-gate #define st_mtime st_mtim.__tv_sec 3397c478bd9Sstevel@tonic-gate #define st_ctime st_ctim.__tv_sec 3407c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 3417c478bd9Sstevel@tonic-gate 3427c478bd9Sstevel@tonic-gate #endif /* end defined(_KERNEL) */ 3437c478bd9Sstevel@tonic-gate 3447c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) 3457c478bd9Sstevel@tonic-gate 3467c478bd9Sstevel@tonic-gate /* 3477c478bd9Sstevel@tonic-gate * Kernel's view of user ILP32 stat and stat64 structures 3487c478bd9Sstevel@tonic-gate */ 3497c478bd9Sstevel@tonic-gate 3507c478bd9Sstevel@tonic-gate struct stat32 { 3517c478bd9Sstevel@tonic-gate dev32_t st_dev; 3527c478bd9Sstevel@tonic-gate int32_t st_pad1[3]; 3537c478bd9Sstevel@tonic-gate ino32_t st_ino; 3547c478bd9Sstevel@tonic-gate mode32_t st_mode; 3557c478bd9Sstevel@tonic-gate nlink32_t st_nlink; 3567c478bd9Sstevel@tonic-gate uid32_t st_uid; 3577c478bd9Sstevel@tonic-gate gid32_t st_gid; 3587c478bd9Sstevel@tonic-gate dev32_t st_rdev; 3597c478bd9Sstevel@tonic-gate int32_t st_pad2[2]; 3607c478bd9Sstevel@tonic-gate off32_t st_size; 3617c478bd9Sstevel@tonic-gate int32_t st_pad3; 3627c478bd9Sstevel@tonic-gate timestruc32_t st_atim; 3637c478bd9Sstevel@tonic-gate timestruc32_t st_mtim; 3647c478bd9Sstevel@tonic-gate timestruc32_t st_ctim; 3657c478bd9Sstevel@tonic-gate int32_t st_blksize; 3667c478bd9Sstevel@tonic-gate blkcnt32_t st_blocks; 3677c478bd9Sstevel@tonic-gate char st_fstype[_ST_FSTYPSZ]; 3687c478bd9Sstevel@tonic-gate int32_t st_pad4[8]; 3697c478bd9Sstevel@tonic-gate }; 3707c478bd9Sstevel@tonic-gate 3717c478bd9Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 3727c478bd9Sstevel@tonic-gate #pragma pack(4) 3737c478bd9Sstevel@tonic-gate #endif 3747c478bd9Sstevel@tonic-gate 3757c478bd9Sstevel@tonic-gate struct stat64_32 { 3767c478bd9Sstevel@tonic-gate dev32_t st_dev; 3777c478bd9Sstevel@tonic-gate int32_t st_pad1[3]; 3787c478bd9Sstevel@tonic-gate ino64_t st_ino; 3797c478bd9Sstevel@tonic-gate mode32_t st_mode; 3807c478bd9Sstevel@tonic-gate nlink32_t st_nlink; 3817c478bd9Sstevel@tonic-gate uid32_t st_uid; 3827c478bd9Sstevel@tonic-gate gid32_t st_gid; 3837c478bd9Sstevel@tonic-gate dev32_t st_rdev; 3847c478bd9Sstevel@tonic-gate int32_t st_pad2[2]; 3857c478bd9Sstevel@tonic-gate off64_t st_size; 3867c478bd9Sstevel@tonic-gate timestruc32_t st_atim; 3877c478bd9Sstevel@tonic-gate timestruc32_t st_mtim; 3887c478bd9Sstevel@tonic-gate timestruc32_t st_ctim; 3897c478bd9Sstevel@tonic-gate int32_t st_blksize; 3907c478bd9Sstevel@tonic-gate blkcnt64_t st_blocks; 3917c478bd9Sstevel@tonic-gate char st_fstype[_ST_FSTYPSZ]; 3927c478bd9Sstevel@tonic-gate int32_t st_pad4[8]; 3937c478bd9Sstevel@tonic-gate }; 3947c478bd9Sstevel@tonic-gate 3957c478bd9Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 3967c478bd9Sstevel@tonic-gate #pragma pack() 3977c478bd9Sstevel@tonic-gate #endif 3987c478bd9Sstevel@tonic-gate 3997c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 4007c478bd9Sstevel@tonic-gate 4017c478bd9Sstevel@tonic-gate /* MODE MASKS */ 4027c478bd9Sstevel@tonic-gate 4037c478bd9Sstevel@tonic-gate /* de facto standard definitions */ 4047c478bd9Sstevel@tonic-gate 4057c478bd9Sstevel@tonic-gate #define S_IFMT 0xF000 /* type of file */ 4067c478bd9Sstevel@tonic-gate #define S_IAMB 0x1FF /* access mode bits */ 4077c478bd9Sstevel@tonic-gate #define S_IFIFO 0x1000 /* fifo */ 4087c478bd9Sstevel@tonic-gate #define S_IFCHR 0x2000 /* character special */ 4097c478bd9Sstevel@tonic-gate #define S_IFDIR 0x4000 /* directory */ 4107c478bd9Sstevel@tonic-gate /* XENIX definitions are not relevant to Solaris */ 4117c478bd9Sstevel@tonic-gate #define S_IFNAM 0x5000 /* XENIX special named file */ 4127c478bd9Sstevel@tonic-gate #define S_INSEM 0x1 /* XENIX semaphore subtype of IFNAM */ 4137c478bd9Sstevel@tonic-gate #define S_INSHD 0x2 /* XENIX shared data subtype of IFNAM */ 4147c478bd9Sstevel@tonic-gate #define S_IFBLK 0x6000 /* block special */ 4157c478bd9Sstevel@tonic-gate #define S_IFREG 0x8000 /* regular */ 4167c478bd9Sstevel@tonic-gate #define S_IFLNK 0xA000 /* symbolic link */ 4177c478bd9Sstevel@tonic-gate #define S_IFSOCK 0xC000 /* socket */ 4187c478bd9Sstevel@tonic-gate #define S_IFDOOR 0xD000 /* door */ 4197c478bd9Sstevel@tonic-gate #define S_IFPORT 0xE000 /* event port */ 4207c478bd9Sstevel@tonic-gate #define S_ISUID 0x800 /* set user id on execution */ 4217c478bd9Sstevel@tonic-gate #define S_ISGID 0x400 /* set group id on execution */ 4227c478bd9Sstevel@tonic-gate #define S_ISVTX 0x200 /* save swapped text even after use */ 4237c478bd9Sstevel@tonic-gate #define S_IREAD 00400 /* read permission, owner */ 4247c478bd9Sstevel@tonic-gate #define S_IWRITE 00200 /* write permission, owner */ 4257c478bd9Sstevel@tonic-gate #define S_IEXEC 00100 /* execute/search permission, owner */ 4267c478bd9Sstevel@tonic-gate #define S_ENFMT S_ISGID /* record locking enforcement flag */ 4277c478bd9Sstevel@tonic-gate 4287c478bd9Sstevel@tonic-gate /* the following macros are for POSIX conformance */ 4297c478bd9Sstevel@tonic-gate 4307c478bd9Sstevel@tonic-gate #define S_IRWXU 00700 /* read, write, execute: owner */ 4317c478bd9Sstevel@tonic-gate #define S_IRUSR 00400 /* read permission: owner */ 4327c478bd9Sstevel@tonic-gate #define S_IWUSR 00200 /* write permission: owner */ 4337c478bd9Sstevel@tonic-gate #define S_IXUSR 00100 /* execute permission: owner */ 4347c478bd9Sstevel@tonic-gate #define S_IRWXG 00070 /* read, write, execute: group */ 4357c478bd9Sstevel@tonic-gate #define S_IRGRP 00040 /* read permission: group */ 4367c478bd9Sstevel@tonic-gate #define S_IWGRP 00020 /* write permission: group */ 4377c478bd9Sstevel@tonic-gate #define S_IXGRP 00010 /* execute permission: group */ 4387c478bd9Sstevel@tonic-gate #define S_IRWXO 00007 /* read, write, execute: other */ 4397c478bd9Sstevel@tonic-gate #define S_IROTH 00004 /* read permission: other */ 4407c478bd9Sstevel@tonic-gate #define S_IWOTH 00002 /* write permission: other */ 4417c478bd9Sstevel@tonic-gate #define S_IXOTH 00001 /* execute permission: other */ 4427c478bd9Sstevel@tonic-gate 4437c478bd9Sstevel@tonic-gate 4447c478bd9Sstevel@tonic-gate #define S_ISFIFO(mode) (((mode)&0xF000) == 0x1000) 4457c478bd9Sstevel@tonic-gate #define S_ISCHR(mode) (((mode)&0xF000) == 0x2000) 4467c478bd9Sstevel@tonic-gate #define S_ISDIR(mode) (((mode)&0xF000) == 0x4000) 4477c478bd9Sstevel@tonic-gate #define S_ISBLK(mode) (((mode)&0xF000) == 0x6000) 4487c478bd9Sstevel@tonic-gate #define S_ISREG(mode) (((mode)&0xF000) == 0x8000) 4497c478bd9Sstevel@tonic-gate #define S_ISLNK(mode) (((mode)&0xF000) == 0xa000) 4507c478bd9Sstevel@tonic-gate #define S_ISSOCK(mode) (((mode)&0xF000) == 0xc000) 4517c478bd9Sstevel@tonic-gate #define S_ISDOOR(mode) (((mode)&0xF000) == 0xd000) 4527c478bd9Sstevel@tonic-gate #define S_ISPORT(mode) (((mode)&0xF000) == 0xe000) 4537c478bd9Sstevel@tonic-gate 4547c478bd9Sstevel@tonic-gate /* POSIX.4 macros */ 4557c478bd9Sstevel@tonic-gate #define S_TYPEISMQ(_buf) (0) 4567c478bd9Sstevel@tonic-gate #define S_TYPEISSEM(_buf) (0) 4577c478bd9Sstevel@tonic-gate #define S_TYPEISSHM(_buf) (0) 4587c478bd9Sstevel@tonic-gate 4597c478bd9Sstevel@tonic-gate #if defined(__i386) || (defined(__i386_COMPAT) && defined(_KERNEL)) 4607c478bd9Sstevel@tonic-gate 4617c478bd9Sstevel@tonic-gate /* 4627c478bd9Sstevel@tonic-gate * A version number is included in the x86 SVR4 stat and mknod interfaces 4637c478bd9Sstevel@tonic-gate * so that SVR4 binaries can be supported. An LP64 kernel that supports 4647c478bd9Sstevel@tonic-gate * the i386 ABI need to be aware of this too. 4657c478bd9Sstevel@tonic-gate */ 4667c478bd9Sstevel@tonic-gate 4677c478bd9Sstevel@tonic-gate #define _R3_MKNOD_VER 1 /* SVR3.0 mknod */ 4687c478bd9Sstevel@tonic-gate #define _MKNOD_VER 2 /* current version of mknod */ 4697c478bd9Sstevel@tonic-gate #define _R3_STAT_VER 1 /* SVR3.0 stat */ 4707c478bd9Sstevel@tonic-gate #define _STAT_VER 2 /* current version of stat */ 4717c478bd9Sstevel@tonic-gate 4727c478bd9Sstevel@tonic-gate #endif /* __i386 || (__i386_COMPAT && _KERNEL) */ 4737c478bd9Sstevel@tonic-gate 4743b862e9aSRoger A. Faulkner #if defined(__EXTENSIONS__) || \ 4753b862e9aSRoger A. Faulkner (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) 4763b862e9aSRoger A. Faulkner /* || defined(_XPG7) */ 4773b862e9aSRoger A. Faulkner /* for use with futimens() and utimensat() */ 4783b862e9aSRoger A. Faulkner #define UTIME_NOW -1L 4793b862e9aSRoger A. Faulkner #define UTIME_OMIT -2L 4803b862e9aSRoger A. Faulkner #endif /* defined(__EXTENSIONS__) ... */ 4813b862e9aSRoger A. Faulkner 4827c478bd9Sstevel@tonic-gate #if !defined(_KERNEL) || defined(_BOOT) 4837c478bd9Sstevel@tonic-gate 4847c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || \ 4857c478bd9Sstevel@tonic-gate defined(_XPG4_2) || defined(__EXTENSIONS__) 4867c478bd9Sstevel@tonic-gate extern int fchmod(int, mode_t); 4877c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2)... */ 4887c478bd9Sstevel@tonic-gate 4897c478bd9Sstevel@tonic-gate extern int chmod(const char *, mode_t); 4907c478bd9Sstevel@tonic-gate extern int mkdir(const char *, mode_t); 4917c478bd9Sstevel@tonic-gate extern int mkfifo(const char *, mode_t); 4927c478bd9Sstevel@tonic-gate extern mode_t umask(mode_t); 4937c478bd9Sstevel@tonic-gate 4947c478bd9Sstevel@tonic-gate /* transitional large file interfaces */ 4957c478bd9Sstevel@tonic-gate #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ 4967c478bd9Sstevel@tonic-gate !defined(__PRAGMA_REDEFINE_EXTNAME)) 4977c478bd9Sstevel@tonic-gate extern int fstat64(int, struct stat64 *); 4987c478bd9Sstevel@tonic-gate extern int stat64(const char *_RESTRICT_KYWD, struct stat64 *_RESTRICT_KYWD); 4997c478bd9Sstevel@tonic-gate extern int lstat64(const char *_RESTRICT_KYWD, struct stat64 *_RESTRICT_KYWD); 5007c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) || \ 5017c478bd9Sstevel@tonic-gate defined(_ATFILE_SOURCE) 5027c478bd9Sstevel@tonic-gate extern int fstatat64(int, const char *, struct stat64 *, int); 5037c478bd9Sstevel@tonic-gate #endif /* defined (_ATFILE_SOURCE) */ 5047c478bd9Sstevel@tonic-gate #endif 5057c478bd9Sstevel@tonic-gate 506794f0adbSRoger A. Faulkner #if defined(__EXTENSIONS__) || defined(_ATFILE_SOURCE) || \ 5073b862e9aSRoger A. Faulkner (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) 5083b862e9aSRoger A. Faulkner /* || defined(_XPG7) */ 509794f0adbSRoger A. Faulkner extern int mkdirat(int, const char *, mode_t); 510794f0adbSRoger A. Faulkner extern int mkfifoat(int, const char *, mode_t); 511794f0adbSRoger A. Faulkner extern int mknodat(int, const char *, mode_t, dev_t); 512794f0adbSRoger A. Faulkner extern int fchmodat(int, const char *, mode_t, int); 5133b862e9aSRoger A. Faulkner extern int futimens(int, const struct timespec[2]); 5143b862e9aSRoger A. Faulkner extern int utimensat(int, const char *, const struct timespec[2], int); 5153b862e9aSRoger A. Faulkner #endif /* defined(__EXTENSIONS__) ... */ 5163b862e9aSRoger A. Faulkner 5177c478bd9Sstevel@tonic-gate #include <sys/stat_impl.h> 5187c478bd9Sstevel@tonic-gate 5197c478bd9Sstevel@tonic-gate #endif /* !defined(_KERNEL) */ 5207c478bd9Sstevel@tonic-gate 5217c478bd9Sstevel@tonic-gate #ifdef __cplusplus 5227c478bd9Sstevel@tonic-gate } 5237c478bd9Sstevel@tonic-gate #endif 5247c478bd9Sstevel@tonic-gate 5257c478bd9Sstevel@tonic-gate #endif /* _SYS_STAT_H */ 526