🗂️ Exercise Index – Linux System Programming
This is an organized list of all exercises completed so far, including a brief description and links to related resources or files.
📁 mycp
Description: A simple file copy utility implemented in C using low-level system calls (open, read, write, close).
- 📄 README
- 📂 Directory:
mycp/ - ✅ Features:
- Error handling via
perroranderrno - Safe loop with
EINTRhandling - Proper resource cleanup
- Integrated unit tests and Valgrind checks
- Error handling via
🌳 tree
Description: A basic reimplementation of the Unix tree utility that recursively lists directories and files.
- 📄 README
- 📂 Directory:
tree/ - ✅ Features:
- Recursive traversal using
opendirandreaddir - Directory depth display
- Unit tests with mocks for directory structure
- Scripted test automation with Valgrind integration
- Recursive traversal using
🐚 run_scripts
Description: A simple C program that sequentially executes one or more bash scripts, printing each script’s exit status.
- 📄 README
- 📂 Directory:
run_scripts/ - ✅ Features:
- Uses
fork()andexeclp()to run each script in a child process - Waits for each child to finish before executing the next
- Reports normal exit code or termination by signal
- Includes example test scripts and memory checks with Valgrind
- Makefile with targets:
build,run,test,valgrind, andclean
- Uses
📥 downloader
Description: A multi-threaded simulated file downloader implemented in C using POSIX threads (pthreads).
- 📄 README
- 📂 Directory:
downloader/ - ✅ Features:
- Each thread simulates downloading a file by printing periodic progress updates
- Synchronization using
pthreadAPIs - Demonstrates creation, execution, and joining of threads
- Makefile included with standard targets
🧠 memory_analyzer
Description: A simple memory analyzer that allocates memory blocks of different sizes and prints current memory usage.
- 📄 README
- 📂 Directory:
mem_analyzer/ - ✅ Features:
- Allocates blocks using
mallocand frees them after measurement - Reports current memory usage via
/proc/self/status - Minimal implementation aligned with the exercise objectives
- Makefile included with standard targets
- Allocates blocks using
🚦 signal_handler
Description: A C program demonstrating robust signal handling for SIGINT and SIGUSR1 using sigaction with SA_SIGINFO.
- 📄 README
- 📂 Directory:
signal_handler/ - ✅ Features:
- Handles
SIGINTup to three times before exiting - Handles
SIGUSR1with a simple message - Masks signals during handler execution to avoid reentrancy issues
- Includes comments and clear separation of handler logic
- Makefile included with standard targets
- Handles
🔧 Tooling & Automation
Shared tools and scripts used across projects:
Makefilewith:- Targets for
build,test,valgrind, andclean
- Targets for
- Shell script for automated tests:
run_tests.sh - Valgrind memory check reports generated automatically