Core · Module 5
Low-Level File I/O and POSIX System Calls
Interface directly with the operating system kernel using file descriptors, unbuffered read/write loops, descriptor duplication, inode metadata, and mmap.
Operating system kernels mediate all disk, terminal, pipe, and socket interactions through low-level system call interfaces. This module bridges user-space C programs and kernel data structures by exploring file descriptor tables, unbuffered byte transfers, metadata inspection, and memory-mapped files. Mastering these primitives allows you to write resilient, high-throughput systems software that interacts directly with Unix operating system facilities.
- 1File Handling with Standard I/OPro — members onlyOpen, read, write, and close text files safely with C's buffered stdio library before moving down to POSIX file descriptors.18 min
- 2File Descriptors and Kernel File TablesPro — members onlyTrace how the kernel resolves integer file descriptors through the three-table architecture, evaluate shared file offsets, and inspect descriptor limits.16 min
- 3Unbuffered I/O: read, write, and Partial TransfersPro — members onlyMaster low-level POSIX read and write system calls, construct robust partial transfer loops, and handle signal interrupts and EOF conditions.16 min
- 4File Offsets, Sparse Files, and lseekPro — members onlyManipulate file offsets with lseek, understand sparse files and unallocated disk holes, and navigate non-seekable streams.15 min
- 5Standard I/O Buffering vs System CallsPro — members onlyContrast stdio user-space buffering modes with raw POSIX system calls, diagnose fork duplication bugs, and control buffer flushes with setvbuf.16 min
- 6Descriptor Duplication and Redirection with dup and dup2Pro — members onlyMaster file descriptor duplication, redirect standard streams atomically with dup2, and preserve I/O state across processes.16 min
- 7File Metadata, Permissions, and Inodes with statPro — members onlyInspect filesystem inodes, decode file types and permission masks using POSIX macros, differentiate stat from lstat, and prevent TOCTOU race conditions.16 min
- 8Directory Streams, Hard Links, and SymlinksPro — members onlyTraverse filesystem hierarchies with opendir and readdir, manipulate hard links and symlinks, and manage inode reference lifecycles.16 min
- 9Memory-Mapped I/O with mmap and msyncPro — members onlyMap disk files directly into process address space with mmap, eliminate user-kernel data copying, synchronize dirty pages with msync, and handle SIGBUS faults.16 min
- 10Building, Debugging, and Testing C ProjectsPro — members onlyTurn several C source files into a repeatable build, investigate failures with a debugger, and verify ownership and error paths with focused tests.16 min
- 11System Call Errors, errno, and EINTRPro — members onlyTurn failed POSIX calls into reliable control flow by reading errno, distinguishing transient failures, and retrying operations safely.15 min
- 12Clocks, Timers, and TimeoutsPro — members onlyChoose the right POSIX clock, measure elapsed time monotonically, and design deadlines that remain correct across interruptions.15 min