nc
Access system calls directly without std
or libc
.
Features:
- No glibc or musl required
- Access syscalls directly, via assembly
- No global errno variable, every function returns an errno instead
- Support latest kernel APIs, like io-uring and pidfd, introduced in linux 5.0+
Usage
Add this to Cargo.toml
:
[]
= "0.8"
Examples
Get file stat:
let mut statbuf = stat_t default;
match unsafe
Get human-readable error string:
let errno = EPERM;
println!
Fork process:
let pid = unsafe ;
match pid
Kill self:
let pid = unsafe ;
let ret = unsafe ;
// Never reach here.
println!;
Or handle signals:
Stable version
For stable version of rustc, please install a C compiler (gcc
or clang
) first.
As llvm_asm!
feature is unavailable in stable version.
Supported Operating Systems and Architectures
- linux
- aarch64
- arm
- loongarch64
- mips
- mips64
- mips64el
- mipsel
- powerpc64
- riscv64
- s390x
- x86
- x86-64
- android
- aarch64
- freebsd
- x86-64
- netbsd
- x86-64
- mac os
- x86-64
Related projects
License
This library is release in Apache License.