os

Operating System Interface

Functions

FunctionDescription
os_getenvGet environment variable value. Scans /proc/self/environ for name=value pairs.
os_getcwdGet current working directory.
os_chdirChange current directory.
os_getpidGet current process ID.
os_getppidGet parent process ID.
os_getuidGet user ID.
os_exitExit the process.
os_forkFork the current process.
os_execExecute a program (replaces current process image).
os_waitWait for child process.
os_killSend signal to process.
os_sleep_msSleep for given milliseconds.
os_hostnameGet hostname.
os_unameGet system info (uname).

Details

os_getenv

fn os_getenv(name: &i8, name_len: i64, buf: &i8, max: i64) -> i64

Get environment variable value. Scans /proc/self/environ for name=value pairs.

os_getcwd

fn os_getcwd(buf: &i8, max: i64) -> i64

Get current working directory.

os_chdir

fn os_chdir(path: &i8) -> i64

Change current directory.

os_getpid

fn os_getpid() -> i64

Get current process ID.

os_getppid

fn os_getppid() -> i64

Get parent process ID.

os_getuid

fn os_getuid() -> i64

Get user ID.

os_exit

fn os_exit(code: i64) -> i64

Exit the process.

os_fork

fn os_fork() -> i64

Fork the current process.

os_exec

fn os_exec(path: &i8, argv: &i64, envp: &i64) -> i64

Execute a program (replaces current process image).

os_wait

fn os_wait(status_ptr: &i64) -> i64

Wait for child process.

os_kill

fn os_kill(pid: i64, sig: i64) -> i64

Send signal to process.

os_sleep_ms

fn os_sleep_ms(ms: i64) -> i64

Sleep for given milliseconds.

os_hostname

fn os_hostname(buf: &i8, max: i64) -> i64

Get hostname.

os_uname

fn os_uname(buf: &i8, max: i64) -> i64

Get system info (uname).