| Preface |
|
xi | |
| Chapter 1 Fundamental Concepts |
|
1 | (70) |
|
1.1 A Whirlwind Tour of UNIX and Linux |
|
|
1 | (15) |
|
|
|
16 | (3) |
|
|
|
19 | (5) |
|
|
|
24 | (14) |
|
|
|
38 | (17) |
|
|
|
55 | (1) |
|
|
|
56 | (11) |
|
1.8 About the Example Code |
|
|
67 | (1) |
|
|
|
68 | (3) |
| Chapter 2 Basic File I/O |
|
71 | (52) |
|
2.1 Introduction to File I/O |
|
|
71 | (1) |
|
2.2 File Descriptors and Open File Descriptions |
|
|
72 | (3) |
|
2.3 Symbols for File Permission Bits |
|
|
75 | (1) |
|
2.4 open and creat System Calls |
|
|
76 | (10) |
|
|
|
86 | (1) |
|
|
|
86 | (2) |
|
2.7 Creating Temporary Files |
|
|
88 | (2) |
|
2.8 File Offsets and O_APPEND |
|
|
90 | (2) |
|
|
|
92 | (4) |
|
|
|
96 | (1) |
|
|
|
97 | (1) |
|
|
|
98 | (7) |
|
|
|
105 | (3) |
|
2.14 pread and pwrite System Calls |
|
|
108 | (2) |
|
2.15 readv and writev System Calls |
|
|
110 | (4) |
|
|
|
114 | (5) |
|
2.17 truncate and ftruncate System Calls |
|
|
119 | (4) |
| Chapter 3 Advanced File I/O |
|
123 | (80) |
|
|
|
123 | (1) |
|
3.2 Disk Special Files and File Systems |
|
|
123 | (14) |
|
3.3 Hard and Symbolic Links |
|
|
137 | (7) |
|
|
|
144 | (3) |
|
3.5 Accessing and Displaying File Metadata |
|
|
147 | (11) |
|
|
|
158 | (23) |
|
|
|
181 | (4) |
|
3.8 More File-Manipulation Calls |
|
|
185 | (4) |
|
|
|
189 | (14) |
| Chapter 4 Terminal I/O |
|
203 | (74) |
|
|
|
203 | (1) |
|
4.2 Reading from a Terminal |
|
|
204 | (20) |
|
4.3 Sessions and Process Groups (Jobs) |
|
|
224 | (8) |
|
|
|
232 | (1) |
|
4.5 Setting Terminal Attributes |
|
|
233 | (12) |
|
4.6 Additional Terminal-Control System Calls |
|
|
245 | (3) |
|
4.7 Terminal-Identification System Calls |
|
|
248 | (2) |
|
4.8 Full-Screen Applications |
|
|
250 | (5) |
|
|
|
255 | (1) |
|
|
|
256 | (21) |
| Chapter 5 Processes and Threads |
|
277 | (84) |
|
|
|
277 | (1) |
|
|
|
277 | (7) |
|
|
|
284 | (8) |
|
5.4 Implementing a Shell (Version 1) |
|
|
292 | (4) |
|
|
|
296 | (4) |
|
5.6 Implementing a Shell (Version 2) |
|
|
300 | (1) |
|
5.7 exit System Calls and Process Termination |
|
|
301 | (3) |
|
5.8 wait, waitpid, and waitid System Calls |
|
|
304 | (9) |
|
5.9 Signals, Termination, and Waiting |
|
|
313 | (1) |
|
5.10 Implementing a Shell (Version 3) |
|
|
314 | (1) |
|
5.11 Getting User and Group IDs |
|
|
315 | (2) |
|
5.12 Setting User and Group IDs |
|
|
317 | (2) |
|
|
|
319 | (1) |
|
|
|
319 | (1) |
|
5.15 Getting and Setting the Priority |
|
|
320 | (2) |
|
|
|
322 | (7) |
|
5.17 Introduction to Threads |
|
|
329 | (21) |
|
5.18 The Blocking Problem |
|
|
350 | (11) |
| Chapter 6 Basic Interprocess Communication |
|
361 | (44) |
|
|
|
361 | (1) |
|
|
|
362 | (9) |
|
6.3 dup and dup2 System Calls |
|
|
371 | (5) |
|
|
|
376 | (14) |
|
6.5 Two-Way Communication with Unidirectional Pipes |
|
|
390 | (9) |
|
6.6 Two-Way Communication with Bidirectional Pipes |
|
|
399 | (6) |
| Chapter 7 Advanced Interprocess Communication |
|
405 | (114) |
|
|
|
405 | (1) |
|
7.2 FIFOs, or Named Pipes |
|
|
406 | (8) |
|
7.3 An Abstract Simple Messaging Interface (SMI) |
|
|
414 | (14) |
|
7.4 System V IPC (Interprocess Communication) |
|
|
428 | (6) |
|
7.5 System V Message Queues |
|
|
434 | (8) |
|
|
|
442 | (3) |
|
|
|
445 | (13) |
|
|
|
458 | (2) |
|
|
|
460 | (9) |
|
|
|
469 | (8) |
|
|
|
477 | (11) |
|
|
|
488 | (1) |
|
7.13 System V Shared Memory |
|
|
489 | (15) |
|
|
|
504 | (11) |
|
7.15 Performance Comparisons |
|
|
515 | (4) |
| Chapter 8 Networking and Sockets |
|
519 | (82) |
|
|
|
520 | (13) |
|
|
|
533 | (11) |
|
|
|
544 | (5) |
|
8.4 Simple Socket Interface (SSI) |
|
|
549 | (14) |
|
8.5 Socket Implementation of SMI |
|
|
563 | (4) |
|
8.6 Connectionless Sockets |
|
|
567 | (10) |
|
|
|
577 | (1) |
|
8.8 Network Database Functions |
|
|
578 | (15) |
|
8.9 Miscellaneous System Calls |
|
|
593 | (4) |
|
8.10 High-Performance Considerations |
|
|
597 | (4) |
| Chapter 9 Signals and Timers |
|
601 | (66) |
|
|
|
601 | (23) |
|
|
|
624 | (10) |
|
9.3 Miscellaneous Signal System Calls |
|
|
634 | (1) |
|
9.4 Deprecated Signal System Calls |
|
|
635 | (2) |
|
9.5 Realtime Signals Extension (RTS) |
|
|
637 | (11) |
|
|
|
648 | (3) |
|
|
|
651 | (16) |
| Appendix A Process Attributes |
|
667 | (6) |
| Appendix B Ux: A C++ Wrapper for Standard UNIX Functions |
|
673 | (4) |
| Appendix C Jtux: A Java/Jython Interface to Standard UNIX Functions |
|
677 | (8) |
| Appendix D Alphabetical and Categorical Function Lists |
|
685 | (18) |
| References |
|
703 | (2) |
| Index |
|
705 | |