#ifndef _SYS_STAT_H #define _SYS_STAT_H #include // Basic POSIX types for i686 execution typedef uint32_t dev_t; typedef uint32_t ino_t; typedef uint32_t mode_t; typedef uint32_t nlink_t; typedef uint32_t uid_t; typedef uint32_t gid_t; typedef int32_t off_t; typedef int32_t time_t; // The stat layout expected by standard C files struct stat { dev_t st_dev; /* ID of device containing file */ ino_t st_ino; /* Inode number */ mode_t st_mode; /* File type and mode flags */ nlink_t st_nlink; /* Number of hard links */ uid_t st_uid; /* User ID of owner */ gid_t st_gid; /* Group ID of owner */ dev_t st_rdev; /* Device ID (if special file) */ off_t st_size; /* Total size, in bytes */ time_t st_atime; /* Time of last access */ time_t st_mtime; /* Time of last modification */ time_t st_ctime; /* Time of last status change */ }; // Traditional POSIX file permission/type bitmasks #define S_IFMT 0170000 /* Bitmask for the file type bit fields */ #define S_IFSOCK 0140000 /* Socket */ #define S_IFLNK 0120000 /* Symbolic link */ #define S_IFREG 0100000 /* Regular file */ #define S_IFBLK 0060000 /* Block device */ #define S_IFDIR 0040000 /* Directory */ #define S_IFCHR 0020000 /* Character device */ #define S_IFIFO 0010000 /* FIFO */ #define S_IRUSR 00400 /* Owner has read permission */ #define S_IWUSR 00200 /* Owner has write permission */ #define S_IXUSR 00100 /* Owner has execute permission */ #define S_IRWXU 00700 /* Owner has read, write, and execute permission */ // Helper check macros commonly used in PDCLib #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) #endif /* _SYS_STAT_H */