| 1 | /* Copyright (C) 1992-2022 Free Software Foundation, Inc. |
| 2 | This file is part of the GNU C Library. |
| 3 | |
| 4 | The GNU C Library is free software; you can redistribute it and/or |
| 5 | modify it under the terms of the GNU Lesser General Public |
| 6 | License as published by the Free Software Foundation; either |
| 7 | version 2.1 of the License, or (at your option) any later version. |
| 8 | |
| 9 | The GNU C Library is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | Lesser General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU Lesser General Public |
| 15 | License along with the GNU C Library; if not, see |
| 16 | <https://www.gnu.org/licenses/>. */ |
| 17 | |
| 18 | #if !defined _SYS_STAT_H && !defined _FCNTL_H |
| 19 | # error "Never include <bits/stat.h> directly; use <sys/stat.h> instead." |
| 20 | #endif |
| 21 | |
| 22 | #ifndef _BITS_STAT_H |
| 23 | #define _BITS_STAT_H 1 |
| 24 | |
| 25 | #include <bits/struct_stat.h> |
| 26 | |
| 27 | /* Encoding of the file mode. */ |
| 28 | |
| 29 | #define __S_IFMT 0170000 /* These bits determine file type. */ |
| 30 | |
| 31 | /* File types. */ |
| 32 | #define __S_IFDIR 0040000 /* Directory. */ |
| 33 | #define __S_IFCHR 0020000 /* Character device. */ |
| 34 | #define __S_IFBLK 0060000 /* Block device. */ |
| 35 | #define __S_IFREG 0100000 /* Regular file. */ |
| 36 | #define __S_IFIFO 0010000 /* FIFO. */ |
| 37 | #define __S_IFLNK 0120000 /* Symbolic link. */ |
| 38 | #define __S_IFSOCK 0140000 /* Socket. */ |
| 39 | |
| 40 | /* POSIX.1b objects. Note that these macros always evaluate to zero. But |
| 41 | they do it by enforcing the correct use of the macros. */ |
| 42 | #define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) |
| 43 | #define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) |
| 44 | #define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) |
| 45 | |
| 46 | /* Protection bits. */ |
| 47 | |
| 48 | #define __S_ISUID 04000 /* Set user ID on execution. */ |
| 49 | #define __S_ISGID 02000 /* Set group ID on execution. */ |
| 50 | #define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ |
| 51 | #define __S_IREAD 0400 /* Read by owner. */ |
| 52 | #define __S_IWRITE 0200 /* Write by owner. */ |
| 53 | #define __S_IEXEC 0100 /* Execute by owner. */ |
| 54 | |
| 55 | #ifdef __USE_ATFILE |
| 56 | # define UTIME_NOW ((1l << 30) - 1l) |
| 57 | # define UTIME_OMIT ((1l << 30) - 2l) |
| 58 | #endif |
| 59 | |
| 60 | #endif /* bits/stat.h */ |
| 61 | |