Product Details
Solaris Systems Programming

Solaris Systems Programming
By Rich Teer

Price:

This item is not available for purchase from this store.
Click here to go to Amazon to see other purchasing options.


16 new or used available from $55.39

Average customer review:

Product Description

This book is one that any Solaris systems programmer will want on their shelf. Sun Microsystems' Solaris Operating Environment boasts a significant installed base, but the intricacies of programming in this UNIX environment have been previously unaddressed in book format. In this thorough new book, the author provides context that allows the reader to better understand the subtleties of the Solaris Operating Environment. He explains not only the "how's" but also the "why's" of Solaris programming, complete with a brief history of the operating system. The result is a comprehensive text that Solaris practitioners will refer to time and again as they face and overcome the significant challenges of their everyday work.


Product Details

  • Amazon Sales Rank: #983512 in Books
  • Published on: 2004-08-29
  • Original language: English
  • Number of items: 1
  • Binding: Hardcover
  • 1248 pages

Editorial Reviews

From the Back Cover

Solaris Systems Programming

Rich Teer

The first definitive guide to programming in the Solaris Operating Environment

In the tradition of W. Richard Stevens' Advanced Programming in the UNIX Environment, this book offers comprehensive, practical guidance for systems programmers. It covers all versions of the Solaris OS, from 2.5 through 9 and is relevant to both SPARC™ and x86 platforms. From I/O to IPC, pseudo terminals to localization, and processes to doors, Rich Teer illuminates the unique features and subtleties of this environment as never before.

As a former Sun Microsystems, Inc. consultant, long-time C programmer, and tech reviewer for Stevens' UNIX Network Programming, Teer is singularly well qualified to write this book. Using real-world case studies, code examples, and diagrams, he explains both the "how" and "why" of Solaris systems programming—helping any C programmer write efficient, reliable code. Coverage includes:

  • Terminology and features used in Solaris systems programming
  • Fundamentals: utility functions, file I/O, standard I/O library, date/time operations, users/groups, system information, resource limits, and secure C programming
  • I/O in depth: files, directories, file systems, terminal I/O, and advanced I/O
  • Processes and process control: UNIX process environments, relationships, signals, and daemon processes
  • Interprocess communications: Pipes, FIFOs, System V IPC facilities, doors, and more
  • Appendices on internationalization, localization, and BSD source compatibility
  • Portability guidance: flags all features that are specific to Solaris®

$59.99 U.S./$86.99 Canada
PRENTICE HALL PTR
Upper Saddle River, NJ 07458
www.phptr.com


© Copyright Pearson Education. All rights reserved.

About the Author

About the Author

RICH TEER is a UNIX consultant based in Kelowna, BC, Canada. A long-time respected member of the UNIX community, Rich is an acknowledged Solaris system administration and programming expert, holding SCSA, SCNA, and SCSA certifications. He has fourteen years' C programming experience, and more than nine years' experience working with Sun systems, including two years as a technical support consultant for Sun Microsystems, Inc. He was a technical reviewer for W. Richard Stevens' highly acclaimed UNIX Network Programming, 2nd Edition.


© Copyright Pearson Education. All rights reserved.

Excerpt. © Reprinted by permission. All rights reserved.
Solaris Systems Programming: Preface

Preface

Introduction

This book describes the systems programming interface to the Solaris operating system. Despite the word "Solaris" in the title, this book is suitable for programmers of any UNIX or UNIX-like operating system (that being said, some of the features we describe are specific to Solaris).

Like most operating systems, Solaris provides a huge number of services to programs. Examples include: opening a file, reading that file, allocating memory, getting the current time, starting a new program, and so on. We describe many public interfaces, but unfortunately, despite our best intentions, we can’t cover everything. (A book that tried to cover everything would be so big as to be unwieldy, and would likely never be finished!)

Because the use of undocumented interfaces is hindersome to writing portable programs, we do not describe them. Also, the use of private, undocumented interfaces voids Sun’s Application Certification, since these interfaces can change without notice from release to release.

The functions we describe in this text (nearly 540 of them) are documented in Sections 2 and 3 of the Solaris Reference Manual Collection. However, those manual pages do not provide background material and full examples: that is what this book provides.

