Course Content
C & Linux System Programming
• LINUX System Overview
◦ Introduction
◦ LINUX Architecture
◦ Logging In
◦ Files and Directories
◦ Input and Output
◦ Programs and Processes
◦ Error Handling
◦ User Identification
◦ Signals
◦ Time Values
◦ System Calls and Library Functions
• UNIX Standardization and Implementations
◦ Introduction
◦ UNIX Standardization
▪ ISO C
▪ IEEE POSIX
▪ The Single UNIX Specification
▪ FIPS
◦ UNIX System Implementations
▪ UNIX System V Release 4
▪ 4.4BSD
▪ FreeBSD
▪ Linux
▪ Mac OS X
▪ FreeBSD
▪ Other UNIX Systems
◦ Relationship of Standards and Implementations
◦ Limits
▪ ISO C Limits
▪ POSIX Limits
▪ XSI Limits
▪ sysconf, pathconf, and fpathconf Functions
▪ Indeterminate Runtime Limits
◦ Option
◦ Feature Test Macros
◦ Primitive System Data Types
◦ Differences Between Standards
• File I/O
◦ Introduction
◦ File Descriptors
◦ open and openat Functions
◦ creat Function
◦ close Function
◦ read Function
◦ write Function
◦ lseek Function
◦ I/O Efficiency
◦ File Sharing
◦ Atomic Operations
◦ dup and dup2 Functions
◦ sync, fsync, and fdatasync Functions
◦ fcntl Functions
◦ ioctl Functions
◦ /dev/fd
• Files and Directories
◦ Introduction
◦ stat, fstat, fstatat, and lstat Functions
◦ File Types
◦ Set-User-ID and Set-Group-ID
◦ File Access Per missions
◦ Ownership of New Files and Directories
◦ access and faccessat Functions
◦ umask Functions
◦ chmod, fchmod, and fchmodat Functions
◦ Sticky Bit
◦ chown, fchown, fchownat, and lchown Function
◦ File size
◦ File Truncation
◦ File System
◦ link, linkat, unlink, unlinkat, and remove Functions
◦ rename and renameat Functions
◦ Symbolic Links
◦ Creating and Reading Symbolic Links
◦ File Times
◦ futimens, utimensat, and utimes Functions
◦ mkdir, mkdirat, and rmdir Functions
◦ Reading Directories
◦ chdir, fchdir, and getcwd Functions
◦ Device Special Files
◦ Summary of File Access Per mission Bits
• Standard I/O Library
◦ Introduction
◦ Streams and FILE Objects
◦ Standard Input, Standard Output, and Standard Error
◦ Buffering
◦ Opening a Stream
◦ Reading and Writing a Stream
◦ Line-at-a-Time I/O
◦ Standard I/O Efficiency
◦ Binary I/O
◦ Positioning a Stream
◦ For matted I/O
◦ Implementation Details
◦ Temporary Files
◦ Memory Streams
◦ Alternatives to Standard
• System Data Files and Information
◦ Introduction
◦ Password File
◦ Shadow Passwords
◦ Group File
◦ Supplementary Group IDs
◦ Implementation Differences
◦ Other Data Files
◦ Login Accounting
◦ System Identification
◦ Time and Date Routines
• Process Environment
◦ Introduction
◦ main Function
◦ Process Termination
◦ Command-Line Arguments
◦ Environment List
◦ Memory Lay out of a C Program
◦ Shared Libraries
◦ Memory Allocation
◦ Environment Variables
◦ setjmp and longjmp Functions
◦ getrlimit and setrlimit Functions
• Process Control
◦ Introduction
◦ Process Identifiers
◦ fork Function
◦ vfork Function
◦ exit Functions
◦ wait and waitpid Functions
◦ waitid Function
◦ wait3 and wait4 Functions
◦ Race Conditions
◦ exec Functions
◦ Changing User IDs and Group IDs
◦ Interpreter Files
◦ system Function
◦ Process Accounting
◦ User Identification
◦ Process Scheduling
◦ Process Times
• Process Relationships
◦ Introduction
◦ Terminal Logins
◦ Network Logins
◦ Process Groups
◦ Sessions
◦ Controlling Terminal
◦ tcgetpgrp, tcsetpgrp, and tcgetsid Functions
◦ Job Control
◦ Shell Execution of Programs
◦ Orphaned Process Groups
◦ FreeBSD Implementation
•
• Signals
◦ Introduction
◦ Signal Concepts
◦ signal Function
◦ Unreliable Signals
◦ Interrupted System Calls
◦ Reentrant Functions
◦ SIGCLD Semantics
◦ Reliable-Signal Terminology and Semantics
◦ kill and raise Functions
◦ alarm and pause Functions
◦ Signal Sets
◦ sigprocmask Function
◦ sigpending Function
◦ sigaction Function
◦ sigsetjmp and siglongjmp Functions
◦ sigsuspend Function
◦ abort Function
◦ system Function
◦ sleep, nanosleep, and clock_nanosleep Functions
◦ sigqueue Function
• Threads
◦ Introduction
◦ Thread Concepts
◦ Thread Identification
◦ Thread Creation
◦ Thread Termination
◦ Thread Synchronization
• Thread Control
◦ Introduction
◦ Thread Limits
◦ Thread Attr ibutes
◦ Synchronization Attr ibutes
▪ Mutax Attributes
▪ Reader & Writer Lock Attributes
▪ Condition Variable Attributes
▪ Barrier Attributes
◦ Reentrancy
◦ Thread-Specific Data
◦ Cancel Options
◦ Threads and Signals
◦ Threads and fork
◦ Threads and I/O
• Daemon Processes
◦ Introduction
◦ Daemon Characteristics
◦ Coding Rules
◦ Error Logging
◦ Single-Instance Daemons
◦ Daemon Conventions
◦ Client–Server Model
• Advanced I/O
◦ Introduction
◦ Nonblocking I/O
◦ Record Locking
◦ I/O Multiplexing
▪ select and pselect Functions
▪ poll Function
◦ Asynchronous I/O
▪ System V Asynchronous I/O
▪ BSD Asynchronous I/O
▪ POSIX Asynchronous I/O
◦ readv and writev Functions
◦ readn and writes Functions
◦ Memory-Mapped I/O
• Interprocess Communication
◦ Introduction
◦ Pipes
◦ popen and pclose Functions
◦ Coprocesses
◦ FIFOs
◦ IPC
▪ Identifiers and Keys
▪ Permission Structure
▪ Configuration Limits
▪ Advantages and Disadvantages
◦ Message Queues
◦ Semaphores
◦ Shared Memory
◦ POSIX Semaphores
◦ Client & Server Properties
• Network IPC: Sockets
◦ Introduction
◦ Socket Descriptors
◦ Addressing
▪ Byte Ordering
▪ Address Formats
▪ Address Lookup
▪ Associating Addresses with Sockets
◦ Connection Establishment
◦ Data Transfer
◦ Socket Options
◦ Out-of-Band Data
◦ Nonblocking and Asynchronous I/O
• Advanced IPC
◦ Introduction
◦ UNIX Domain Sockets
◦ Unique Connections
◦ Passing File Descriptors
◦ An Open Server, Version 1
◦ An Open Server, Version 2
• Terminal I/O
◦ Introduction
◦ Overview
◦ Special Input Characters
◦ Getting and Setting Terminal Attributes
◦ Terminal Option Flags
◦ stty Command
◦ Baud Rate Functions
◦ Line Control Functions
◦ Terminal Identification
◦ Canonical Mode
◦ Noncanonical Mode
◦ Terminal Window Size
◦ termcap, terminfo, and curses
• Pseudo Terminals
◦ Introduction
◦ Overview
◦ Opening Pseudo-Terminal Devices
◦ pty_fork Function
◦ pty Program
◦ Using the pty Program
◦ Advanced Features
• Communicating with a Network Printer
◦ Introduction
◦ The Internet Printing Protocol
◦ The Hyper text Transfer Protocol
◦ Printer Spooling
◦ Source Code
•