Skip to content
systemcoding.dev

Tag

beginner

445 posts

Flat illustration of user space above the system call boundary, the kernel and the hardware, with the Rust, Linux and FreeBSD logos.
Systems Programming

How Rust's std Wraps libc and System Calls

Rust's standard library does not talk to the kernel directly on Linux. It calls libc, which issues the syscall. See the layers from File::open down to openat.

6 min read
Flat illustration of user space above the system call boundary, the kernel and the hardware, with the C, FreeBSD and Linux logos.
Systems Programming

Process Lines Efficiently with getline

Read lines of any length in C with getline, reuse one growing buffer, strip the newline, spot read errors and handle files without a final newline.

7 min read
Flat illustration of user space above the system call boundary, the kernel and the hardware, with the C, Rust and FreeBSD logos.
Systems Programming

Write Errors to stderr with perror and err

Report failures from a C tool the Unix way: perror, strerror and the err and warn family, with errno saved correctly and messages sent to stderr.

6 min read
Flat illustration of a magnifier over lines of a log, with the Linux, C and Rust logos.
Kernels

printk Log Levels and pr_* Helpers Explained

Learn the eight printk log levels, the pr_info and pr_err helpers, pr_fmt prefixes, rate limiting and the console loglevel that decides what reaches the screen.

8 min read