#linux #uapi #ffi

no-std linux-raw-sys

Generated bindings for Linux’s userspace API

39 releases

new 0.0.38 Jan 25, 2022
0.0.37 Jan 10, 2022
0.0.36 Nov 5, 2021
0.0.29 Oct 4, 2021
0.0.12 Jun 29, 2021

#1 in #uapi

Download history 5038/week @ 2021-10-07 7954/week @ 2021-10-14 7879/week @ 2021-10-21 5567/week @ 2021-10-28 6872/week @ 2021-11-04 9398/week @ 2021-11-11 11557/week @ 2021-11-18 10248/week @ 2021-11-25 12756/week @ 2021-12-02 12301/week @ 2021-12-09 11192/week @ 2021-12-16 5971/week @ 2021-12-23 8460/week @ 2021-12-30 11874/week @ 2022-01-06 15872/week @ 2022-01-13 24471/week @ 2022-01-20

61,673 downloads per month
Used in 118 crates (2 directly)

Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT

231K SLoC


Generated bindings for Linux's userspace API

Github Actions CI Status zulip chat crates.io page docs.rs docs

This crate contains bindgen-generated bindings for Linux's userspace API.

This is primarily of interest if you want to make raw system calls directly, which is tedious and error prone and not necessary for most use cases. For a minimal type-safe, memory-safe, and I/O-safe API to the Linux system calls built on these bindings, see the rustix crate.

The full bindings are quite large, so they've been split up into modules and cargo features. By default, general and errno are enabled, which provide most things needed by general-purpose code.

The default bindings are generated from Linux 2.3.36, as it is the oldest version supported by Rust. Modules v5_4 and v5_11, enabled by features v5_4 and v5_11 respectively, contain generated bindings for Linux 5.4 and Linux 5.11, which provide access to numerous new features, though they may not be available on all supported Linux versions.

To regenerate the generated bindings, run cargo update && cd gen && cargo run --release.

Similar crates

This is similar to linux-sys, but supports multiple Linux versions at once, including the oldest version of Linux that Rust supports, and also new versions, making it easy to selectively mix in new features. Also, the bindings are generated offline, rather than in a build.rs, making downstream builds simpler. And, this crate has bindings for more headers, as well as supplementary definitions not exported by Linux's headers but nonetheless needed by userspace.