Advanced Unix Programming / Edition 2

Advanced Unix Programming / Edition 2

4.0 2
by Marc J. Rochkind
     
 

ISBN-10: 0131411543

ISBN-13: 9780131411548

Pub. Date: 04/23/2004

Publisher: Addison-Wesley

The classic guide to UNIX® programming-completely updated!

UNIX application programming requires a mastery of system-level services. Making sense of the many functions-more than 1,100 functions in the current UNIX specification-is a daunting task, so for years programmers have turned to Advanced UNIX Programming for its clear, expert advice on how to use the

…  See more details below

Overview

The classic guide to UNIX® programming-completely updated!

UNIX application programming requires a mastery of system-level services. Making sense of the many functions-more than 1,100 functions in the current UNIX specification-is a daunting task, so for years programmers have turned to Advanced UNIX Programming for its clear, expert advice on how to use the key functions reliably.

An enormous number of changes have taken place in the UNIX environment since the landmark first edition. In Advanced UNIX Programming, Second Edition, UNIX pioneer Marc J. Rochkind brings the book fully up to date, with all-new, comprehensive coverage including:

  • POSIX
  • Solaris™
  • Linux®
  • FreeBSD
  • Darwin, the Mac™ OS X kernel
  • And more than 200 new system calls

Rochkind's fully updated classic explains all the UNIX system calls you're likely to need, all in a single volume!

  • Interprocess communication, networking (sockets), pseudo terminals, asynchronous I/O, advanced signals, realtime, and threads
  • Covers the system calls you'll actually use-no need to plow through hundreds of improperly implemented, obsolete, and otherwise unnecessary system calls!
  • Thousands of lines of example code include a Web browser and server, a keystroke recorder/player, and a shell complete with pipelines, redirection, and background processes
  • Emphasis on the practical-ensuring portability, avoiding pitfalls, and much more!

Since 1985, the one book to have for mastering UNIX application programming has been Rochkind's Advanced UNIX Programming. Now completely updated, the second edition remains the choice for up-to-the-minute, in-depth coverage of the essential system-level services of the UNIX family of operating systems.

Read More

Product Details

ISBN-13:
9780131411548
Publisher:
Addison-Wesley
Publication date:
04/23/2004
Series:
Addison-Wesley Professional Computing Series
Edition description:
2ND
Pages:
448
Sales rank:
1,330,273
Product dimensions:
7.00(w) x 8.90(h) x 1.80(d)

Table of Contents

Preface.

1 Fundamental Concepts.

A Whirlwind Tour of UNIX and Linux. Versions of UNIX. Using System Calls. Error Handling. UNIX Standards. Common Header File. Dates and Times. About the Example Code. Essential Resources.

2. Basic File I/O.

Introduction to File I/O. File Descriptors and Open File Descriptions. Symbols for File Permission Bits. open and creat System Calls. umask System Call. unlink System Call. Creating Temporary Files. File Offsets and O_APPEND. write System Call. read System Call. close System Call. User Buffered I/O. lseek System Call. pread and pwrite System Calls. readv and writev System Calls. Synchronized I/O. truncate and ftruncate System Calls.

3. Advanced File I/O.

Introduction. Disk Special Files and File Systems. Hard and Symbolic Links. Pathnames. Accessing and Displaying File Metadata. Directories. Changing an I-Node. More File-Manipulation Calls. Asynchronous I/O.

4. Terminal I/O.

Introduction. Reading from a Terminal. Sessions and Process Groups (Jobs). ioctl System Call. Setting Terminal Attributes. Additional Terminal-Control System Calls. Terminal-Identification System Calls. Full-Screen Applications. STREAMS I/O. Pseudo Terminals.

5. Processes and Threads.

Introduction. Environment. exec System Calls. Implementing a Shell (Version 1). fork System Call. Implementing a Shell (Version 2). exit System Calls and Process Termination. wait, waitpid, and waitid System Calls. Signals, Termination, and Waiting. Implementing a Shell (Version 3). Getting User and Group Ids. Setting User and Group Ids. Getting Process Ids. chroot System Call. Getting and Setting the Priority. Process Limits. Introduction to Threads. The Blocking Problem.

6. Basic Interprocess Communication.

Introduction. Pipes. dup and dup2 System Calls. A Real Shell. Two-Way Communication with Unidirectional Pipes. Two-Way Communication with Bidirectional Pipes.

7. Advanced Interprocess Communication.

Introduction. FIFOs, or Named Pipes. An Abstract Simple Messaging Interface (SMI). System V IPC (Interprocess Communication). System V Message Queues. POSIX IPC. POSIX Message Queues. About Semaphores. System V Semaphores. POSIX Semaphores. File Locking. About Shared Memory. System V Shared Memory. POSIX Shared Memory. Performance Comparisons.

