Module libc/unistd

libc/unistd
Stability: unstable — a raw C binding, not a Yo design, and POSIX-only: including `<unistd.h>` on Windows does not compile, so every import must sit inside a non-Windows comptime arm (`tests/io/tty.test.yo` did not, and that was the bug — docs/en-US/STD_SYS_MODULE.md). The public surfaces above it are `std/fs`, `std/env` and `std/process`; what they take is narrow — `getcwd` / `chdir` / `readlink` for `std/env`, `unlink` / `rmdir` for `std/fs/temp`. `read` / `write` / `close` are bound, but Yo file I/O goes through the async runtime (`std/sys/file`), not these, so a synchronous call here bypasses the event loop. Additive-by-demand, follows POSIX. — stable modules only change additively; this one may still change.

POSIX <unistd.h> — standard symbolic constants and types.

Stability

unstable — a raw C binding, not a Yo design, and POSIX-only: including <unistd.h> on Windows does not compile, so every import must sit inside a non-Windows comptime arm (tests/io/tty.test.yo did not, and that was the bug — docs/en-US/STD_SYS_MODULE.md). The public surfaces above it are std/fs, std/env and std/process; what they take is narrow — getcwd / chdir / readlink for std/env, unlink / rmdir for std/fs/temp. read / write / close are bound, but Yo file I/O goes through the async runtime (std/sys/file), not these, so a synchronous call here bypasses the event loop. Additive-by-demand, follows POSIX.

Types

ssize_t type-alias
ssize_t
off_t type-alias
off_t
pid_t type-alias
pid_t
uid_t type-alias
uid_t
gid_t type-alias
gid_t

Functions

read function
fn(fd : int, buf : *(void), count : usize) -> ssize_t

Parameters

NameTypeNotes
fdint
buf*(void)
countusize

Returns: ssize_t

write function
fn(fd : int, buf : *(void), count : usize) -> ssize_t

Parameters

NameTypeNotes
fdint
buf*(void)
countusize

Returns: ssize_t

close function
fn(fd : int) -> int

Parameters

NameTypeNotes
fdint

Returns: int

lseek function
fn(fd : int, offset : off_t, whence : int) -> off_t

Parameters

NameTypeNotes
fdint
offsetoff_t
whenceint

Returns: off_t

pipe function
fn(pipefd : *(int)) -> int

Parameters

NameTypeNotes
pipefd*(int)

Returns: int

dup function
fn(oldfd : int) -> int

Parameters

NameTypeNotes
oldfdint

Returns: int

dup2 function
fn(oldfd : int, newfd : int) -> int

Parameters

NameTypeNotes
oldfdint
newfdint

Returns: int

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

Parameters

NameTypeNotes
pathname*(char)
modeint

Returns: int

rmdir function
fn(pathname : *(char)) -> int

Parameters

NameTypeNotes
pathname*(char)

Returns: int

chdir function
fn(path : *(char)) -> int

Parameters

NameTypeNotes
path*(char)

Returns: int

getcwd function
fn(buf : *(char), size : usize) -> ?(*(char))

Parameters

NameTypeNotes
buf*(char)
sizeusize

Returns: ?(*(char))

fork function
fn() -> pid_t

Returns: pid_t

execve function
fn(pathname : *(char), argv : *(*(char)), envp : *(*(char))) -> int

Parameters

NameTypeNotes
pathname*(char)
argv*(*(char))
envp*(*(char))

Returns: int

_exit function
fn(status : int) -> unit

Parameters

NameTypeNotes
statusint

Returns: unit

getpid function
fn() -> pid_t

Returns: pid_t

getppid function
fn() -> pid_t

Returns: pid_t

getuid function
fn() -> uid_t

Returns: uid_t

geteuid function
fn() -> uid_t

Returns: uid_t

getgid function
fn() -> gid_t

Returns: gid_t

getegid function
fn() -> gid_t

Returns: gid_t

sleep function
fn(seconds : u32) -> u32

Parameters

NameTypeNotes
secondsu32

Returns: u32

usleep function
fn(usec : u32) -> int

Parameters

NameTypeNotes
usecu32

Returns: int

Constants

environ constant *(?(*(char)))

Value: <unknown: *(?(*(char)))>

STDIN_FILENO constant int

Value: <unknown: int>

STDOUT_FILENO constant int

Value: <unknown: int>

STDERR_FILENO constant int

Value: <unknown: int>

R_OK constant int

Value: <unknown: int>

W_OK constant int

Value: <unknown: int>

X_OK constant int

Value: <unknown: int>

F_OK constant int

Value: <unknown: int>