For: Embedded Linux, systems, and infrastructure C engineers
Engineer crash-safe, race-free Linux C11 file and stream I/O software across raw POSIX descriptors, VFS open-file tables, atomic positional syscalls, and two-stage buffered stdio streams.
18 lessons6 labs~11h 55mLinux 6.12C11glibc 2.39Course 1 of 4 · Foundation
Onboard into the 4-course Linux Systems C series across Ring 3 / Ring 0 hardware boundaries, master the 4-stage GCC/Make C11 toolchain and POSIX boundary types, and trace glibc wrappers, CRT startup, and errno diagnostics under strace.
Acquire and manage per-process file descriptors with exact open() flags and mode & ~umask permissions, build partial-count and EINTR-resilient read_full() and write_all() loops, and implement side-effect-safe lseek() byte-slicing tools.
Trace static on-disk directory entries and inodes into the dynamic 3-tier Linux kernel VFS open-file hierarchy, preserve thread-local errno across exit() vs _exit() termination paths, and engineer sparse hole files with O_TRUNC and O_APPEND.
Control kernel open-file table sharing across dual opens and dup/dup2/dup3, eliminate TOCTOU and offset races with O_EXCL and stateless pread/pwrite, and manipulate live descriptors with fcntl, ioctl, and ftruncate.
Map glibc FILE streams and fopen mode strings to kernel openat flags, serialize fixed binary records safely with fread/fwrite/fseeko and feof/ferror triage, and construct truncation-safe snprintf and fgets/strtol codecs.
├── m01/ Series Orientation, Kernel Boundary & C Toolchain
Onboard into the 4-course Linux Systems C series across Ring 3 / Ring 0 hardware boundaries, master the 4-stage GCC/Make C11 toolchain and POSIX boundary types, and trace glibc wrappers, CRT startup, and errno diagnostics under strace.
Porting bare-metal firmware habits into a hosted Linux C daemon triggers immediate segmentation faults or burns microseconds in avoidable CPU privilege switches. In this opening lesson of GL-C01, you will map the hardware privilege boundary, trace how system calls and the vDSO bridge Ring 3 and Ring 0, and benchmark a strict ISO C11 probe.
Signed integer overflow checks silently deleted at -O2, strlen() truncating binary frames at 0x00, unsigned size_t wraparound on -1 errors, and decimal 644 permission literals cause catastrophic C bugs. You will master the four-stage GCC/ar pipeline, feature-test macros, POSIX boundary types, and ISO C11 Undefined Behavior defenses.
Confusing pure Ring 3 library helpers with Ring 0 syscall wrappers—or misreading execve ENOENT missing-loader errors and stale errno values—paralyzes production debugging. You will trace ELF PT_INTERP and CRT _start startup, inspect .plt/.got.plt dynamic relocations, test thread-local errno, and verify exact syscall counts under strace.
Acquire and manage per-process file descriptors with exact open() flags and mode & ~umask permissions, build partial-count and EINTR-resilient read_full() and write_all() loops, and implement side-effect-safe lseek() byte-slicing tools.
Omitting O_CLOEXEC leaks sensitive descriptors across execve(), testing (flags & O_RDONLY) evaluates false on every file, and forgetting the variadic mode argument on O_CREAT stamps random stack bits onto disk. You will master lowest-slot descriptor allocation, open() flag bitmasks, 16-bit mode_t permissions, and UB-free unsigned bit shifts.
Unlooped read() and write() calls drop tail bytes on pipes, signals, and >2 GiB files, passing raw read() buffers to printf("%s") leaks stack memory, and retrying close() on EINTR kills sibling threads' sockets. You will implement binary-safe write_all() and read_full() loops and enforce Linux close() contracts.
Reading right after writing on an O_RDWR descriptor returns zero bytes unless you understand the shared kernel offset f_pos, while opening an O_TRUNC output file before validating input slice bounds destroys existing data on failure. You will master 64-bit lseek(), SEEK_DATA/SEEK_HOLE, signed off_t overflow guards, and all five POSIX slicing patterns.
Trace static on-disk directory entries and inodes into the dynamic 3-tier Linux kernel VFS open-file hierarchy, preserve thread-local errno across exit() vs _exit() termination paths, and engineer sparse hole files with O_TRUNC and O_APPEND.
Confusing directory filenames with on-disk inodes—or confusing per-process descriptors with kernel struct file descriptions—makes unlinked 10 GiB disk leaks, hard links, and shared cursors impossible to diagnose. You will map ext4 disk geometry into the three-tier VFS RAM hierarchy, trace CONTAINER_OF dispatch, and inspect /proc/self/fdinfo live.
Calling printf() before saving errno overwrites real failure codes with ENOTTY, sloppy error branches leak descriptors, and calling _exit() drops buffered stdio bytes silently. You will master thread-local errno preservation, thread-safe strerror_r(), reverse LIFO goto unwinding, and ISO C exit() versus kernel _exit() termination.
Pre-filling multi-gigabyte partition images with literal zero writes wears out flash media and exhausts disk blocks, while calling lseek(fd, 0, SEEK_SET) before write() on an O_APPEND descriptor fails silently to update byte 0. You will build sparse hole files, compare st_size against st_blocks * 512, and prove O_TRUNC and O_APPEND semantics.
├── m04/ File Sharing, Atomic Operations & Descriptor Control
Control kernel open-file table sharing across dual opens and dup/dup2/dup3, eliminate TOCTOU and offset races with O_EXCL and stateless pread/pwrite, and manipulate live descriptors with fcntl, ioctl, and ftruncate.
Opening the same file twice in one process creates silent cursor-overwrite bugs, whereas duplicating a descriptor aliases one shared f_pos across handles and trips dup3() self-duplication EINVAL traps. You will compare all three VFS sharing topologies, test dup/dup2/dup3 flags, and implement leak-free STDOUT_FILENO redirection.
Splitting an existence check or cursor seek across two syscalls opens a preemption window where attackers swap symlinks or sibling threads clobber record offsets. You will eliminate TOCTOU and cursor races using O_CREAT | O_EXCL, directory-pinned openat(), kernel-locked O_APPEND, and stateless pread()/pwrite().
Calling fcntl(fd, F_SETFL, O_NONBLOCK) without F_GETFL silently wipes O_APPEND, unpadded long fields inside custom ioctl structs break 32/64-bit ABIs with ENOTTY, and shrinking a file with ftruncate() leaves f_pos stranded past EOF. You will master fcntl flag tiers, ABI-safe _IOWR ioctls, and ftruncate() resizing.
├── m05/ Standard C Library (stdio) Streams & Formatted I/O
Map glibc FILE streams and fopen mode strings to kernel openat flags, serialize fixed binary records safely with fread/fwrite/fseeko and feof/ferror triage, and construct truncation-safe snprintf and fgets/strtol codecs.
Emitting thousands of tiny telemetry records via raw write() syscalls burns microseconds in Ring 3-to-Ring 0 trap overhead, while naive fopen("w+") omits O_CLOEXEC and O_EXCL protections. You will dissect glibc FILE control blocks, benchmark buffered syscall amortization, map fopen() modes to openat() flags, and test open_memstream().
Looping on while (!feof(fp)) duplicates the final record on every clean file, storing fgetc() into char spins forever on unsigned-char ARMv7 Linux, and skipping fseeko() between fwrite() and fread() corrupts update streams. You will master item-counted binary stdio, 64-bit fseeko/ftello, turnaround barriers, and 257-state EOF triage.
A successful write() only copies bytes into volatile kernel DRAM—an abrupt power cut erases committed transactions unless explicit persistence barriers flush both file data and parent directories. You will master fsync(), fdatasync(), directory syncs, demand-paged mmap() CoW vs shared faults, and STATX_DIOALIGN O_DIRECT DMA.
Calling fdatasync(fileno(fp)) without fflush(fp) first syncs an empty kernel page cache while committed bytes sit stranded in Ring 3 heap RAM, and calling close(fd) after fclose(fdopen(fd, ...)) kills unrelated sockets! You will master setvbuf() modes, two-stage durability, and single-owner fdopen()/fileno() rules.
In-place record overwrites corrupt both old and new values on power loss, while CRC32-only WAL headers replay stale transactions when preallocated log segments are recycled. In this capstone lesson you will synthesize O_CLOEXEC, branchless IEEE 802.3 CRC32 + 64-bit seq WAL framing, fdatasync(), ftruncate() crash healing, and lock-free pread() indexing.
Leitner spaced-repetition terminal cards and TSV deck for syscalls, flags, and pitfalls.
# Kernel Systems Academy engineering studio
Every Kernel Systems Academy course follows our 35% principles / 20% guided investigation / 45% engineering studio pedagogy. Listings are compiled against Linux 6.12 · C11 · glibc 2.39 under strict compiler flags (-Wall -Wextra -Werror), and each module culminates in an evidence-checked lab graded locally by ./check.sh.
100% Free Foundation Course (Linux 6.12 · ISO C11)
All 18 lessons, all 6 TAP 13 labs, the 16:9 slide deck, printable PDF/HTML reference handbook, and Leitner flashcards are unlocked for free.
Yes. All fonts, stylesheets, diagrams, search indexes, and progress trackers use relative paths and local browser storage, so the bundle works identically over HTTP and file://.
How are the hands-on labs graded?
Each lab directory includes starter source files and an executable ./check.sh runner emitting TAP version 13 diagnostics (ok / not ok) and exiting 0 when every check passes.
What is included in the free preview?
Preview lessons and the opening module lab are unlocked in full so you can inspect our C11 listings, strace transcripts, and ./check.sh workflow before subscribing.