nc
Execute system call directly without std
or libc
.
Features:
- No libc 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.7"
Examples
Get file stat:
let mut statbuf = stat_t default;
match stat
Get human-readable error string:
let errno = EPERM;
println!
Fork process:
let pid = fork;
match pid
Kill self:
let pid = getpid;
let ret = kill;
// 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
- mips
- mipsel
- mips64
- mips64el
- powerpc64
- s390x
- freebsd
- x86-64
Related projects
License
This library is release in Apache License.