stat.h (2327B)
1 #ifndef _SYS_STAT_H 2 #define _SYS_STAT_H 3 4 #include <sys/types.h> 5 6 struct stat 7 { 8 dev_t st_dev; // Device ID of device containing file. 9 ino_t st_ino; // File serial number. 10 mode_t st_mode; // Mode of file. 11 nlink_t st_nlink; // Number of hard links to the file. 12 uid_t st_uid; // User ID of file. 13 gid_t st_gid; // Group ID of file. 14 dev_t st_rdev; // Device ID for device special file. 15 blksize_t st_blksize; // Size of blocks in this file 16 blkcnt_t st_blocks; // Number of blocks allocated for this file 17 off_t st_size; // File size in bytes. 18 time_t st_atime; // Time of last access. 19 time_t st_mtime; // Time of last data modification. 20 time_t st_ctime; // Time of last status change. 21 }; 22 23 24 // File mode bits - matching vx/env.h 25 #define S_IFMT 070000 // File type bit mask 26 #define S_IFNULL 000000 // Unused inode 27 #define S_IFREG 010000 // Regular file 28 #define S_IFDIR 020000 // Directory 29 #define S_IFLNK 030000 // Symbolic link 30 #define S_IFSOCK 040000 // Socket 31 #define S_IFIFO 050000 // FIFO 32 #define S_IFBLK 060000 // Block device 33 #define S_IFCHR 070000 // Character device 34 35 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) 36 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) 37 #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) 38 #define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) 39 #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) 40 #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) 41 #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) 42 43 #define S_ISUID 004000 44 #define S_ISGID 002000 45 #define S_ISVTX 001000 46 47 #define S_IRWXU 000700 48 #define S_IRUSR 000400 49 #define S_IWUSR 000200 50 #define S_IXUSR 000100 51 52 #define S_IRWXG 000070 53 #define S_IRGRP 000040 54 #define S_IWGRP 000020 55 #define S_IXGRP 000010 56 57 #define S_IRWXO 000007 58 #define S_IROTH 000004 59 #define S_IWOTH 000002 60 #define S_IXOTH 000001 61 62 #define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) 63 64 int stat(const char *file_name, struct stat *buf); 65 int fstat(int filedes, struct stat *buf); 66 int lstat(const char *file_name, struct stat *buf); 67 68 int chmod(const char *path, mode_t mode); 69 int fchmod(int fd, mode_t mode); 70 71 int mkdir(const char *path, mode_t mode); 72 int mkfifo(const char *path, mode_t mode); 73 int mknod(const char *path, mode_t mode); 74 75 mode_t umask(mode_t cmask); 76 77 78 #endif // _SYS_STAT_H