Advanced Programming in the Unix Environment

Last updated
Advanced Programming in the Unix Environment
W. Richard Stevens - Advanced Programming in the Unix Environment.jpeg
Author W. Richard Stevens
CountryUnited States
LanguageEnglish
Published1992
Publisher Addison-Wesley

Advanced Programming in the Unix Environment is a computer programming book by W. Richard Stevens describing the application programming interface of the UNIX family of operating systems. The book illustrates UNIX application programming in the C programming language.

Contents

The first edition of the book was published by Addison-Wesley in 1992. It covered programming for the two popular families of the Unix operating system, the Berkeley Software Distribution (in particular 4.3 BSD and 386BSD) and AT&T's UNIX System V (particularly SVR4). The book covers system calls for operations on single file descriptors, special calls like ioctl that operate on file descriptors, and operations on files and directories. It covers the stdio section of the C standard library, and other parts of the library as needed. The several chapters concern the APIs that control processes, process groups, daemons, inter-process communication, and signals. One chapter is devoted to the Unix terminal control and another to the pseudo terminal concept and to libraries like termcap and curses that build atop it. Stevens adds three chapters giving more concrete examples of Unix programming: he implements a database library, communicates with a PostScript printer, and with a modem. The book does not cover network programming: this is the subject of Stevens's 1990 book UNIX Network Programming and his subsequent three-volume TCP/IP Illustrated .

Stevens died in 1999, leaving a second edition incomplete. With the increasing popularity and technical diversification of Unix derivatives, and largely compatible systems like the Linux environment, the code and coverage of Stevens's original became increasingly outdated. Working with Stevens's unfinished notes, Stephen A. Rago completed a second edition which Addison-Wesley published in 2005. This added support for FreeBSD, Linux, Sun's Solaris, and Apple's Darwin, and added coverage of multithreaded programming with POSIX Threads. The second edition features a foreword by Dennis Ritchie and a Unix-themed Dilbert strip by Scott Adams.

The book has been widely lauded as well written, well crafted, and comprehensive. It received a "hearty recommendation" in a Linux Journal review. [1]

OSNews describes it as "one of the best tech books ever published" in a review of the second edition. [2]

Editions

Related Research Articles

Dennis Ritchie American computer scientist

Dennis MacAlistair Ritchie was an American computer scientist. He created the C programming language and, with long-time colleague Ken Thompson, the Unix operating system and B programming language. Ritchie and Thompson were awarded the Turing Award from the ACM in 1983, the Hamming Medal from the IEEE in 1990 and the National Medal of Technology from President Bill Clinton in 1999. Ritchie was the head of Lucent Technologies System Software Research Department when he retired in 2007. He was the "R" in K&R C, and commonly known by his username dmr.

Executable and Linkable Format Standard file format for executables, object code, shared libraries, and core dumps.

In computing, the Executable and Linkable Format, is a common standard file format for executable files, object code, shared libraries, and core dumps. First published in the specification for the application binary interface (ABI) of the Unix operating system version named System V Release 4 (SVR4), and later in the Tool Interface Standard, it was quickly accepted among different vendors of Unix systems. In 1999, it was chosen as the standard binary file format for Unix and Unix-like systems on x86 processors by the 86open project.

Berkeley sockets is an application programming interface (API) for Internet sockets and Unix domain sockets, used for inter-process communication (IPC). It is commonly implemented as a library of linkable modules. It originated with the 4.2BSD Unix operating system, which was released in 1983.

Version 7 Unix 7th Edition of Research Unix alias UNIX Time-Sharing System

Seventh Edition Unix, also called Version 7 Unix, Version 7 or just V7, was an important early release of the Unix operating system. V7, released in 1979, was the last Bell Laboratories release to see widespread distribution before the commercialization of Unix by AT&T Corporation in the early 1980s. V7 was originally developed for Digital Equipment Corporation's PDP-11 minicomputers and was later ported to other platforms.

errno.h is a header file in the standard library of the C programming language. It defines macros for reporting and retrieving error conditions using the symbol errno.

William Richard (Rich) Stevens was a Northern Rhodesia-born American author of computer science books, in particular books on UNIX and TCP/IP.

A chroot on Unix and Unix-like operating systems is an operation that changes the apparent root directory for the current running process and its children. A program that is run in such a modified environment cannot name files outside the designated directory tree. The term "chroot" may refer to the chroot(2) system call or the chroot(8) wrapper program. The modified environment is called a chroot jail.

