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_tdefault;
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.
Platforms and Architectures
- linux
- x86
- x86-64
- arm
- aarch64
- loongarch64
- mips
- mipsel
- mips64
- mips64el
- powerpc64
- s390x
- freebsd
- x86-64
Related projects
License
This library is release in Apache License.