Advanced Programming in the Unix Environment (Addison-Wesley Professional Computing Series) First Edition
| W. Richard Stevens (Author) Find all the books, read about the author, and more. See search results for this author |
Use the Amazon App to scan ISBNs and compare prices.
There is a newer edition of this item:
Customers who viewed this item also viewed
UNIX Network ProgrammingHardcover$11.26 shippingGet it as soon as Friday, Oct 7Only 1 left in stock - order soon.
Customers who bought this item also bought
TCP/IP Illustrated, Vol. 1: The Protocols (Addison-Wesley Professional Computing Series)Hardcover$10.73 shippingGet it as soon as Thursday, Oct 13Only 1 left in stock - order soon.
The C Programming LanguagePaperback$9.17 shippingGet it as soon as Thursday, Oct 6Only 2 left in stock - order soon.
Editorial Reviews
From the Back Cover
0201563177B04062001
About the Author
We are deeply saddened to learn of the death of noted author W. Richard Stevens. His passing is obviously a tremendous loss for the technical community, but it is a personal one for us as well. Rich was both a gifted colleague and a valued friend who will be greatly missed. We extend our sympathies to his family.
Obituary from the Arizona Daily Star:
STEVENS, W. Richard, noted author of computer books died on September 1. He is best known for his "UNIX Network Programming" series (1990, 1998, 1999), "Advanced Programming in the UNIX Environment" (1992), and "TCP/IP Illustrated" series (1994, 1995, 1996). Richard was born in 1951 in Luanshya, Northern Rhodesia (now Zambia), where his father worked for the copper industry. The family moved to Salt Lake City, Hurley, New Mexico, Washington, DC and Phalaborwa, South Africa. Richard attended Fishburne Military School in Waynesboro, Virginia. He received a B.SC. in Aerospace Engineering from the University of Michigan in 1973, and an M.S. (1978) and Ph.D. (1982) in Systems Engineering from the University of Arizona. He moved to Tucson in 1975 and from then until 1982 he was employed at Kitt Peak National Observatory as a computer programmer. From 1982 until 1990 he was Vice President of Computing Services at Health Systems International in New Haven, CT, moving back to Tucson in 1990. Here he pursued his career as an author and consultant. He was also an avid pilot and a part-time flight instructor during the 1970's.
He is survived by his loving wife of 20 years, Sally Hodges Stevens; three wonderful children, Bill, Ellen and David; sister, Claire Stevens of Las Vegas, NV; brother, Bob and wife Linda Stevens of Dallas, TX; nieces, Laura, Sarah, Collette, Christy; and nephew, Brad. He is predeceased by his parents, Royale J. Stevens (1915-1984); and Helen Patterson Stevens (1916-1997). Helen lived in Tucson from 1991-1997, and Royale lived here in the early 1930's attending Tucson High School while his father was treated for TB at the Desert Sanitorium (now TMC). The family asks that in lieu of flowers, donations be made in Richard's name to Habitat for Humanity, 2950 E. 22nd Street, Tucson, AZ 85713. A memorial service for Richard will be held at St. Phillip's in the Hills Episcopal Church on Tuesday, September 7th at 12:00 noon. Following the service there will be a reception in the Murphy Gallery of the Church. Please wear colorful clothing to the service; Richard loved colors.
W. Richard Stevens was an acknowledged UNIX and networking expert and the highly-respected author of several books. He was also a sought-after instructor and consultant.
0201563177AB04062001
Excerpt. © Reprinted by permission. All rights reserved.
Introduction
This book describes the programming interface to the Unix system - the system call interface and many of the functions provided in the standard C library. It is intended for anyone writing programs that run under Unix.Like most operating systems, Unix provides numerous services to the programs that are running - open a file, read a file, start a new program, allocate a region of memory, get the current time-of-day, and so on. This has been termed the system call interface. Additionally, the standard C library provides numerous functions that are used by almost every C program (format a variable's value for output, compare two strings, etc.).
The system call interface and the library routines have traditionally been described in Sections 2 and 3 of the Unix Programmer's Manual. This book is not a duplication of these sections. Examples and rationale are missing from the Unix Programmer's Manual, and that's what this book provides.
Unix Standards
The proliferation of different versions of Unix during the 1980s has been tempered by the various international standards that were started during the late 1980s. These include the ANSI standard for the C programming language, the IEEE POSIX family (still being developed), and the X/Open portability guide.This book also describes these standards. But instead of just describing the standards by themselves, we describe them in relation to popular implementations of the standards - System V Release 4 and the forthcoming 4.4BSD. This provides a real-world description, which is often lacking from the standard itself and from books that describe only the standard.
Organization of the Book
This book is divided into six parts:- 1. An overview and introduction to basic Unix programming concepts and terminology (Chapter 1), with a discussion of the various Unix standardization efforts and different Unix implementations (Chapter 2).
- 2. I/O - unbuffered I/O (Chapter 3), properties of files and directories (Chapter 4), the standard I/O library (Chapter 5), and the standard system data files (Chapter 6).
- 3. Processes - the environment of a Unix process (Chapter 7), process control (Chapter 8), the relationships between different processes (Chapter 9), and signals (Chapter 10).
- 4. More I/O - terminal I/O (Chapter 11), advanced I/O (Chapter 12), and daemon processes (Chapter 13).
- 5. IPC - Interprocess communication (Chapters 14 and 15).
- 6. Examples - a database library (Chapter 16), communicating with a PostScript printer (Chapter 17), a modem dialing program (Chapter 18), and using pseudo terminals (Chapter 19).A reading familiarity with C would be beneficial as would some experience using Unix. No prior programming experience with Unix is assumed. This text is intended for programmers familiar with Unix and programmers familiar with some other operating system who wish to learn the details of the services provided by most Unix systems.
Examples in the Text
This book contains many examples - approximately 10,000 lines of source code. All the examples are in the C programming language. Furthermore, these examples are in ANSI C. You should have a copy of the Unix Programmer's Manual for your system handy while reading this book, since reference is made to it for some of the more esoteric and implementation-dependent features.Almost every function and system call is demonstrated with a small, complete program. This lets us see the arguments and return values and is often easier to comprehend than the use of the function in a much larger program. But since some of the small programs are contrived examples, a few bigger examples are also included (Chapters 16, 17, 18, and 19). These larger examples demonstrate the programming techniques in larger, real-world examples.
All the examples have been included in the text directly from their source files. A machine-readable copy of all the examples is available via anonymous FTP from the Internet host ftp.uu.net in the file published/books/stevens.advprog.tar.Z. Obtaining the source code allows you to modify the programs from this text and experiment with them on your system.
Systems Used to Test the Examples
Unfortunately all operating systems are moving targets. Unix is no exception. The following diagram shows the recent evolution of the various versions of System V and 4.xBSD.
4.3+BSD 4.3BSD 4.3BSD Tahoe 4.3BSD Reno 4.4BSD? BSD Net 1 BSD Net 2 +-+----+-------+---+--+---+---+----+-+---+---+-+--+-+ 1986 1987 1988 + 1989 + 1990 + 1991 1992 + + + SVR3.0 SVR3.1 SVR3.2+ + SVR4 + XPG3 ANSI C POSIX.1
4.xBSD are the various systems from the Computer Systems Research Group at the University of California at Berkeley. This group also distributes the BSD Net 1 and BSD Net 2 releases - publicly available source code from the 4.xBSD systems. SVRx refers to System V Release x from AT&T. XPG3 is the X/Open Portability Guide, Issue 3, and ANSI C is the ANSI standard for the C programming language. POSIX.1 is the IEEE and ISO standard for the interface to a Unix-like system. We'll have more to say about these different standards and the various versions of Unix in Sections 2.2 and 2.3.In this text we use the term 4.3+BSD to refer to the Unix system from Berkeley that is somewhere between the BSD Net 2 release and 4.4BSD.
At the time of this writing, 4.4BSD was not released, so the system could not be called 4.4BSD. Nevertheless a simple name was needed to refer to this system and 4.3+BSD is used throughout the text.
Most of the examples in this text have been run on four different versions of Unix:
- 1. Unix System V/386 Release 4.0 Version 2.0 ("vanilla SVR4") from U.H. Corp. (UHC), on an Intel 80386 processor.
- 2. 4.3+BSD at the Computer Systems Research Group, Computer Science Division, University of California at Berkeley, on a Hewlett Packard workstation.
- 3. BSD/386 (a derivative of the BSD Net 2 release) from Berkeley Software Design, Inc., on an Intel 80386 processor. This system is almost identical to what we call 4.3+BSD.
- 4. SunOS 4.1.1 and 4.1.2 (systems with a strong Berkeley heritage but many System V features) from Sun Microsystems, on a SPARCstation SLC.Numerous timing tests are provided in the text and the systems used for the test are identified.
Acknowledgments
Once again I am indebted to my family for their love, support, and many lost weekends over the past year and a half. Writing a book is, in many ways, a family affair. Thank you Sally, Bill, Ellen, and David.I am especially grateful to Brian Kernighan for his help in the book. His numerous thorough reviews of the entire manuscript and his gentle prodding for better prose hopefully show in the final result. Steve Rago was also a great resource, both in reviewing the entire manuscript and answering many questions about the details and history of System V. My thanks to the other technical reviewers used by Addison-Wesley, who provided valuable comments on various portions of the manuscript: Maury Bach, Mark Ellis, Jeff Gitlin, Peter Honeyman, John Linderman, Doug McIlroy, Evi Nemeth, Craig Partridge, Dave Presotto, Gary Wilson, and Gary Wright.
Keith Bostic and Kirk McKusick at the U.C. Berkeley CSRG provided an account that was used to test the examples on the latest BSD system. (Many thanks to Peter Salus too.) Sam Nataros and Joachim Sacksen at UHC provided the copy of SVR4 used to test the examples. Trent Hein helped obtain the alpha and beta copies of BSD/386.
Other friends have helped in many small, but significant ways over the past few years: Paul Lucchina, Joe Godsil, Jim Hogue, Ed Tankus, and Gary Wright. My editor at Addison-Wesley, John Wait, has been a great friend through it all. He never complained when the due date slipped and the page count kept increasing. A special thanks to the National Optical Astronomy Observatories (NOAO), especially Sidney Wolff, Richard Wolff, and Steve Grandi, for providing computer time.
Real Unix books are written using troff and this book follows that time-honored tradition. Camera-ready copy of the book was produced by the author using the groff package written by James Clark. Many thanks to James Clark for providing this excellent system and for his rapid response to bug fixes. Perhaps someday I will really understand troff footer traps.
I welcome electronic mail from any readers with comments, suggestions, or bug fixes: rstevens@kohala.com.
W. Richard Stevens
Tucson, Arizona
April 1992
http://www.kohala.com/~rstevens
0201563177P04242003
Product details
- Publisher : Addison-Wesley; First Edition (April 30, 1992)
- Language : English
- Hardcover : 768 pages
- ISBN-10 : 0201563177
- ISBN-13 : 978-0201563177
- Item Weight : 3.95 pounds
- Dimensions : 7.75 x 2.25 x 9.5 inches
- Best Sellers Rank: #484,529 in Books (See Top 100 in Books)
- #12 in Unix Programming
- #1,660 in Computer Software (Books)
- #5,008 in Mathematics (Books)
- Customer Reviews:
About the authors

Discover more of the author’s books, see similar authors, read author blogs and more

Discover more of the author’s books, see similar authors, read author blogs and more
Customer reviews
Customer Reviews, including Product Star Ratings help customers to learn more about the product and decide whether it is the right product for them.
To calculate the overall star rating and percentage breakdown by star, we don’t use a simple average. Instead, our system considers things like how recent a review is and if the reviewer bought the item on Amazon. It also analyzed reviews to verify trustworthiness.
Learn more how customers reviews work on AmazonTop reviews from the United States
There was a problem filtering reviews right now. Please try again later.
Now, I really want to know if the author has any plan for writting "Advanced Programming in the MFC", which would become a best book on MFC and he did with this one.
Finally : Don't live without this book, if you want to program in UNIX & Linux.
Preface
1. Introduction (a "whirlwind tour of Unix")
2. Unix Standardization and Implementations
3. File I/O
4. Files and Directories
5. Standard I/O Library
6. System Data Files and Information
7. The Environment of a Unix Process
8. Process Control
9. Process Relationships
10. Signals
11. Terminal I/O
12. Advanced I/O
13. Daemon Processes
14. Interprocess Communication
15. Advanced Interprocess Communication
16. A Database Library
17. Communicating with a PostScript Printer
18. A Modem Dialer
19. Pseudo Terminals
Appendices
A. Function Prototypes
B. Miscellaneous Source Code (all source code is available for download)
C. Solutions to Selected Exercises
Bibliography
Index
The first thing to understand about the book is that while it can be used as just a reference work (the index is wonderful), it really is a book you can and should read. Even if you think you know a lot of this stuff, you can be surprised at what you can still learn.
What makes the book so much more useful than just a collection of man-page print-outs (that dreary and painfully common form of UNIX "book") is the method of presentation. Stevens' basic atom of organization is the function call. For each call (or minor variations on a single call), he provides the C prototype, and then, in text, explains what the function does, what it's arguments are for, and then typically provides a small C program that demonstrates it in action, which he then explains. These function-level building blocks are arranged into related sets, each of which is a chapter in the book. Each chapter has a wrapper that consists of an introduction explaining some basic concepts and history of the functions described in that chapter, and some review exercises at the end. The chapters themselves are arranged so that the earlier chapters describe the basic functions, and the later chapters describe the more difficult functions. Every chapter both teaches the reader something of immediate use in writing code (even the introduction has sample programs), as well as preparing him for the more difficult subjects that lie ahead.
Now for the caveats. Stevens absolutely assumes that you know how to program in C and that you know how to use Unix development tools (or at least that you have some other source from which to learn them). This is not the book to learn how to use C or particular shells, editors, compilers, linkers, or debuggers. Similarly, new Unix variants, such as Linux and MacOS X, receive no specific mention here at all (though the book is invaluable for both). Also, there is no discussion of the various GUI interfaces offered on many current Unix systems - for those, some other book will necessary.
One other thing worth mentioning is the cost of the book. Don't be put off by it - Stevens' book has been justifying that cost for a lot of readers for a lot of years.
In closing, I've been a developer for many years and have owned many computer books. I recommend very few of them, but can't recommend this one highly enough. It is one of the few books I've had that routinely lies open beside me when I work. In addition to my personal recommendation, you might look not only at all the positive reviews for this book, but also at the reviews for "competitive" books and notice how often they refer you back to this one. This book is the standard by which other UNIX programming books are measured, and so far, it has not been surpassed.
From the first 14-15 chapters it seems like this is one of the best API references I saw. It's not just Unix, it's the way the author writes. He tells you what can be done, how exactly and what to watch for. Typical chapter can look something like:
---
Chapter 93. Cooking Eggs.
Eggs are one of the delicious and nutricious meals. Kitchenware provides the following functions to cook eggs:
egg_t eboil(egg_t egg, time_t time);
egg_t epanfry(egg_t egg, time_t time);
egg_t emicrowave(egg_t egg, time_t time);
All three functions take egg and time to cook and return egg. If time is 0 the egg is cooked until ready. If time is less than 0, it's cooked either for abs(time) or until ready whichever is less. Note, that only superuser can microwave an egg. Historically, these functions were written to operate with kitchen eggs only. Latest versions of Kitchenware add a function yolkctl(egg_t egg, bird_t whose) that you call with eggs before you pass them cooking functions.
Exercises:
1. Microwave an egg. What happened ? Explain why.
---
Well, this is just a few lines, whereas in the book it takes pages and pages of very detailed pedantic explanation. And this was great until approximately chapter 14, when the author started to put more and more sample code inline, in pursue of showing the functional working application or set of functions. This is one of the downsides (to me, if you like to dig through C code rather than reading plain text words - all the better). I think that a book like that should be a reference. The author does not show any algorithms and ideas anyway, so why bothering writing something big ? Give men a bricks and they will build the house themselves.
The other downside is also about the C sample code. As I said - the way Mr. Stevens writes text is very good. And the code is good as well, but not for a sample. In every single sample he is checking every possible error and not simply puts nice little trellis (...) where error handling should be, but actually handles them. Too pedantic and turns half of all the samples into calls to err_output or something. And at the very same time he uses custom header file (ourhdr.h) listed in appendix X, thus making it confusing to catch which is a new function you are reading about, and which is another auxiliary macro from that custom header.
One more thing - the book is basically all about <unistd.h> & Co, it does not tell anything about advanced libraries, like regular expressions, Berkeley DB or zlib. I guess that's why there are several more volumes of the same author.
The bottom line is, this book makes a good reference in basic Unix API.
Top reviews from other countries
Very good!
Strong recommendation!
I will buy from the seller again if he has what I need. Thanks







