Home > Store > Operating Systems, Server > Linux/UNIX/Open Source
Advanced Programming in the UNIX® Environment
- By W. Richard Stevens
- Published Jun 30, 1992 by Addison-Wesley Professional. Part of the Addison-Wesley Professional Computing Series series.
- Copyright 1992
- Dimensions: 7-3/8x9-1/4
- Pages: 768
- Edition: 1st
- Book
- ISBN-10: 0-201-56317-7
- ISBN-13: 978-0-201-56317-7
Register your product to gain access to bonus material or receive a coupon.
If you are an experienced C programmer with a working knowledge of UNIX, you cannot afford to be without this up-to-date tutorial on the system call interface and the most important functions found in the ANSI C library. Rich Stevens describes more than 200 system calls and functions; since he believes the best way to learn code is to read code, a brief example accompanies each description.
Building upon information presented in the first 15 chapters, the author offers chapter-long examples teaching you how to create a database library, a PostScript printer driver, a modem dialer, and a program that runs other programs under a pseudo terminal. To make your analysis and understanding of this code even easier, and to allow you to modify it, all of the code in the book is available via UUNET.
A 20-page appendix provides detailed function prototypes for all the UNIX, POSIX, and ANSI C functions that are described in the book, and lists the page on which each prototype function is described in detail. Additional tables throughout the text and a thorough index make Advanced Programming in the UNIX Environment an invaluable reference tool that all UNIX programmers - beginners to experts - will want on their bookshelves.
Advanced Programming in the UNIX Environment is applicable to all major UNIX releases, especially System V Release 4 and the latest release of 4.3BSD, including 386BSD. These real-world implementations allow you to more clearly understand the status of the current and future standards, including IEEE POSIX and XPG3.
0201563177B04062001
|
141 of 147 people found the following review helpful
By
This review is from: Advanced Programming in the UNIX(R) Environment (Addison-Wesley Professional Computing Series) (Hardcover)
The computer industry is notable for the huge quantity of really bad books it engenders. This, however, is not one of those books - this is a great book. Before explaining why it is great, I'd like to get the table of contents out of the way, so that you will know what it covers: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... Read more
29 of 29 people found the following review helpful
This review is from: Advanced Programming in the UNIX(R) Environment (Addison-Wesley Professional Computing Series) (Hardcover)
This is simply the best book that teaches you about Unix system level programming. Almost all system calls are explained in great details along with very comprehensible examples. The author made a claim that this book is not a mere repetition of Unix Programmer's Manual as the manual lacks logic and examples which this book provides. I think he really lived up to that claim.Many difficult topics are made so easy to grasp, sometimes I think this book should be retitled "Advanced Unix Programming Made Easy". The explanation are smooth with pointers to previously discussed concepts just in case you're lost. Each chapter comes with a number of exercises to try your understanding of the chapter, and most of the answers are available in the appendix of the book so this book is also great for self-learners. Before reading this book, I have read "Advanced Unix Programming" by Marc J. Rochkind, and I was confused by many things the guy said in the book plus... Read more
17 of 18 people found the following review helpful
By Berk Demir (Turkey) - See all my reviews
This review is from: Advanced Programming in the UNIX(R) Environment (Addison-Wesley Professional Computing Series) (Hardcover)
The only complete reference for programmers working in the UNIX enviroment. Not just a reference book but a very well guide to learn fundamentals of UNIX programming. Everything you want to know about UNIX programming. Signal handling, file system, I/O and lots of other chapters about advanced programming with UNIX. If you're looking a book to develop "real" advanced apps. or to join the development of Linux kernel and other open system projects, this is the FIRST book you must buy...It's sad to say this but the author of this book; the big guru, Richard Stevens is nomore with us. rest it peace guru... |
› See all 64 customer reviews...
Praise For Advanced Programming in the UNIX® Environment
Quotes of Note
"It (Advanced Programming in the UNIX Environment) is a 'must have' for any serious C programmer who works under UNIX. Its depth, thoroughness, and clarity of explanation are unmatched.""Numerous readers recommended Advanced Programming in the UNIX Environment by W. Richard Stevens (Addison-Wesley), and I'm glad they did; I hadn't even heard of this book, and it's been out since 1992. I just got my hands on a copy, and the first few chapters have been fascinating."
"However, a much more readable and detailed treatment of (UNIX internals) can be found in Advanced Programming in the UNIX Environment by W. Richard Stevens (Addison-Wesley). This book includes lots of realistic examples, and I find it quite helpful when I have systems programming tasks to do."
Online Sample Chapter
Advanced Programming in the UNIX® Environment: UNIX File I/O
Preface
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).
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.
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
0201563177P04062001
Table of Contents
(Each chapter begins with an Introduction and concludes with a Summary.)
1. Introduction.
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.
Appendix A. Function Prototypes.
Appendix B. Miscellaneous Source Code.
Appendix C. Solutions to Selected Exercises.
Bibliography.
Index. 0201563177T04062001
Book
This product currently is not for sale.
Get access to thousands of books and training videos about technology, professional development and digital media from more than 40 leading publishers, including Addison-Wesley, Prentice Hall, Cisco Press, IBM Press, O'Reilly Media, Wrox, Apress, and many more. If you continue your subscription after your 30-day trial, you can receive 30% off a monthly subscription to the Safari Library for up to 12 months. That's a total savings of $199.




