/linux-syscalls

A crate to easily deal with linux system calls.

Primary LanguageRustMIT LicenseMIT

linux-syscalls

GitHub Workflow Status (with branch) Crates.io docs.rs Crates.io

A library to easily deal with linux system calls.

One does not simply make a syscall

As a side effect this library offers other utilities.

uname

This library invoke uname syscall in initialization and cache its result.

kernel version

Parse kernel version from uname in initialization (panics if it's invalid) and offers a macro kversion! to deal with it.

auxiliary vector

Detect auxiliary vector (if present) in initialization and offer a Rust interface to query its values. Useful for hardware/kernel features like scv in ppc64.

vDSO

Detect vDSO and parse it (if present) in initialization and store its result. Useful for vsyscalls on any platform and __kernel_vsyscall for faster syscalls on x86 machines.

Feature flags

  • std: enable std support.
  • bare: do not try to automatically initialize the library.
  • libc-compat: forward this feature to linux-errnos.

#![no_std]

Enable #![no_std] support by disabling the default std feature:

[dependencies]
linux-syscalls = { version = "*", default-features = false }

Supported platforms

Tier 1

  • aarch64-unknown-linux-gnu
  • i686-unknown-linux-gnu
  • x86_64-unknown-linux-gnu

Tier 2

  • aarch64-unknown-linux-musl
  • arm-unknown-linux-gnueabi
  • arm-unknown-linux-gnueabihf
  • arm-unknown-linux-musleabi
  • arm-unknown-linux-musleabihf
  • armv5te-unknown-linux-gnueabi
  • armv5te-unknown-linux-musleabi
  • armv7-unknown-linux-gnueabi
  • armv7-unknown-linux-gnueabihf
  • armv7-unknown-linux-musleabi
  • armv7-unknown-linux-musleabihf
  • i586-unknown-linux-gnu
  • i586-unknown-linux-musl
  • i686-unknown-linux-musl
  • loongarch64-unknown-linux-gnu
  • mips-unknown-linux-gnu (not tested)
  • mips-unknown-linux-musl (not tested)
  • mips64-unknown-linux-gnuabi64 (not tested)
  • mips64-unknown-linux-muslabi64 (not tested)
  • mips64el-unknown-linux-gnuabi64 (not tested)
  • mips64el-unknown-linux-muslabi64 (not tested)
  • mipsel-unknown-linux-gnu (not tested)
  • mipsel-unknown-linux-musl (not tested)
  • powerpc-unknown-linux-gnu
  • powerpc64-unknown-linux-gnu
  • powerpc64le-unknown-linux-gnu
  • riscv64gc-unknown-linux-gnu
  • s390x-unknown-linux-gnu
  • thumbv7neon-unknown-linux-gnueabihf
  • x86_64-unknown-linux-musl

MSRV

1.65.0