Expand description
Low-level cross-platform interface to operating system services.
oscall talks to the operating system directly, with no dependencies:
- Linux (and fullrust): raw system calls, no libc involved.
- macOS:
libSystem, the only stable interface to the kernel. - Windows:
kernel32,ntdllandws2_32. - WebAssembly: WASI preview 1 imports; without WASI, the calls that
need a system fail with
ErrorKind::Unsupported.
Every function maps onto one operating system operation, or onto the few needed to give the same result everywhere. There is no buffering, no global state and no hidden allocation.
The modules are portable: a function does the same thing on every system,
and what one system alone offers is in a sub-module named after it
(mem::linux, fs::unix…). For what oscall does not cover, raw
gives the layer underneath, which is specific to each system and
unsafe: the system call itself on Linux, and the error conventions and
string conversions the system libraries need elsewhere.
Modules§
- event
- Waiting for sockets and handles to become ready.
- fs
- Files, directories and their metadata.
- io
- Reading and writing on any handle, pipes, and the standard handles.
- mem
- Memory: pages, mappings and their protection.
- net
- Sockets: TCP, UDP and Unix-domain, their addresses and their options.
- process
- Processes: the current one, and child processes.
- rand
- The operating system’s random number generator.
- raw
- The raw layer: what oscall itself is built on, for whatever the portable modules lack.
- sync
- Waiting on a value in memory, and waking the waiters: the primitive mutexes, condition variables and other locks are built from.
- thread
- The calling thread: its identity, its name, yielding the processor, and how many processors there are to share.
- time
- Clocks and sleeping.
Structs§
- Borrowed
Handle - A handle borrowed from its owner.
- Error
- An error reported by the operating system.
- Owned
Handle - An owned handle to an operating system object: an open file, a pipe, a directory, a process… It is closed when dropped.