Go to the documentation of this file.
18 #ifndef __LIB_LIBPOSIX_SYS_STAT_H
19 #define __LIB_LIBPOSIX_SYS_STAT_H
36 #define FILETYPE_BITS 3
39 #define FILETYPE_MASK 7
42 #define FILEMODE_BITS 9
45 #define FILEMODE_MASK 0777
58 #define S_IFMT (FILETYPE_MASK << FILEMODE_BITS)
61 #define S_IFBLK (FileSystem::BlockDeviceFile << FILEMODE_BITS)
64 #define S_IFCHR (FileSystem::CharacterDeviceFile << FILEMODE_BITS)
67 #define S_IFIFO (FileSystem::FIFOFile << FILEMODE_BITS)
70 #define S_IFREG (FileSystem::RegularFile << FILEMODE_BITS)
73 #define S_IFDIR (FileSystem::DirectoryFile << FILEMODE_BITS)
76 #define S_IFLNK (FileSystem::SymlinkFile << FILEMODE_BITS)
79 #define S_IFSOCK (FileSystem::SocketFile << FILEMODE_BITS)
97 #define S_IRWXU FileSystem::OwnerRWX
100 #define S_IRUSR FileSystem::OwnerR
103 #define S_IWUSR FileSystem::OwnerW
106 #define S_IXUSR FileSystem::OwnerX
109 #define S_IRWXG FileSystem::GroupRWX
112 #define S_IRGRP FileSystem::GroupR
115 #define S_IWGRP FileSystem::GroupW
118 #define S_IXGRP FileSystem::GroupX
121 #define S_IRWXO FileSystem::OtherRWX
124 #define S_IROTH FileSystem::OtherR
127 #define S_IWOTH FileSystem::OtherW
130 #define S_IXOTH FileSystem::OtherX
146 #define S_ISTYPE(mode, mask) (((mode) & S_IFMT) == (mask))
149 #define S_ISBLK(m) S_ISTYPE(m, S_IFBLK)
152 #define S_ISCHR(m) S_ISTYPE(m, S_IFCHR)
155 #define S_ISDIR(m) S_ISTYPE(m, S_IFDIR)
158 #define S_ISFIFO(m) S_ISTYPE(m, S_IFIFO)
161 #define S_ISREG(m) S_ISTYPE(m, S_IFREG)
164 #define S_ISLNK(m) S_ISTYPE(m, S_IFLNK)
167 #define S_ISSOCK(m) S_ISTYPE(m, S_IFSOCK)
266 extern C int stat(
const char *path,
struct stat *buf);
off_t st_size
For regular files, the file size in bytes.
sint off_t
Used for file sizes.
The <sys/stat.h> header shall define the stat structure.
u16 gid_t
Used for group IDs.
u16 minor
Device specific minor ID number.
struct timespec st_mtim
Last data modification timestamp.
Size nlink_t
Used for link counts.
uid_t st_uid
User ID of file.
blkcnt_t st_blocks
Number of blocks allocated for this object.
nlink_t st_nlink
Number of hard links to the file.
dev_t st_dev
Device ID of device containing file.
uint mode_t
Used for some file attributes.
struct timespec st_ctim
Last file status change timestamp.
FileModes access
< Process identifier of filesystem
GroupID groupID
< User identity.
dev_t st_rdev
Device ID (if file is character or block special).
#define C
Used to define external C functions.
#define FILEMODE_BITS
Number of bits required for all FileModes.
Size size
< File access permission bits.
UserID userID
< Size of the file in bytes.
u16 uid_t
Used for user IDs.
C int mkdir(const char *path, mode_t mode)
Create a new directory.
uint ino_t
Used for file serial numbers.
ino_t st_ino
File inode number.
mode_t st_mode
Mode of file.
ProcessID major
Major device ID number is a PID.
C int stat(const char *path, struct stat *buf)
Get file status.
C int creat(const char *path, mode_t mode)
Create a new file or rewrite an existing one.
Contains file information.
C int mknod(const char *path, mode_t mode, dev_t dev)
Make directory, special file, or regular file.
Describes a device ID number.
gid_t st_gid
Group ID of file.
The <time.h> header shall declare the timespec structure.
blksize_t st_blksize
A file system-specific preferred I/O block size for this object.
sint blkcnt_t
Used for file block counts.
sint blksize_t
Used for block sizes.
struct timespec st_atim
Last data access timestamp.