Module libc/sys/stat

libc/sys/stat
Stability: unstable — a raw C binding, not a Yo design. The public surface is `std/fs` (`std/fs/file`'s `set_permissions` uses `chmod`, `std/fs/dir` uses `mkdir`); the compiler's own module loader also calls `stat` to check a file's existence and mtime. `statbuf` is typed `*void` and `struct stat` is not bound at all, because its layout is per-OS and per-`_FILE_OFFSET_BITS` — so a caller here cannot read the result portably and should be using `std/fs/metadata` instead. `mode_t` is opaque for the same reason, while `chmod`'s mode is bound as `u32`. Freezing would require a portable stat buffer, which is what `std/fs` provides in Yo. — stable modules only change additively; this one may still change.

POSIX <sys/stat.h> — file status and mode operations.

Stability

unstable — a raw C binding, not a Yo design. The public surface is std/fs (std/fs/file's set_permissions uses chmod, std/fs/dir uses mkdir); the compiler's own module loader also calls stat to check a file's existence and mtime. statbuf is typed *void and struct stat is not bound at all, because its layout is per-OS and per-_FILE_OFFSET_BITS — so a caller here cannot read the result portably and should be using std/fs/metadata instead. mode_t is opaque for the same reason, while chmod's mode is bound as u32. Freezing would require a portable stat buffer, which is what std/fs provides in Yo.

Types

mode_t type-alias
mode_t

Functions

stat function
fn(pathname : *(char), statbuf : *(void)) -> int

Parameters

NameTypeNotes
pathname*(char)
statbuf*(void)

Returns: int

fstat function
fn(fd : int, statbuf : *(void)) -> int

Parameters

NameTypeNotes
fdint
statbuf*(void)

Returns: int

lstat function
fn(pathname : *(char), statbuf : *(void)) -> int

Parameters

NameTypeNotes
pathname*(char)
statbuf*(void)

Returns: int

mkdir function
fn(pathname : *(char), mode : mode_t) -> int

Parameters

NameTypeNotes
pathname*(char)
modemode_t

Returns: int

chmod function
fn(pathname : *(char), mode : u32) -> int

Parameters

NameTypeNotes
pathname*(char)
modeu32

Returns: int

fchmod function
fn(fd : int, mode : u32) -> int

Parameters

NameTypeNotes
fdint
modeu32

Returns: int

umask function
fn(mask : mode_t) -> mode_t

Parameters

NameTypeNotes
maskmode_t

Returns: mode_t

mkfifo function
fn(pathname : *(char), mode : mode_t) -> int

Parameters

NameTypeNotes
pathname*(char)
modemode_t

Returns: int

Constants

S_IFMT constant mode_t

Value: <unknown: mode_t>

S_IFSOCK constant mode_t

Value: <unknown: mode_t>

S_IFLNK constant mode_t

Value: <unknown: mode_t>

S_IFREG constant mode_t

Value: <unknown: mode_t>

S_IFBLK constant mode_t

Value: <unknown: mode_t>

S_IFDIR constant mode_t

Value: <unknown: mode_t>

S_IFCHR constant mode_t

Value: <unknown: mode_t>

S_IFIFO constant mode_t

Value: <unknown: mode_t>

S_IRWXU constant mode_t

Value: <unknown: mode_t>

S_IRUSR constant mode_t

Value: <unknown: mode_t>

S_IWUSR constant mode_t

Value: <unknown: mode_t>

S_IXUSR constant mode_t

Value: <unknown: mode_t>

S_IRWXG constant mode_t

Value: <unknown: mode_t>

S_IRGRP constant mode_t

Value: <unknown: mode_t>

S_IWGRP constant mode_t

Value: <unknown: mode_t>

S_IXGRP constant mode_t

Value: <unknown: mode_t>

S_IRWXO constant mode_t

Value: <unknown: mode_t>

S_IROTH constant mode_t

Value: <unknown: mode_t>

S_IWOTH constant mode_t

Value: <unknown: mode_t>

S_IXOTH constant mode_t

Value: <unknown: mode_t>

S_ISUID constant mode_t

Value: <unknown: mode_t>

S_ISGID constant mode_t

Value: <unknown: mode_t>

S_ISVTX constant mode_t

Value: <unknown: mode_t>