Audience

This book can be used both as a tutorial for novice and intermediate programmers, and as a reference for experienced programmers. It is also suitable for use as a text for undergraduate or graduate level programming courses.

The book assumes that the reader has some experience with C programming (although not necessarily on the UNIX platform), and has at least a passing familiarity of UNIX concepts like interacting with the shell, editing programs with a text editor, and pipelines.

Although it isn’t mandatory, access to a Solaris system on which the examples can be tried is highly recommended.

Organization of the Book

This book is divided into six parts:

  • Part 1, Introduction. This part contains introductory and historical background information. It consists of two chapters:

    • Chapter 1, Introduction, is an overview and introduction to many basic UNIX programming concepts and terminology.

    • Chapter 2, A Brief History of Solaris, contains a description of how Solaris has evolved over the years, and it also describes the various standards to which Solaris complies.

  • Part 2, Fundamental Topics. This part describes the interfaces and topics essential to UNIX programming, and consists of seven chapters:

    • Chapter 3, Utility Functions, describes most of the utility functions provided for manipulating character classes, character strings, and byte arrays. It also talks about dynamic memory, temporary files, parsing command line arguments, error reporting, and suspending a process. Many readers will be familiar with most of this material, but it provides a common starting point from which we can build.

    • Chapter 4, Basic File I/O, describes low-level file I/O—how to open and close files, how to read and write them, and how to change the current file offset. It discusses file sharing, and the buffering that programs using these functions must perform for themselves.

    • Chapter 5, The Standard I/O Library, describes the high-level I/O functions that are provided by the standard I/O library.

    • Chapter 6, Date and Time Operations, describes how to get and set the system clock, and the various functions for converting time to and from various formats.

    • Chapter 7, Users and Groups, describes the format of the user, group, and password files and how to obtain information from them. It also explains how to determine who is currently logged into the system, and when a user last logged in or out.

    • Chapter 8, System Information and Resource Limits, describes how to get and set various system and user resource limits, such as the amount of

    • CPU time a process may consume, the maximum number of open files per process, and information such as the system’s hostname, how much memory is installed, and so on.

    • Chapter 9, Secure C Programming, describes several common security flaws in programs (e.g., buffer overflows) and presents some tips for writing programs that are secure by design.

  • Part 3, Input/Output. This part describes the I/O facilities offered by Solaris and consists of four chapters:

    • Chapter 10, Files and Directories, describes the features of files and directories, and the function available to manipulate them. It describes concepts such as the various file types; file permissions; resolving symbolic links; creating, reading, and removing directories; as well as set-user-ID and set-group-ID programs.

    • Chapter 11, Working With File Systems, explains how to read the on-disk data structures for file systems, how to mount and unmount them, and how to read the mounted file system table.

    • Chapter 12, Terminal I/O, talks about terminal I/O, including special input characters, and about examining and modifying terminal attributes. It also describes the functions used to manipulate serial lines (e.g., changing the baud rate or number of bits per character).

    • Chapter 13, Advanced I/O, covers more advanced I/O topics, such as record locking, nonblocking, multiplexed, and asynchronous I/O. It also discusses memory mapped files, access control lists, and extended file attributes.

  • Part 4, Processes and Process Control. This part is about processes and how to control them. It consists of five chapters:

    • Chapter 14, The Environment of a UNIX Process, describes the environment in which a UNIX process runs. It also describes process start-up and termination.

    • Chapter 15, Process Control, describes how to create new processes and how to start another program running. It also discusses how to wait for the termination status of a process, how to avoid race conditions, and process accounting.

    • Chapter 16, Process Relationships, explains the concepts of sessions, process groups, and controlling terminals.

    • Chapter 17, Signals, describes the concepts of reliable and unreliable signals, including how to send them, catch them, block them, and ignore them.

    • Chapter 18, Daemon Processes, describes the characteristics of a daemon and shows how a process can become a daemon. It also describes the facilities for logging messages and how to start only one copy of a daemon.

  • Part 5, Interprocess Communication. This part describes the facilities by which processes may communicate with each other. It consists of four chapters:

    • Chapter 19, Interprocess Communication Using Pipes and FIFOs, describes the oldest, and possibly most oft used, methods of interprocess communication: pipes and FIFOs. It also describes the differences between iterative and concurrent servers.

    • Chapter 20, The System V Interprocess Communication Facility, describes System V message queues, semaphore sets, and shared memory segments.

    • Chapter 21, Advanced Interprocess Communication, describes the concepts of passing file descriptors to other processes, both related and unrelated. It also describes how to attach a detach a pipe to or from a pathname in the file system.

    • Chapter 22, Doors, describes Solaris doors, which facilitate fast remote procedure calls between processes on the same host.

  • Part 6, Pseudo Terminals. This part describes pseudo terminals and consists of just one chapter:

    • Chapter 23, Pseudo Terminals, describes what pseudo terminals are and shows how to create them. From that, it shows how to execute other programs via a pseudo terminal, which is useful for scripting programs that would otherwise have to be run interactively.