In Unix and Unix-like computer operating systems, a file descriptor is a unique identifier (handle) for a file or other input/output resource, such as a pipe or network socket.

In computer networking, the Transport Layer Interface (TLI) was the networking API provided by AT&T UNIX System V Release 3 (SVR3) in 1987 and continued into Release 4 (SVR4). TLI was the System V counterpart to the BSD sockets programming interface, which was also provided in UNIX System V Release 4 (SVR4). TLI was later standardized as XTI, the X/Open Transport Interface.

stat (system call)

stat is a Unix system call that returns file attributes about an inode. The semantics of stat vary between operating systems. As an example, Unix command ls uses this system call to retrieve information on files that includes:

File locking is a mechanism that restricts access to a computer file, or to a region of a file, by allowing only one user or process to modify or delete it at a specific time and to prevent reading of the file while it's being modified or deleted.

In computer networking, STREAMS is the native framework in Unix System V for implementing character device drivers, network protocols, and inter-process communication. In this framework, a stream is a chain of coroutines that pass messages between a program and a device driver. STREAMS originated in Version 8 Research Unix, as Streams.

In computing, mkstemp is a POSIX function for creating a temporary file. It accepts an argument that determines the location of the temporary file, and the prefix of its generated filename. After mkstemp was added to the Single UNIX Specification, the function tempnam was deprecated, because the latter carried the risk that a temporary file with the same name could be created by another thread or process within the time from when the caller obtains the temporary filename and attempts to create it. mkstemp does not suffer from this problem.

Berkeley Software Distribution Unix operating system

The Berkeley Software Distribution or Berkeley Standard Distribution (BSD) is a discontinued operating system based on Research Unix, developed and distributed by the Computer Systems Research Group (CSRG) at the University of California, Berkeley. The term "BSD" commonly refers to its descendants, including FreeBSD, OpenBSD, NetBSD, and DragonFly BSD.

Unix Family of computer operating systems that derive from the original AT&T Unix

Unix is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, and others.

ptrace is a system call found in Unix and several Unix-like operating systems. By using ptrace one process can control another, enabling the controller to inspect and manipulate the internal state of its target. ptrace is used by debuggers and other code-analysis tools, mostly as aids to software development.

Unix filesystem Directory structure used by a Unix-like operating system

In Unix and operating systems inspired by it, the file system is considered a central component of the operating system. It was also one of the first parts of the system to be designed and implemented by Ken Thompson in the first experimental version of Unix, dated 1969.

The X/Open Transport Interface (XTI) is an Open Group specification for network application programming present in UNIX System V operating systems. It provides OSI transport layer services with protocol independence. Although Open Group considers this specification withdrawn, an implementation is part of the standard programming interfaces on modern UNIX System V operating systems where it is implemented using the STREAMS character input/output mechanism.

<i>UNIX Network Programming</i>

Unix Network Programming is a book written by W. Richard Stevens. It was published in 1990 by Prentice Hall and covers many topics regarding UNIX networking and Computer network programming. The book focuses on the design and development of network software under UNIX. The book provides descriptions of how and why a given solution works and includes 15,000 lines of C code. The book's summary describes it as "for programmers seeking an in depth tutorial on sockets, transport level interface (TLI), interprocess communications (IPC) facilities under System V and BSD UNIX." The book has been translated into several languages, including Chinese, Italian, German, Japanese and others.

<i>The AWK Programming Language</i>

The AWK Programming Language is a well-known 1988 book written by Alfred V. Aho, Brian W. Kernighan, and Peter J. Weinberger and published by Addison-Wesley, often referred to as the gray book. The book describes the AWK programming language and is the de facto standard for the language, written by its inventors. W. Richard Stevens, author of several UNIX books including Advanced Programming in the Unix Environment, cites the book as one of his favorite technical books. The book is translated to several languages and is cited by many technical papers in the ACM journals.

References

  1. Bausum, David (October 1, 1997). "Advanced Programming in the Unix Environment". Linux Journal (42): 41–42. Archived from the original on 2013-10-17.
  2. Loli-Queru, Eugenia (October 4, 2005). "Book Review: Advanced Programming in the UNIX Environment". OSNews . Archived from the original on 2013-10-17. Retrieved 16 June 2011.