stat.h (2378B)
1 /* -*-comment-start: "//";comment-end:""-*- 2 * GNU Mes --- Maxwell Equations of Software 3 * Copyright © 2017,2024 Janneke Nieuwenhuizen <janneke@gnu.org> 4 * Copyright © 2022 Dor Askayo <dor.askayo@gmail.com> 5 * 6 * This file is part of GNU Mes. 7 * 8 * GNU Mes is free software; you can redistribute it and/or modify it 9 * under the terms of the GNU General Public License as published by 10 * the Free Software Foundation; either version 3 of the License, or (at 11 * your option) any later version. 12 * 13 * GNU Mes is distributed in the hope that it will be useful, but 14 * WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. 20 */ 21 #ifndef __MES_SYS_STAT_H 22 #define __MES_SYS_STAT_H 1 23 24 #if SYSTEM_LIBC 25 #undef __MES_SYS_STAT_H 26 #include_next <sys/stat.h> 27 28 #else // ! SYSTEM_LIBC 29 30 #include <time.h> 31 #include <sys/types.h> 32 33 #ifndef __MES_MODE_T 34 #define __MES_MODE_T 35 typedef int mode_t; 36 #endif 37 38 #include <arch/kernel-stat.h> 39 40 int chmod (char const *file_name, mode_t mode); 41 int fstat (int filedes, struct stat *buf); 42 int mkdir (char const *file_name, mode_t mode); 43 int mknod (char const *file_name, mode_t mode, dev_t dev); 44 int chown (char const *file_name, uid_t owner, gid_t group); 45 int rmdir (char const *file_name); 46 int stat (char const *file_name, struct stat *buf); 47 int lstat (char const *file_name, struct stat *buf); 48 mode_t umask (mode_t mask); 49 int utimensat(int dirfd, char const *file_name, 50 struct timespec const *times, int flags); 51 52 #define S_IFIFO 0010000 53 #define S_IFCHR 0020000 54 #define S_IFDIR 0040000 55 #define S_IFBLK 0060000 56 #define S_IFREG 0100000 57 #define S_IFLNK 0120000 58 #define S_IFMT 0170000 59 60 #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) 61 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) 62 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) 63 64 #define S_IRWXU 00700 65 #define S_IXUSR 00100 66 #define S_IWUSR 00200 67 #define S_IRUSR 00400 68 69 #define S_ISUID 04000 70 #define S_ISGID 02000 71 #define S_IXGRP 00010 72 #define S_IXOTH 00001 73 #define S_IRGRP 00040 74 #define S_IROTH 00004 75 #define S_IWGRP 00020 76 #define S_IWOTH 00002 77 #define S_IRWXG 00070 78 #define S_IRWXO 00007 79 80 #endif // ! SYSTEM_LIBC 81 82 #endif // __MES_SYS_STAT_H