Home > Store

Advanced Programming in the UNIX Environment, Rough Cuts, 3rd Edition

Rough Cuts

  • Available to Safari Subscribers
  • About Rough Cuts
  • Rough Cuts are manuscripts that are developed but not yet published, available through Safari. Rough Cuts provide you access to the very latest information on a given topic and offer you the opportunity to interact with the author to influence the final publication.

Not for Sale

Also available in other formats.

Description

  • Copyright 2013
  • Dimensions: 7-3/8" x 9-1/8"
  • Pages: 1024
  • Edition: 3rd
  • Rough Cuts
  • ISBN-10: 0-321-63802-6
  • ISBN-13: 978-0-321-63802-1

This is the Rough Cut version of the printed book.

For more than twenty years, serious C programmers have relied on one book for practical, in-depth knowledge of the programming interfaces that drive the UNIX and Linux kernels: W. Richard Stevens’ Advanced Programming in the UNIX® Environment. Now, once again, Rich’s colleague Steve Rago has thoroughly updated this classic work. The new third edition supports today’s leading platforms, reflects new technical advances and best practices, and aligns with Version 4 of the Single UNIX Specification.

Steve carefully retains the spirit and approach that have made this book so valuable. Building on Rich’s pioneering work, he begins with files, directories, and processes, carefully laying the groundwork for more advanced techniques, such as signal handling and terminal I/O. He also thoroughly covers threads and multithreaded programming, and socket-based IPC.

This edition covers more than seventy new interfaces, including POSIX asynchronous I/O, spin locks, barriers, and POSIX semaphores. Most obsolete interfaces have been removed, except for a few that are ubiquitous. Nearly all examples have been tested on four modern platforms: Solaris 10, Mac OS X version 10.6.8 (Darwin 10.8.0), FreeBSD 8.0, and Ubuntu version 12.04 (based on Linux 3.2).

As in previous editions, you’ll learn through examples, including more than ten thousand lines of downloadable, ISO C source code. More than four hundred system calls and functions are demonstrated with concise, complete programs that clearly illustrate their usage, arguments, and return values. To tie together what you’ve learned, the book presents several chapter-length case studies, each reflecting contemporary environments.

Advanced Programming in the UNIX® Environment has helped generations of programmers write code with exceptional power, performance, and reliability. Now updated for today’s systems, this third edition will be even more valuable.

Sample Content

Table of Contents

Foreword to the Second Edition xix

Preface xxi

Preface to the Second Edition xxv

Preface to the First Edition xxix

 

Chapter 1: UNIX System Overview 1

1.1 Introduction 1

1.2 UNIX Architecture 1

1.3 Logging In 2

1.4 Files and Directories 4

1.5 Input and Output 8

1.6 Programs and Processes 10

1.7 Error Handling 14

1.8 User Identification 16

1.9 Signals 18

1.10 Time Values 20

1.11 System Calls and Librar y Functions 21

1.12 Summary 23

Chapter 2: UNIX Standardization and Implementations 25

2.1 Introduction 25

2.2 UNIX Standardization 25

2.3 UNIX System Implementations 33

2.4 Relationship of Standards and Implementations 36

2.5 Limits 36

2.6 Options 53

2.7 Feature Test Macros 57

2.8 Primitive System Data Types 58

2.9 Differences Between Standards 58

2.10 Summary 60

Chapter 3: File I/O 61

3.1 Introduction 61

3.2 File Descr iptors 61

3.3 open and openat Functions 62

3.4 creat Function 66

3.5 close Function 66

3.6 lseek Function 66

3.7 read Function 71

3.8 write Function 72

3.9 I/O Efficiency 72

3.10 File Shar ing 74

3.11 Atomic Operations 77

3.12 dup and dup2 Functions 79

3.13 sync, fsync, and fdatasync Functions 81

3.14 fcntl Function 82

3.15 ioctl Function 87

3.16 /dev/fd 88

3.17 Summary 90

Chapter 4: Files and Directories 93

4.1 Introduction 93

4.2 stat, fstat, fstatat, and lstat Functions 93

4.3 File Types 95

4.4 Set-User-ID and Set-Group-ID 98

4.5 File Access Per missions 99

4.6 Ownership of New Files and Directories 101

4.7 access and faccessat Functions 102

4.8 umask Function 104

4.9 chmod, fchmod, and fchmodat Functions 106

4.10 Sticky Bit 108

4.11 chown, fchown, fchownat, and lchown Functions 109

4.12 File Size 111

4.13 File Tr uncation 112

4.14 File Systems 113

4.15 link, linkat, unlink, unlinkat, and remove Functions 116

4.16 rename and renameat Functions 119

4.17 Symbolic Links 120

4.18 Creating and Reading Symbolic Links 123

4.19 File Times 124

4.20 futimens, utimensat, and utimes Functions 126

Updates

Submit Errata

More Information