Crates.io | raw-syscall-base |
lib.rs | raw-syscall-base |
version | 0.8.2 |
source | src |
created_at | 2018-09-14 00:56:57.892628 |
updated_at | 2018-10-23 08:22:23.963911 |
description | Low-level raw system call base. |
homepage | https://github.com/rvlzzr/raw-syscall-base |
repository | https://github.com/rvlzzr/raw-syscall-base |
max_upload_size | |
id | 84615 |
size | 45,696 |
Low level system calls.
Add the following to your Cargo.toml
:
raw-syscall-base = "0.8.2"
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 with results wrapped in a Result
. For example all arguments are usize
and return is Result<usize, usize>
on x86_64-linux
. All arguments must be converted to this basic type, and it's up to the caller to determine what the result represents.
The intention is to provide a minimal stable base with no unnecessary overhead on which to build a higher-level library.
use raw_syscall_base::{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])
}