8. Networking and Sockets.

Socket Basics. Socket Addresses. Socket Options. Simple Socket Interface (SSI). Socket Implementation of SMI. Connectionless Sockets. Out-of-Band Data. Network Database Functions. Miscellaneous System Calls. High-Performance Considerations.

9. Signals and Timers.

Signal Basics. Waiting for a Signal. Miscellaneous Signal System Calls. Deprecated Signal System Calls. Realtime Signals Extension (RTS). Global Jumps. Clocks and Timers.

Appendix A. Process Attributes.

Appendix B. Ux: A C++ Wrapper for Standard UNIX Functions.

Appendix C. Jtux: A Java/Jython Interface to Standard UNIX Functions.

Appendix D. Alphabetical and Categorical Function Lists.

References.

Index.

Read More

Customer Reviews

Average Review:

Write a Review

and post it to your social network

     

Most Helpful Customer Reviews

See all customer reviews >

Advanced Unix Programming 4 out of 5 based on 0 ratings. 2 reviews.
Guest More than 1 year ago
(reviewed for the Calgary Linux Users Group Guild) There is a saying which goes, 'UNIX is user-friendly; it's just picky about who its friends are.' Rochkind's book presents enough material to make the reader an acquaintance, leaving the building of a friendship as an exercise for the highly committed. He makes a careful selection of just over 300 of the most important system calls and groups them into a handful of broad topics: I/O (file and terminal), processes and threads, inter-process communication (including sockets), signals, and timers. He takes great care to highlight what is available in Solaris (version 8), Linux (SuSE 8), BSD (FreeBSD 4.6), and Darwin (6.8; MacOS 10.2.8), and how to write something that has a hope of running on all of them. The system calls he describes are the ones anyone writing UNIX applications must know about. That is his target audience, and he meets that target squarely. If you are not already a C programmer and UNIX user, this book will not be useful for you. The exercises and code samples are reflective of the title, and demonstrates in a short space how to put the kernel to use. Rochkind also includes some example code that should work, but will not, just to illustrate that things are not as simple as they could be. He then walks the reader through the necessary corrections, bringing enlightenment as he goes. Each chapter contains this mix of tutorial material, useful to those who are starting to explore the UNIX kernel and how it can serve their applications, and reference material, useful to those looking for the bit of wisdom a man page cannot provide, but years of experience can. There are two technical things that I found missing from the book. The significant one is a discussion of how to deal with multiple processors, particularly around semaphores and other kinds of locks. This would be a valuable addition to the chapter on inter-process communications, especially now that these machines are becoming more common. The second, and by no means serious, omission is actually one that arises because of what he does include in an appendix: if he can describe a Java class library, why not make a reference to a set of Perl modules, too? There are two reasons why I give the book four stars and not five. One reason is a matter of taste. I am not a fan of C preprocessor macro functions, but Rochkind makes heavy use of them in his examples to simplify error trapping and reduce the volume of code that had to be printed. This forced me to read code in a different way than my colleagues and I write it. I found it awkward to pick out the particular system call being used when it was coded as a parameter to a macro. The second is that I found his treatment of signals to be confusing. Admittedly, signal handling is not simple (and the newer signal-handling calls do little to help), but the chapter on signals felt like it was rushed to completion to meet the publication deadline. I read that chapter twice, and am still scratching my head. Add a handful of typographical errors to these irritants, and I wound up with a book that was not a joy to read, but a chore. I will still use the book as an occasional reference, reflecting the comfortable professional relationship, but not intimate friendship, I have with UNIX, and maybe I will learn more on a subsequent reading.
Guest More than 1 year ago
In 1987, I encountered the first edition of Rochkind's book. Grew to depend on it as an authoritative discourse on serious unix interprocess programming. Now (finally!) he has issued an updated edition. (Has it really been 19 years?) What is different? Much. Indeed, most of the book. In the first chapter, he summarises myriad developments in the unix world and, of course, the rise of linux. He writes for all the current unix variations and linux. Since 1985, there has been a plethora of different interprocess communications methods. So the chapters on these form a prominent part of the book. Then, naturally, in the networking chapter, who can ignore the web? So Rochkind gives a concise detour into http, with example code for a simple browser and web server. One thing unchanged from the first edition is the well deserved use of 'Advanced' in the title. The treatment is sophisticated and, frankly, not an easy read for someone new to the subject. Rochkind writes well, but you do have to concentrate. He goes at a pace that at a very minimum assumes you are already facile in C and with using unix at the user level. The source code examples are simple, once you grasp the concepts. The problems he furnishes in each chapter can be extremely useful if you want to deepen your understanding. The questions are nontrivial and usually expand on salient points discussed in the chapters. If you are indeed new to all this, you should make a serious attempt at the problems.