Low level system calls.
Add the following to your Cargo.toml
:
toml
raw-syscall-base = "0.7.6"
This crate is limited to providing basic functionality necessary to perform system calls on the target platform.
All functions are marked unsafe, and no validation is done on arguments or return values.
All arguments and return values use the most basic possible types, for example everything is usize
on x86_64-linux
. All arguments must be converted to this type, and it's up to the caller to determine whether the result represents a pointer or error code or whatever.
The intention is to provide a minimal stable base with no unnecessary overhead on which to build a higher-level library.
```rust use rawsyscallbase::{syscall, syscall_nr};
// attempts to write "hello" to STDOUT
pub unsafe fn hello() -> usize {
syscall(1, &[1, b"hello" as *const u8 as usize, 5])
}
// exits the program with a success code
pub unsafe fn exit_success() -> ! {
syscall_nr(231, &[0])
}
```