Skip to content
KarpelesLabPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

101 Commits

Folders and files

Repository files navigation

oscall

CI crates.io docs.rs License: MIT

A low-level, cross-platform interface to operating system services: files, memory mapping, networking, time, processes and more.

oscall talks to the operating system directly and has no dependencies:

OS Backend Architectures
Linux raw system calls, no libc x86_64, x86, aarch64, arm, riscv64, riscv32
fullrust the same raw system calls x86_64, x86, aarch64, armv7
macOS libSystem x86_64, aarch64
Windows kernel32, ntdll, ws2_32 x86_64, x86, aarch64
WebAssembly WASI preview 1 wasm32

It is no_std; the default std feature only adds conversions to and from std types.

What it covers

Module
mem page size, anonymous and file mappings, protection, reservations
io read/write on any handle, positional and vectored, pipes, standard handles; per system, I/O that completes later: io_uring, with its multishot operations, provided buffers and zero-copy sends (io::linux), overlapped I/O and completion ports (io::windows), POSIX asynchronous I/O for files (io::macos)
fs files, metadata, directories, links, locks, copy, directory-relative operations
time, rand clocks, sleep, the system random generator
sync, thread wait/wake on an address; the current thread; creating threads, per system
net sockets: IPv4, IPv6, Unix-domain; options; interfaces; name resolution, with a DNS client of its own where the system has none
event poll, and a Poller over epoll, kqueue or an I/O completion port: sockets, timers, signals, child processes
process arguments and environment; spawning children, wait, kill, termination requests; per system: limits and identity of a child, fork, Linux namespaces, cgroups, capabilities and system call filters, Windows job objects

Every function behaves the same on every system; what one system alone has is in an extension module named after it (fs::unix, net::linux, ...). On WebAssembly, what WASI lacks fails with ErrorKind::Unsupported.

use oscall::{fs, io};

let options = fs::OpenOptions::new().write(true).create(true);
let file = fs::open("hello.txt", &options)?;
io::write(&file, b"hello\n")?;

The API may still change between 0.x releases. The design is in docs/plan.md, the internals in docs/internals.md.

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages