UNIX System Programming / Edition 2

UNIX System Programming / Edition 2

by Keith Haviland, Ben Salama, Marcus Gray, Ben Salama
     
 

View All Available Formats & Editions

ISBN-10: 0201877589

ISBN-13: 9780201877588

Pub. Date: 09/17/1999

Publisher: Addison-Wesley

The UNIX operating system has become a key part of the technology landscape as we move into the 21st century. There are now a huge number of large-scale data management and transaction-processing systems built on UNIX platforms, and UNIX is at the core of the server backbone of the Internet. 'The new edition of this highly successful book for professional programmers

Overview

The UNIX operating system has become a key part of the technology landscape as we move into the 21st century. There are now a huge number of large-scale data management and transaction-processing systems built on UNIX platforms, and UNIX is at the core of the server backbone of the Internet. 'The new edition of this highly successful book for professional programmers provides a lucid and well structured guide to developing UNIX software in the C language, and has been updated to reflect the more distributed environments typical of current IT solutions. UNIX System Programming concentrates on a detailed study of the UNIX system call interface - the programming interface between the UNIX kernel and application software running in the UNIX environment - and additionally covers some of the more important subroutine libraries.

Features fundamental techniques are developed in depth and are fully supported with program examples highly relevant to the two important standards - the X/OPEN portability guide and the IEEE POSIX standard strong emphasis on exercises and examples throughout New to this edition more on signals and signal handling more on interprocess communication using pipes more on advanced interprocess communications and the terminal whole section on sockets From a wealth of experience of developing system and application software, and a real appreciation of the needs of UNIX system programmers, the authors fully appreciate that computing is not a spectator sport. By exploring both system calls and subroutine libraries they give the reader a practical appreciation of when not to reinvent the wheel, as well as a better understanding of the internal workings of this still elegant operating system.

Product Details

ISBN-13:
9780201877588
Publisher:
Addison-Wesley
Publication date:
09/17/1999
Edition description:
2ND, REVISED
Pages:
400
Product dimensions:
22.00(w) x 22.00(h) x 22.00(d)

Table of Contents

