linux-raw-sys
Generated bindings for Linux's userspace API
This package has a good security score with no known vulnerabilities.
Community Reviews
Low-level syscall bindings: efficient but requires careful handling
The challenge is that you're working at the absolute lowest level. No error handling, no type safety beyond what the kernel provides, no retry logic - you get raw syscall numbers and structs. This means you handle EINTR yourself, manage all resource cleanup manually, and deal with architecture-specific quirks. Documentation is essentially nonexistent because these are generated bindings; you need to reference kernel docs directly.
For most production work, you want `rustix` or `nix` on top of this. Use `linux-raw-sys` directly only when building your own syscall wrappers or when you need bleeding-edge kernel features not yet wrapped by higher-level crates. Updates can introduce breaking changes as kernel APIs evolve, requiring careful version pinning in stable systems.
Best for: Building custom syscall wrappers or accessing cutting-edge kernel features not available in higher-level crates.
Avoid if: You need production-ready syscall interfaces with error handling - use rustix or nix instead.
Raw syscall bindings: powerful but brutally low-level
The DX is intentionally minimal—there's virtually no documentation beyond what's auto-generated from kernel headers. You'll need to reference Linux man pages constantly and understand the exact semantics of raw syscalls. Type safety is limited to what the kernel API provides, meaning lots of raw pointers, integer flags, and undefined behavior if you get things wrong. Error handling is entirely manual via checking return codes.
For most projects, you should reach for higher-level abstractions like rustix or nix instead. This crate is really a building block for those libraries rather than something you'd use directly. The ergonomics are poor by design—it's meant to be a thin, zero-cost binding layer that other crates build upon.
Best for: Building system-level libraries or when you need direct syscall access that higher-level crates don't expose.
Avoid if: You're writing application code or need ergonomic, safe APIs—use rustix or nix instead.
Low-level bindings that require significant Linux kernel knowledge
There's virtually no documentation beyond what's auto-generated from kernel headers. You'll find yourself constantly cross-referencing man pages and kernel documentation to understand what each constant or structure does. The package serves its purpose as a foundation layer, but it's not designed for direct use by most developers. Common use cases aren't straightforward because there are no examples - this is by design, as it's meant to be consumed by higher-level libraries like rustix.
If you're building low-level system utilities or need specific Linux features not yet exposed by safe wrappers, this does the job. But expect to invest significant time understanding both the kernel APIs and how to use them safely from Rust.
Best for: Library authors building safe syscall wrappers or developers needing direct kernel API access with deep Linux expertise.
Avoid if: You're looking for a safe, high-level interface to Linux features - use rustix or nix instead.
Sign in to write a review
Sign In