| |
| |
Foreword to the Second Edition | |
| |
| |
Preface | |
| |
| |
Preface to the Second Edition | |
| |
| |
Preface to the First Edition | |
| |
| |
| |
UNIX System Overview | |
| |
| |
| |
Introduction | |
| |
| |
| |
UNIX Architecture | |
| |
| |
| |
Logging In | |
| |
| |
| |
Files and Directories | |
| |
| |
| |
Input and Output | |
| |
| |
| |
Programs and Processes | |
| |
| |
| |
Error Handling | |
| |
| |
| |
User Identification | |
| |
| |
| |
Signals | |
| |
| |
| |
Time Values | |
| |
| |
| |
System Calls and Librar y Functions | |
| |
| |
| |
Summary | |
| |
| |
| |
UNIX Standardization and Implementations | |
| |
| |
| |
Introduction | |
| |
| |
| |
UNIX Standardization | |
| |
| |
| |
UNIX System Implementations | |
| |
| |
| |
Relationship of Standards and Implementations | |
| |
| |
| |
Limits | |
| |
| |
| |
Options | |
| |
| |
| |
Feature Test Macros | |
| |
| |
| |
Primitive System Data Types | |
| |
| |
| |
Differences Between Standards | |
| |
| |
| |
Summary | |
| |
| |
| |
File I/O | |
| |
| |
| |
Introduction | |
| |
| |
| |
File Descr iptors | |
| |
| |
| |
open and openat Functions | |
| |
| |
| |
creat Function | |
| |
| |
| |
close Function | |
| |
| |
| |
lseek Function | |
| |
| |
| |
read Function | |
| |
| |
| |
write Function | |
| |
| |
| |
I/O Efficiency | |
| |
| |
| |
File Shar ing | |
| |
| |
| |
Atomic Operations | |
| |
| |
| |
dup and dup2 Functions | |
| |
| |
| |
sync, fsync, and fdatasync Functions | |
| |
| |
| |
fcntl Function | |
| |
| |
| |
ioctl Function | |
| |
| |
| |
/dev/fd | |
| |
| |
| |
Summary | |
| |
| |
| |
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 Function | |
| |
| |
| |
chmod, fchmod, and fchmodat Functions | |
| |
| |
| |
Sticky Bit | |
| |
| |
| |
chown, fchown, fchownat, and lchown Functions | |
| |
| |
| |
File Size | |
| |
| |
| |
File Tr uncation | |
| |
| |
| |
File Systems | |
| |
| |
| |
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 Director ies | |
| |
| |
| |
chdir, fchdir, and getcwd Functions | |
| |
| |
| |
Device Special Files | |
| |
| |
| |
Summary of File Access Per mission Bits | |
| |
| |
| |
Summary | |
| |
| |
| |
Standard I/O Library | |
| |
| |
| |
Introduction | |
| |
| |
| |
Streams and FILE Objects | |
| |
| |
| |
Standard Input, Standard Output, and Standard Error | |
| |
| |
| |
Buffer ing | |
| |
| |
| |
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 | |
| |
| |
| |
Temporar y Files | |
| |
| |
| |
Memory Streams | |
| |
| |
| |
Alternatives to Standard I/O | |
| |
| |
| |
Summary | |
| |
| |
| |
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 | |
| |
| |
| |
Summary | |
| |
| |
| |
Process Environment | |
| |
| |
| |
Introduction | |
| |
| |
| |
main Function | |
| |
| |
| |
Process Termination | |
| |
| |
| |
Command-Line Arguments | |
| |
| |
| |
Environment List | |
| |
| |
| |
Memory Lay out of a C Program | |
| |
| |
| |
Shared Librar ies | |
| |
| |
| |
Memory Allocation | |
| |
| |
| |
Environment Var iables | |
| |
| |
| |
setjmp and longjmp Functions | |
| |
| |
| |
getrlimit and setrlimit Functions | |
| |
| |
| |
Summary | |
| |
| |
| |
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 | |
| |
| |
| |
Summary | |
| |
| |
| |
Process Relationships | |
| |
| |
| |
Introduction | |
| |
| |
| |
Ter minal Logins | |
| |
| |
| |
Networ k Logins | |
| |
| |
| |
Process Groups | |
| |
| |
| |
Sessions | |
| |
| |
| |
Controlling Terminal | |
| |
| |
| |
tcgetpgrp, tcsetpgrp, and tcgetsid Functions | |
| |
| |
| |
Job Control | |
| |
| |
| |
Shell Execution of Programs | |
| |
| |
| |
Orphaned Process Groups | |
| |
| |
| |
FreeBSD Implementation | |
| |
| |
| |
Summary | |
| |
| |
| |
Signals | |
| |
| |
| |
Introduction | |
| |
| |
| |
Signal Concepts | |
| |
| |
| |
signal Function | |
| |
| |
| |
Unreliable Signals | |
| |
| |
| |
Interrupted System Calls | |
| |
| |
| |
Reentrant Functions | |
| |
| |
| |
SIGCLD Semantics | |
| |
| |
| |
Reliable-Signal Ter minology 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 | |
| |
| |
| |
Job-Control Signals | |
| |
| |
| |
Signal Names and Numbers | |
| |
| |
| |
Summary | |
| |
| |
| |
Threads | |
| |
| |
| |
Introduction | |
| |
| |
| |
Thread Concepts | |
| |
| |
| |
Thread Identification | |
| |
| |
| |
Thread Creation | |
| |
| |
| |
Thread Termination | |
| |
| |
| |
Thread Synchronization | |
| |
| |
| |
Summary | |
| |
| |
| |
Thread Control | |
| |
| |
| |
Introduction | |
| |
| |
| |
Thread Limits | |
| |
| |
| |
Thread Attr ibutes | |
| |
| |
| |
Synchronization Attr ibutes | |
| |
| |
| |
Reentrancy | |
| |
| |
| |
Thread-Specific Data | |
| |
| |
| |
Cancel Options | |
| |
| |
| |
Threads and Signals | |
| |
| |
| |
Threads and fork | |
| |
| |
| |
Threads and I/O | |
| |
| |
| |
Summary | |
| |
| |
| |
Daemon Processes | |
| |
| |
| |
Introduction | |
| |
| |
| |
Daemon Character istics | |
| |
| |
| |
Coding Rules | |
| |
| |
| |
Error Logging | |
| |
| |
| |
Single-Instance Daemons | |
| |
| |
| |
Daemon Conventions | |
| |
| |
| |
Client-Server Model | |
| |
| |
| |
Summary | |
| |
| |
| |
Advanced I/O | |
| |
| |
| |
Introduction | |
| |
| |
| |
Nonblocking I/O | |
| |
| |
| |
Record Locking | |
| |
| |
| |
I/O Multiplexing | |
| |
| |
| |
Asynchronous I/O | |
| |
| |
| |
readv and writev Functions | |
| |
| |
| |
readn and writen Functions | |
| |
| |
| |
Memory-Mapped I/O | |
| |
| |
| |
Summary | |
| |
| |
| |
Interprocess Communication | |
| |
| |
| |
Introduction | |
| |
| |
| |
Pipes | |
| |
| |
| |
popen and pclose Functions | |
| |
| |
| |
Coprocesses | |
| |
| |
| |
FIFOs | |
| |
| |
| |
XSI IPC | |
| |
| |
| |
Message Queues | |
| |
| |
| |
Semaphores | |
| |
| |
| |
Shared Memor y | |
| |
| |
| |
POSIX Semaphores | |
| |
| |
| |
Client-Server Proper ties | |
| |
| |
| |
| |
| |
| |
Network IPC: Sockets | |
| |
| |
| |
Introduction | |
| |
| |
| |
Socket Descr iptors | |
| |
| |
| |
Addressing | |
| |
| |
| |
Connection Establishment | |
| |
| |
| |
Data Tr ansfer | |
| |
| |
| |
Socket Options | |
| |
| |
| |
Out-of-Band Data | |
| |
| |
| |
Nonblocking and Asynchronous I/O | |
| |
| |
| |
Summary | |
| |
| |
| |
Advanced IPC | |
| |
| |
| |
Introduction | |
| |
| |
| |
UNIX Domain Sockets | |
| |
| |
| |
Unique Connections | |
| |
| |
| |
Passing File Descriptors | |
| |
| |
| |
An Open Server, Version 1 | |
| |
| |
| |
An Open Server, Version 2 | |
| |
| |
| |
Summary | |
| |
| |
| |
Terminal I/O | |
| |
| |
| |
Introduction | |
| |
| |
| |
Over view | |
| |
| |
| |
Special Input Characters | |
| |
| |
| |
Getting and Setting Ter minal Attr ibutes | |
| |
| |
| |
Ter minal Option Flags | |
| |
| |
| |
stty Command | |
| |
| |
| |
Baud Rate Functions | |
| |
| |
| |
Line Control Functions | |
| |
| |
| |
Ter minal Identification | |
| |
| |
| |
Canonical Mode | |
| |
| |
| |
Noncanonical Mode | |
| |
| |
| |
Ter minal Window Size | |
| |
| |
| |
termcap, terminfo, and curses | |
| |
| |
| |
Summary | |
| |
| |
| |
Pseudo Terminals | |
| |
| |
| |
Introduction | |
| |
| |
| |
Over view | |
| |
| |
| |
Opening Pseudo-Ter minal Devices | |
| |
| |
| |
pty_fork Function | |
| |
| |
| |
pty Program | |
| |
| |
| |
Using the pty Program | |
| |
| |
| |
Advanced Features | |
| |
| |
| |
Summary | |
| |
| |
| |
A Database Library | |
| |
| |
| |
Introduction | |
| |
| |
| |
History | |
| |
| |
| |
The Librar y | |
| |
| |
| |
Implementation Over view | |
| |
| |
| |
Centralized or Decentralized? | |
| |
| |
| |
Concurrency | |
| |
| |
| |
Building the Librar y | |
| |
| |
| |
Source Code | |
| |
| |
| |
Perfor mance | |
| |
| |
| |
Summary | |
| |
| |
| |
Communicating with a Network Printer | |
| |
| |
| |
Introduction | |
| |
| |
| |
The Inter net Pr inting Protocol | |
| |
| |
| |
The Hyper text Transfer Protocol | |
| |
| |
| |
Printer Spooling | |
| |
| |
| |
Source Code | |
| |
| |
| |
Summary | |
| |
| |
| |
Function Prototypes | |
| |
| |
| |
Miscellaneous Source Code | |
| |
| |
| |
Our Header File | |
| |
| |
| |
Standard Error Routines | |
| |
| |
| |
Solutions to Selected Exercises | |
| |
| |
Bibliography | |
| |
| |
Index | |