Advanced Programming in the UNIX® Environment

Professional Computing Series

W. Richard Stevens

Publisher: Addison-Wesley, 1992, 768 pages

ISBN: 0-201-56317-7

Keywords: Programming

Last modified: April 6, 2021, 7:40 a.m.

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.

  • 1. Introduction.
    • Logging In.
    • Files and Directories.
    • Input and Output.
    • Programs and Processes.
    • ANSI C Features.
    • Error Handling.
    • User Identification.
    • Signals.
    • Unix Time Values.
    • System Calls and Library Functions.
  • 2. Unix Standardization and Implementations.
    • Unix Standardization.
    • ANSI C.
    • IEEE POSIX.
    • X/Open XPG3.
    • FIPS.
    • Unix Implementations.
    • System V Release 4.
    • 4.3+BSD.
    • Relationship of Standards and Implementations.
    • Limits.
    • ANSI C Limits.
    • POSIX Limits.
    • XPG3 Limits.
    • sysconf, pathconf, and fpathconf Functions.
    • FIPS 151-1 Requirements.
    • Summary of Limits.
    • Indeterminate Run-Time Limits.
    • Feature Test Macros.
    • Primitive System Data Types.
    • Conflicts Between Standards.
  • 3. File I/O.
    • File Descriptors.
    • open Function.
    • creat Function.
    • close Function.
    • lseek Function.
    • read Function.
    • write Function.
    • I/O Efficiency.
    • File Sharing.
    • Atomic Operations.
    • dup and dup2 Functions.
    • fcntl Function.
    • ioctl Function.
    • /dev/fd.
  • 4. Files and Directories.
    • stat, fstat, and lstat Functions.
    • File Types.
    • Set-User-ID and Set-Group-ID.
    • File Access Permissions.
    • Ownership of New Files and Directories.
    • access Function.
    • umask Function.
    • chmod and fchmod Functions.
    • Sticky Bit.
    • chown, fchown, and lchown Functions.
    • File Size.
    • File Truncation.
    • Filesystems.
    • link, unlink, remove, and rename Functions.
    • Symbolic Links.
    • symlink and readlink Functions.
    • File Times.
    • utime Function.
    • mkdir and rmdir Functions.
    • Reading Directories.
    • chdir, fchdir, and getcwd Functions.
    • Special Device Files.
    • sync and fsync Functions.
    • Summary of File Access Permission Bits.
  • 5. Standard I/O Library.
    • Streams and FILE Objects.
    • Standard Input, Standard Output, and Standard Error.
    • Buffering.
    • Opening a Stream.
    • Reading and Writing a Stream.
    • Line-at-a-Time I/O.
    • Standard I/O Efficiency.
    • Binary I/O.
    • Positioning a Stream.
    • Formatted I/O.
    • Implementation Details.
    • Temporary Files.
    • Alternatives to Standard I/O.
  • 6. System Data Files and Information.
    • Password File.
    • Shadow Passwords.
    • Group File.
    • Supplementary Group IDs.
    • Other Data Files.
    • Login Accounting.
    • System Identification.
    • Time and Date Routines.
  • 7. The Environment of a Unix Process.
    • main Function.
    • Process Termination.
    • Command-Line Arguments.
    • Environment List.
    • Memory Layout of a C Program.
    • Shared Libraries.
    • Memory Allocation.
    • Environment Variables.
    • setjmp and longjmp Functions.
    • getrlimit and setrlimit Functions.
  • 8. Process Control.
    • Process Identifiers.
    • fork Function.
    • vfork Function.
    • exit Functions.
    • wait and waitpid Functions.
    • wait3 and wait4 Functions.
    • Race Conditions.
    • exec Functions.
    • Changing User IDs and Group IDs.
    • Interpreter Files.
    • system Function.
    • Process Accounting.
    • User Identification.
    • Process Times.
  • 9. Process Relationships.
    • Terminal Logins.
    • Network Logins.
    • Process Groups.
    • Sessions.
    • Controlling Terminal.
    • tcgetpgrp and tcsetpgrp Functions.
    • Job Control.
    • Shell Execution of Programs.
    • Orphaned Process Groups.
    • 4.3+BSD Implementation.
  • 10. Signals.
    • Signal Concepts.
    • signal Function.
    • Unreliable Signals.
    • Interrupted System Calls.
    • Reentrant Functions.
    • SIGCLD Semantics.
    • Reliable Signal Terminology and Semantics.
    • kill and raise Functions.
    • alarm and pause Functions.
    • Signal Sets.
    • sigprocmask Function.
    • sigpending Function.
    • sigaction Function.
    • sigsetjmp and siglongjmp Functions.
    • sigsuspend Function.
    • abort Function.
    • system Function.
    • sleep Function.
    • Job-Control Signals.
    • Additional Features.
  • 11. Terminal I/O.
    • Overview.
    • Special Input Characters.
    • Getting and Setting Terminal Attributes.
    • Terminal Option Flags.
    • stty Command.
    • Baud Rate Functions.
    • Line Control Functions.
    • Terminal Identification.
    • Canonical Mode.
    • Noncanonical Mode.
    • Terminal Window Size.
    • termcap, terminfo, and curses.
  • 12. Advanced I/O
    • Nonblocking I/O.
    • Record Locking.
    • Streams.
    • I/O Multiplexing.
    • select Function.
    • poll Function.
    • Asynchronous I/O.
    • System V Release 4.
    • 4.3+BSD.
    • readv and writev Functions.
    • readn and writen Functions.
    • Memory Mapped I/O.
  • 13. Daemon Processes.
    • Daemon Characteristics.
    • Coding Rules.
    • Error Logging.
    • SVR4 Streams log Driver.
    • 4.3+BSD syslog Facility.
    • Client-Server Model.
  • 14. Interprocess Communication.
    • Pipes.
    • popen and pclose Functions.
    • Coprocesses.
    • FIFOs.
    • System V IPC.
    • Identifiers and Keys.
    • Permission Structure.
    • Configuration Limits.
    • Advantages and Disadvantages.
    • Message Queues.
    • Semaphores.
    • Shared Memory.
    • Client-Server Properties.
  • 15. Advanced Interprocess Communication.
    • Stream Pipes.
    • Passing File Descriptors.
    • System V Release 4.
    • 4.3BSD.
    • 4.3+BSD.
    • An Open Server, Version 1.
    • Client-Server Connection Functions.
    • System V Release 4.
    • 4.3+BSD.
    • An Open Server, Version 2.
  • 16. A Database Library.
    • History.
    • The Library.
    • Implementation Overview.
    • Centralized or Decentralized?
    • Concurrency.
    • Source Code.
    • Performance.
  • 17. Communicating with a PostScript Printer.
    • PostScript Communication Dynamics.
    • Printer Spooling.
    • Source.
    • Code.
  • 18. A Modem Dialer.
    • History.
    • Program Design.
    • Data Files.
    • Server Design.
    • Server Source Code.
    • Client Design.
    • Client Source Code.
  • 19. Pseudo Terminals.
    • Overview.
    • Opening Pseudo-Terminal Devices.
    • System V Release 4.
    • 4.3+BSD.
    • pty_fork Function.
    • pty Program.
    • Using the pty Program.
    • Advanced Features.
  • Appendix A. Function Prototypes.
  • Appendix B. Miscellaneous Source Code.
    • Our Header File.
    • Standard Error Routines.
  • Appendix C. Solutions to Selected Exercises.
  • Bibliography.

Reviews

Advanced Programming in the UNIX® Environment

Reviewed by Roland Buresund

Good ******* (7 out of 10)

Last modified: May 21, 2007, 2:54 a.m.

A very good overview of the system services in the UNIX environment.

Comments

There are currently no comments

New Comment

required

required (not published)

optional

required

captcha

required