| // |
| // Copyright © 2005-2020 Rich Felker, et al. |
| // Licensed under the MIT license. |
| // |
| |
| /* Copyright © 2005-2020 Rich Felker, et al. |
| |
| Permission is hereby granted, free of charge, to any person obtaining |
| a copy of this software and associated documentation files (the |
| "Software"), to deal in the Software without restriction, including |
| without limitation the rights to use, copy, modify, merge, publish, |
| distribute, sublicense, and/or sell copies of the Software, and to |
| permit persons to whom the Software is furnished to do so, subject to |
| the following conditions: |
| |
| The above copyright notice and this permission notice shall be |
| included in all copies or substantial portions of the Software. |
| |
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ |
| |
| |
| #ifndef _SYS_STAT_H_ |
| #define _SYS_STAT_H_ |
| |
| #include <sys/_types.h> |
| #include <sys/types.h> |
| #include <sys/struct_timespec.h> |
| |
| typedef __dev_t dev_t; |
| typedef __ino_t ino_t; |
| typedef __ino64_t ino64_t; |
| typedef __mode_t mode_t; |
| typedef __nlink_t nlink_t; |
| typedef __uid_t uid_t; |
| typedef __gid_t gid_t; |
| typedef __blksize_t blksize_t; |
| typedef __blkcnt_t blkcnt_t; |
| typedef __blkcnt64_t blkcnt64_t; |
| |
| struct stat { |
| dev_t st_dev; |
| ino_t st_ino; |
| nlink_t st_nlink; |
| |
| mode_t st_mode; |
| uid_t st_uid; |
| gid_t st_gid; |
| unsigned int __pad0; |
| dev_t st_rdev; |
| off_t st_size; |
| blksize_t st_blksize; |
| blkcnt_t st_blocks; |
| |
| struct timespec st_atim; |
| struct timespec st_mtim; |
| struct timespec st_ctim; |
| long __unused[3]; |
| }; |
| |
| struct stat64 { |
| dev_t st_dev; |
| ino64_t st_ino; |
| nlink_t st_nlink; |
| |
| mode_t st_mode; |
| uid_t st_uid; |
| gid_t st_gid; |
| unsigned int __pad0; |
| dev_t st_rdev; |
| off_t st_size; |
| blksize_t st_blksize; |
| blkcnt64_t st_blocks; |
| |
| struct timespec st_atim; |
| struct timespec st_mtim; |
| struct timespec st_ctim; |
| long __unused[3]; |
| }; |
| |
| #define S_IFMT 0170000 |
| |
| #define S_IFDIR 0040000 |
| #define S_IFCHR 0020000 |
| #define S_IFBLK 0060000 |
| #define S_IFREG 0100000 |
| #define S_IFIFO 0010000 |
| #define S_IFLNK 0120000 |
| #define S_IFSOCK 0140000 |
| |
| #define S_TYPEISMQ(buf) 0 |
| #define S_TYPEISSEM(buf) 0 |
| #define S_TYPEISSHM(buf) 0 |
| #define S_TYPEISTMO(buf) 0 |
| |
| #define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) |
| #define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR) |
| #define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK) |
| #define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) |
| #define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO) |
| #define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK) |
| #define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK) |
| |
| #ifndef S_IRUSR |
| #define S_ISUID 04000 |
| #define S_ISGID 02000 |
| #define S_ISVTX 01000 |
| #define S_IRUSR 0400 |
| #define S_IWUSR 0200 |
| #define S_IXUSR 0100 |
| #define S_IRWXU 0700 |
| #define S_IRGRP 0040 |
| #define S_IWGRP 0020 |
| #define S_IXGRP 0010 |
| #define S_IRWXG 0070 |
| #define S_IROTH 0004 |
| #define S_IWOTH 0002 |
| #define S_IXOTH 0001 |
| #define S_IRWXO 0007 |
| #endif |
| |
| #endif /* _SYS_STAT_H_ */ |