- Preface to the Third Edition
- Preface to the Second Edition
- Preface to the First Edition
Preface to the Second Edition
Introduction
Rich Stevens and I first met through an e-mail exchange when I reported a typographical error in his first book, UNIX Network Programming. He used to kid me about being the person to send him his first errata notice for the book. Until his death in 1999, we exchanged e-mail irregularly, usually when one of us had a question we thought the other might be able to answer. We met for dinner at USENIX conferences and when Rich was teaching in the area.
Rich Stevens was a friend who always conducted himself as a gentleman. When I wrote UNIX System V Network Programming in 1993, I intended it to be a System V version of Rich’s UNIX Network Programming. As was his nature, Rich gladly reviewed chapters for me, and treated me not as a competitor, but as a colleague. We often talked about collaborating on a STREAMS version of his TCP/IP Illustrated book. Had events been different, we might have actually done it, but since Rich is no longer with us, revising Advanced Programming in the UNIX Environment is the closest I’ll ever get to writing a book with him.
When the editors at Addison-Wesley told me that they wanted to update Rich’s book, I thought that there wouldn’t be too much to change. Even after 13 years, Rich’s work still holds up well. But the UNIX industry is vastly different today from what it was when the book was first published.
- The System V variants are slowly being replaced by Linux. The major system vendors that ship their hardware with their own versions of the UNIX System have either made Linux ports available or announced support for Linux. Solaris is perhaps the last descendant of UNIX System V Release 4 with any appreciable market share.
- After 4.4BSD was released, the Computing Science Research Group (CSRG) from the University of California at Berkeley decided to put an end to its development of the UNIX operating system, but several different groups of volunteers still maintain publicly available versions.
- The introduction of Linux, supported by thousands of volunteers, has made it possible for anyone with a computer to run an operating system similar to the UNIX System, with freely available source code for the newest hardware devices. The success of Linux is something of a curiosity, given that several free BSD alternatives are readily available.
- Continuing its trend as an innovative company, Apple Computer abandoned its old Mac operating system and replaced it with one based on Mach and FreeBSD.
Thus, I’ve tried to update the information presented in this book to reflect these four platforms.
After Rich wrote Advanced Programming in the UNIX Environment in 1992, I got rid of most of my UNIX programmer’s manuals. To this day, the two books I keep closest to my desk are a dictionary and a copy of Advanced Programming in the UNIX Environment. I hope you find this revision equally useful.
Changes from the First Edition
Rich’s work holds up well. I’ve tried not to change his original vision for this book, but a lot has happened in 13 years. This is especially true with the standards that affect the UNIX programming interface.
Throughout the book, I’ve updated interfaces that have changed from the ongoing efforts in standards organizations. This is most noticeable in Chapter 2, since its primary topic is standards. The 2001 version of the POSIX.1 standard, which we use in this revision, is much more comprehensive than the 1990 version on which the first edition of this book was based. The 1990 ISO C standard was updated in 1999, and some changes affect the interfaces in the POSIX.1 standard.
A lot more interfaces are now covered by the POSIX.1 specification. The base specifications of the Single UNIX Specification (published by The Open Group, formerly X/Open) have been merged with POSIX.1. POSIX.1 now includes several 1003.1 standards and draft standards that were formerly published separately.
Accordingly, I’ve added chapters to cover some new topics. Threads and multithreaded programming are important concepts because they present a cleaner way for programmers to deal with concurrency and asynchrony.
The socket interface is now part of POSIX.1. It provides a single interface to interprocess communication (IPC), regardless of the location of the process, and is a natural extension of the IPC chapters.
I’ve omitted most of the real-time interfaces that appear in POSIX.1. These are best treated in a text devoted to real-time programming. One such book appears in the bibliography.
I’ve updated the case studies in the last chapters to cover more relevant real-world examples. For example, few systems these days are connected to a PostScript printer via a serial or parallel port. Most PostScript printers today are accessed via a network, so I’ve changed the case study that deals with PostScript printer communication to take this into account.
The chapter on modem communication is less relevant these days. So that the original material is not lost, however, it is available on the book’s Web site in two formats: PostScript (http://www.apuebook.com/lostchapter/modem.ps) and PDF (http://www.apuebook.com/lostchapter/modem.pdf).
The source code for the examples shown in this book is also available at www.apuebook.com. Most of the examples have been run on four platforms:
- FreeBSD 5.2.1, a derivative of the 4.4BSD release from the Computer Systems Research Group at the University of California at Berkeley, running on an Intel Pentium processor
- Linux 2.4.22 (the Mandrake 9.2 distribution), a free UNIX-like operating system, running on Intel Pentium processors 3. Solaris 9, a derivative of System V Release 4 from Sun Microsystems, running on a 64-bit UltraSPARC IIi processor
- Darwin 7.4.0, an operating environment based on FreeBSD and Mach, supported by Apple Mac OS X, version 10.3, on a PowerPC processor
Acknowledgments
Rich Stevens wrote the first edition of this book on his own, and it became an instant classic.
I couldn’t have updated this book without the support of my family. They put up with piles of papers scattered about the house (well, more so than usual), my monopolizing most of the computers in the house, and lots of hours with my face buried behind a computer terminal. My wife, Jeanne, even helped out by installing Linux for me on one of the test machines.
The technical reviewers suggested many improvements and helped make sure that the content was accurate. Many thanks to David Bausum, David Boreham, Keith Bostic, Mark Ellis, Phil Howard, Andrew Josey, Mukesh Kacker, Brian Kernighan, Bengt Kleberg, Ben Kuperman, Eric Raymond, and Andy Rudoff.
I’d also like to thank Andy Rudoff for answering questions about Solaris and Dennis Ritchie for digging up old papers and answering history questions. Once again, the staff at Addison-Wesley was great to work with. Thanks to Tyrrell Albaugh, Mary Franz, John Fuller, Karen Gettman, Jessica Goldstein, Noreen Regina, and John Wait. My thanks to Evelyn Pyle for the fine job of copyediting.
As Rich did, I also welcome electronic mail from any readers with comments, suggestions, or bug fixes.
Warren, New Jersey Stephen A. Rago
April 2005 sar@apuebook.com