
The Complete Guide to Systems Programming in Rust on Linux
Write Linux systems code in Rust with compile-time ownership checks, safe syscall wrappers, and the exact boundary where unsafe remains necessary.
Tag
255 posts

Write Linux systems code in Rust with compile-time ownership checks, safe syscall wrappers, and the exact boundary where unsafe remains necessary.

Replace Verilog reg, wire and always @* with SystemVerilog logic, always_ff and always_comb, so the tools check your intent and catch latches early.

chroot only changes how a process resolves paths, while pivot_root swaps the mount namespace's root and lets you unmount the old one. Why containers need that.

Build a default-deny seccomp allow-list in C with libseccomp, add an argument rule that limits write to one file descriptor, and inspect the generated BPF.

Use C99 designated initializers to set struct fields and array slots by name, zero the rest and avoid uninitialized reads. Includes flags and pitfalls.

Pick the right Tokio channel: mpsc for queues, oneshot for one reply, broadcast for fan-out and watch for the latest value, each with a working example.

Keep a shared library's C interface stable across releases with opaque handles, size-tagged structs, explicit error codes and a versioned symbol set.

Trace a whole process tree with strace -f on Linux: read the pid prefix, split output per process with -ff -o, and follow threads that do the real work.

Read a machine's NUMA nodes, per-node memory and distance matrix with numactl --hardware, then see caches and devices with lstopo from hwloc on Linux.

Run compute-sanitizer with memcheck, racecheck, initcheck and synccheck to catch out-of-bounds accesses, shared memory races, leaks and uninitialized reads.

Build a Moore finite state machine in Verilog with a state register, next-state logic and outputs, using defaults that avoid latches in synthesis.

How seccomp-bpf lets a process install a classic BPF filter that allows, blocks or kills on each system call, with the return actions and a working C example.