Demonstration of the Linux programming interface
file-holes.c
- Program like cp that copies a regular file that contains holes (sequence of null bytes) and also creates corresponding holes in the target file (without lseek() SEEK_DATA / SEEK_HOLE operations and truncate() / ftruncate() functions)
atomic-append.c
- Demonstration of pread() and writev() performing gather output in program that atomically appends multiple files to a single file
authentication.c
- Demonstration of user authentication against the shadow password file using getpwnam(), getspnam(), getpass() and crypt(), compile program with the -lcrypt option (so it is linked against the crypt library)
time_and_timezone.c
- Program displaying calendar time in seconds and microseconds since Epoch, local time or current time in time zone specified in argument (example: ":Pacific/Auckland"), demonstration of gettimeofday(), time(), localtime(), asctime() and setenv() functions
information-and-limits.c
- Program displaying system information and limits
file-attributes.c
- Program demonstrating system calls chmod() for changing file permissions and ioctl() with FS_IOC_SETFLAGS flag (equivalent to chattr command) for changing file i-node flags
directory-management.c
- Program demonstrating mkdir() and rmdir() commands and directory iteration
monitoring.c
- Program that recursively monitors and logs all file/directory events using tree walking function nftw() and inotify API
signal.c
- Program that fetches and sends pending standard/realtime signals using sigprocmask(), sigwaitinfo(), sigqueue() and kill()
timerfd.c
- Program demonstrating timer using file descriptor with Linux-specific timerfd facility
synchronized-process.c
- Program demonstrating process synchronization using signals to avoid race conditions with fork(), sigprocmask(), sigaction() and sigsuspend()
child-monitoring.c
- Program monitoring terminated child processes (zombies) using waitpid()
mutex.c
- Program demonstrating thread creation, join and mutex usage to avoid race conditions between threads using pthread_create, pthread_join, pthread_mutex_lock() and pthread_mutex_unlock()
cond_variable.c
- Program demonstrating condition variables and signaling changes of states between threads using pthread_cond_signal() and pthread_cond_wait()
cancellation.c
- Program cancelling thread and calling cleanup handler using pthread_cancel(), pthread_cleanup_push() and pthread_cleanup_pop()