There are also five appendices:

  • Appendix A, An Internationalization and Localization Primer, provides a brief introduction to the subjects of internationalization and localization. That is, it describes the concepts of locales and how to write programs that are portable to different languages and regions.

  • Appendix B, The BSD Source Compatibility Package, very briefly describes the BSD Source Compatibility Package, which is a transitionary tool designed to enable programs written to the BSD-based SunOS 4.x APIs to be compiled.

  • Appendix C, Function Summary, presents a summary of all the functions we describe in this text. As well as showing a function prototype for each function (including any return values), the availability of each function—by Solaris version and standard—is also tabulated.

  • Appendix D, Miscellaneous Source Code, shows the source code for the header file we include in most of the example programs. It also presents the source code of the library functions we developed for use in the example programs.

  • Appendix E, Solutions to Selected Exercises, shows possible solutions to many of the numerous end of chapter exercises.

To aid in use as a reference, a thorough index is provided, along with a comprehensive bibliography. To help those reading the book in a random order, numerous cross references to related topics are provided throughout the text.

Source Code and Errata Availability

The source code for all the examples presented in the text is available from the author’s home page (the URL is shown at the end of thi...


Customer Reviews

Plagiarism is bad1
I would recommend Thomas E. Dickey's web page to anybody with open mind to decide on this issue.

http://invisible-island.net/critique/APUE-SSP.html

I would certainly not pass my English Composition classes if I would be paraphrasing that much from somebody's work without proper references.

Cannot recommend this book.1
At first sight, the book appeared to be typical/average.
However, when checking for specific details to post an
opinion of the book I noticed something strange -
paraphrasing of material from Stevens' "Advanced Programming
in the Unix Environment". Teer does not credit the material
which is borrowed. Read more details here -
http://invisible-island.net/critique/APUE-SSP.html

Not a substitute for Stevens' APUE2
Despite the claim on the back cover, the book is far away from the tradition of Richard Stevens' "Advanced Programming in the UNIX Environment". In contrast to APUE, which truly enlightens the reader with all sorts of historical, portability, and background information, Teer's book is not much more than a Solaris API description.

Many of the examples in it will not work unmodified on Linux, BSD, or other platforms. It will thus not be of much help to a novice Unix programmer unless he actually wants to write Solaris-only programs - not a common scenario in the Unix/POSIX world. But a more experienced programmer can just use the Solaris manual pages to get most of the information contained in the book.

Also the book contains one of the most stupid code examples I have ever seen: an snprintf() emulation that works by calling vsprintf() first, then checking its return value to see if the buffer size was large enough, possibly exiting with an error message:

int snprintf (char *buf, size_t n, const char *fmt, ...) { [...]
len = vsprintf (buf, fmt, ap); [...]
if (len >= n)
err_quit ("snprintf: \"%s\" caused a buffer overflow", fmt);

But when such an overflow is actually exploited on the stack by an attacker, vsprintf() may not return at all, rendering the check useless. The code thus gives a false impression of security. This might be regarded even more dangerous than code that does not perform overflow checks at all, especially in the context of a book.

I have to admit that I did not look at too many examples, but I would recommend to be cautious with the book until somebody has verified that this is the only fundamental security error in its code.