Preface vii
Chapter 1 Basic concepts and terminology
1(6)
1.1 The file
1(3)
1.1.1 Directories and pathnames
2(1)
1.1.2 Ownerships and permissions
3(1)
1.1.3 Generalization of the file concept
4(1)
1.2 The Process
4(1)
1.2.1 Inter-process communication
4(1)
1.3 System calls and library subroutines
5(2)
Chapter 2 The file
7(32)
2.1 UNIX file access primitives
7(22)
2.1.1 Introduction
7(2)
2.1.2 The open system call
9(3)
2.1.3 Creating a file with open
12(2)
2.1.4 The creat system call
14(1)
2.1.5 The close system call
15(1)
2.1.6 The read system call
15(3)
2.1.7 The write system call
18(2)
2.1.8 The copyfile example
20(1)
2.1.9 read, write and efficiency
21(1)
2.1.10 Iseek and random access
22(2)
2.1.11 The hotel example
24(2)
2.1.12 Appending data to a file
26(1)
2.1.13 Deleting a file
27(1)
2.1.14 The fcntl system call
27(2)
2.2 Standard input, standard output and standard error
29(4)
2.2.1 Basic Concepts
29(1)
2.2.2 The io example
30(2)
2.2.3 Using standard error
32(1)
2.3 The Standard I/O Library: a look ahead
33(3)
2.4 The errno variable and system calls
36(3)
2.4.1 The perror subroutine
37(2)
Chapter 3 The file in context
39(20)
3.1 Files in a multi-user environment
39(10)
3.1.1 Users and Ownerships
39(1)
3.1.2 Permissions and file modes
40(2)
3.1.3 Extra permission for executable files
42(2)
3.1.4 The file creation mask and the unmask system call
44(1)
3.1.5 open and file permissions
45(1)
3.1.6 Determining file accessibility with access
46(2)
3.1.7 Changing the file permissions with chmod
48(1)
3.1.8 Changing ownership with chown
48(1)
3.2 Files with multiple names
49(4)
3.2.1 The link system call
49(1)
3.2.2 The unlink system call revisited
50(1)
3.2.3 The rename system call
51(1)
3.2.4 Symbolic links
52(1)
3.3 Obtaining file information: stat and fstat
53(6)
3.3.1 chmod revisited
57(2)
Chapter 4 Directories, file systems and special files
59(28)
4.1 Introduction
59(1)
4.2 Directories: the user view
60(2)
4.3 The implementation of a directory
62(5)
4.3.1 link and unlink revisited
63(1)
4.3.2 Dot and double-dot
64(1)
4.3.3 Directory permissions
65(2)
4.4 Programming with directories
67(9)
4.4.1 Creating and removing directories
67(1)
4.4.2 Opening and closing directories
68(1)
4.4.3 Reading directories: readdir and rewinddir
69(3)
4.4.4 The current working directory
72(1)
4.4.5 Changing directories with chdir
72(1)
4.4.6 Finding the name of the current working directory
73(1)
4.4.7 Walking a directory tree
74(2)
4.5 UNIX file systems
76(3)
4.5.1 Caching: sync and fsync
78(1)
4.6 UNIX device files
79(8)
4.6.1 Block and character device files
80(1)
4.6.2 The stat structured revisited
81(1)
4.6.3 File system information
82(2)
4.6.4 File and directory limits: pathconf and fpathconf
84(3)
Chapter 5 The process
87(38)
5.1 Review of the notion of a process
87(2)
5.2 Creating processes
89(3)
5.2.1 The fork system call
89(3)
5.3 Running new programs with exec
92(5)
5.3.1 The exec family
92(3)
5.3.2 Accessing arguments passed with exec
95(2)
5.4 Using exec and fork together
97(3)
5.5 Inherited data and file descriptors
100(3)
5.5.1 fork, files and data
100(2)
5.5.2 exec and open files
102(1)
5.6 Terminating processes with the exit system call
103(1)
5.7 Synchronizing processes
104(4)
5.7.1 The wait system call
104(2)
5.7.2 Waiting for a particular child: waitpid
106(2)
5.8 Zombies and premature exists
108(1)
5.9 smallsh: a command processor
108(6)
5.10 Process attributes
114(11)
5.10.1 The process-id
115(1)
5.10.2 Process groups and process group-ids
116(1)
5.10.3 Changing process group
117(1)
5.10.4 Sessions and session-ids
118(1)
5.10.5 The environment
118(3)
5.10.6 The current working directory
121(1)
5.10.7 The current root directory
121(1)
5.10.8 User- and group-ids
122(1)
5.10.9 File size limits: ulimit
123(1)
5.10.10 Process priorities: nice
123(2)
Chapter 6 Signals and signal handling
125(26)
6.1 Introduction
125(7)
6.1.1 Signal names
127(3)
6.1.2 Normal and abnormal termination
130(2)
6.2 Signal handling
132(9)
6.2.1 Signal sets
132(1)
6.2.2 Setting the signal action: sigaction
133(5)
6.2.3 Signals and system calls
138(1)
6.2.4 sigsetjmp and siglongjmp
139(2)
6.3 Signal blocking
141(2)
6.4 Sending signals
143(8)
6.4.1 Sending signals to other processes: kill
143(2)
6.4.2 Sending signals to yourself: raise and alarm
145(3)
6.4.3 The pause system call
148(3)
Chapter 7 Inter-process communication using pipes
151(28)
7.1 Pipes
151(20)
7.1.1 Pipes at command level
151(1)
7.1.2 Programming with pipes
152(5)
7.1.3 The size of a pipe
157(3)
7.1.4 Closing pipes
160(1)
7.1.5 Non-blocking reads and writes
160(3)
7.1.6 Using select to handle multiple pipes
163(5)
7.1.7 Pipes and the exec system call
168(3)
7.2 FIFOs or named pipes
171(8)
7.2.1 Programming with FIFOs
173(6)
Chapter 8 Advanced inter-process communication
179(40)
8.1 Introduction
179(1)
8.2 Record locking
180(9)
8.2.1 Motivation
180(1)
8.2.2 Record locking with fentl
181(8)
8.3 Advanced IPC facilities
189(30)
8.3.1 Introduction and basic concepts
189(3)
8.3.2 Message passing
192(10)
8.3.3 Semaphores
202(9)
8.3.4 Shared memory
211(6)
8.3.5 The ipcs and ipcrm commands
217(2)
Chapter 9 The terminal
219(34)
9.1 Introduction
219(3)
9.2 The UNIX terminal
222(5)
9.2.1 Control terminals
223(1)
9.2.2 Data transmission
223(1)
9.2.3 Echoing and type-ahead
224(1)
9.2.4 Canonical mode, line editing and special characters
224(3)
9.3 The programm's view
227(15)
9.3.1 The open system call
227(1)
9.3.2 The read system call
228(3)
9.3.3 The write system call
231(1)
9.3.4 ttyname and isatty
231(1)
9.3.5 Changing terminal characteristics: the termios structure
232(7)
9.3.6 The MIN and TIME parameters
239(1)
9.3.7 Other terminal system calls
240(1)
9.3.8 The hangup signal
241(1)
9.4 Pseudo terminals
242(4)
9.5 A terminal handling example: tscript
246(7)
Chapter 10 Sockets
253(20)
10.1 Introduction
253(1)
10.2 Types of connection
254(1)
10.3 Addressing
255(1)
10.3.1 Internet addressing
255(1)
10.3.2 Ports
256(1)
10.4 Socket interface
256(1)
10.4.1 Creation of a transport end point
257(1)
10.5 Programming the connection oriented model
257(11)
10.5.1 Binding
259(1)
10.5.2 Listening
259(1)
10.5.3 Accepting
259(2)
10.5.4 Connecting in the client
261(1)
10.5.5 Sending and receiving data
262(3)
10.5.6 Closing the connection
265(3)
10.6 Programming the connectionless oriented model
268(3)
10.6.1 Sending and receiving messages
268(3)
10.7 The differences between the two models
271(2)
Chapter 11 The Standard I/O Library
273(34)
11.1 Introduction
273(1)
11.2 FILE structures
274(1)
11.3 Opening and closing file streams: fopen and fclose
275(2)
11.4 Single-character I/O: getc and putc
277(2)
11.5 Pushing characters back onto a file stream: ungetc
279(2)
11.6 Standard input, standard output and standard error
281(1)
11.7 Standard I/O status routines
282(2)
11.8 Input and output by line
284(2)
11.9 Binary input and output: fread and fwrite
286(2)
11.10 Random file access: fseek, rewind and ftell
288(1)
11.11 Formatted output: the printf family
289(6)
11.12 Formatted input: the scanf family
295(4)
11.13 Running programs with the Standard I/O Library
299(6)
11.14 Miscellaneous calls
305(2)
11.14.1 freopen and fdopen
305(1)
11.14.2 Buffer control: setbuf and setvbuf
306(1)
Chapter 12 Miscellaneous system calls and library routines
307(22)
12.1 Introduction
307(1)
12.2 Dynamic memory management
307(7)
12.3 Memory mapped I/O and memory manipulation
314(4)
12.4 Time
318(2)
12.5 String and character manipulation
320(4)
12.5.1 The string family
320(2)
12.5.2 String to numeric conversions
322(1)
12.5.3 Characters: validation and conversion
323(1)
12.6 Additional facilities
324(5)
12.6.1 More about sockets
324(1)
12.6.2 Threads
325(1)
12.6.3 Real-time extensions
325(1)
12.6.4 Interrogating the local system
325(1)
12.6.5 Internationalization
326(1)
12.6.6 Mathematical routines
326(3)
Appendix A errno error codes and associated messages 329(8)
A.1 Introduction 329(1)
A.2 A list of error codes and messages 330(7)
Appendix B Major standards 337(4)
B.1 History 337(2)
B.2 Key standards 339(2)
Bibliography and further reading 341(2)
Index 343

Customer Reviews

Average Review:

Write a Review

and post it to your social network

     

Most Helpful Customer Reviews

See all customer reviews >