#system #call #syscalls #raw #no-std

nightly no-std raw-syscall-base

Low-level raw system call base

7 releases

0.8.2 Oct 23, 2018
0.8.1 Oct 23, 2018
0.7.6 Oct 4, 2018
0.6.2 Sep 14, 2018

#890 in Unix APIs


Used in 2 crates

MIT-0 OR 0BSD

43KB
1K SLoC

raw-syscall-base

Low level system calls.

Latest version Documentation Downloads License

Usage

Add the following to your Cargo.toml:

raw-syscall-base = "0.8.2"

Supported Platforms

  • aarch64-linux
  • arm-linux
  • x86_64-freebsd
  • x86_64-linux

Purpose

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.

x86_64-linux Example

    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])
    }

No runtime deps