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)
266extern C int stat(
const char *path,
struct stat *buf);
C int creat(const char *path, mode_t mode)
Create a new file or rewrite an existing one.
#define FILEMODE_BITS
Number of bits required for all FileModes.
C int mkdir(const char *path, mode_t mode)
Create a new directory.
uint ino_t
Used for file serial numbers.
Size nlink_t
Used for link counts.
uint mode_t
Used for some file attributes.
sint off_t
Used for file sizes.
C int mknod(const char *path, mode_t mode, dev_t dev)
Make directory, special file, or regular file.
u16 gid_t
Used for group IDs.
u16 uid_t
Used for user IDs.
sint blksize_t
Used for block sizes.
sint blkcnt_t
Used for file block counts.
#define C
Used to define external C functions.
Describes a device ID number.
ProcessID major
Major device ID number is a PID.
u16 minor
Device specific minor ID number.
Contains file information.
UserID userID
< Size of the file in bytes.
FileModes access
< Process identifier of filesystem
Size size
< File access permission bits.
GroupID groupID
< User identity.
The <sys/stat.h> header shall define the stat structure.
off_t st_size
For regular files, the file size in bytes.
nlink_t st_nlink
Number of hard links to the file.
blksize_t st_blksize
A file system-specific preferred I/O block size for this object.
blkcnt_t st_blocks
Number of blocks allocated for this object.
uid_t st_uid
User ID of file.
mode_t st_mode
Mode of file.
struct timespec st_mtim
Last data modification timestamp.
struct timespec st_atim
Last data access timestamp.
struct timespec st_ctim
Last file status change timestamp.
ino_t st_ino
File inode number.
dev_t st_rdev
Device ID (if file is character or block special).
gid_t st_gid
Group ID of file.
dev_t st_dev
Device ID of device containing file.
The <time.h> header shall declare the timespec structure.