Solaris Systems Programming
This title is no longer available.
This title cannot be purchased online
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.
Solaris Systems Programming
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
© Copyright Pearson Education. All rights reserved.
List of Programs.
List of Figures.
PART I. INTRODUCTION.
Files, Directories, and File Systems.
Input and Output.
Programs, Processes, and Threads.
UNIX Time Values.
System Calls and Library Functions.
Introduction to 64-Bit Programming.
Writing 64-Bit Clean Programs.
Compiling and Installing 64-Bit Programs.
The Large File Compilation Environment.
The Transitional Large File Compilation Environment.
2. Chapter Title?
The Early Days: SunOS.
Beyond SunOS: Solaris.
System V Interface Definition.
The Open Group’s XPG4.
The Single UNIX Specification.
Solaris Standards Compliance.
Compiling Standards Conforming Applications.
PART II. FUNDAMENTAL TOPICS.
3. Utility Functions.
Manipulating Character Classes.
Testing Character Class Membership.
Changing Character Class Membership.
Summary of Character Classes.
Manipulating Character Strings.
Finding the Length of a String.
String Searching Functions.
Splitting a String into Tokens.
Functions for Transforming Strings.
Converting Strings to Numbers.
Converting Numbers to Strings.
Manipulating Byte Arrays.
Comparing Byte Arrays.
Copying Byte Arrays.
Searching Byte Arrays.
Initializing Byte Arrays.
Allocating Dynamic Memory.
Freeing Dynamic Memory.
Other Memory Management Packages.
The malloc Library.
The bsdmalloc Library.
The mapmalloc Library.
The watchmalloc Shared Object.
Comparing the malloc Libraries.
Generating Temporary Filenames.
Creating Temporary Files.
Parsing Command Line Arguments.
Error Repor ting.
Suspending a Process.
4. Basic File I/O.
The open Function.
The creat Function.
The close and closefrom Functions.
The lseek and llseek Functions.
The tell Function.
The read and pread Functions.
The write and pwrite Functions.
The readn and writen Functions.
The dup and dup2 Functions.
The fcntl Function.
The ioctl Function.
The fdwalk Function.
The /dev/fd File System.
5. The Standard I/O Library.
File Streams, Data Types, and Constants.
Standard Input, Standard Output, and Standard Error.
Opening a File Stream.
Closing a File Stream.
Reading and Writing.
Character Input Functions.
Character Output Functions.
Line Input Functions.
Line Output Functions.
For matted I/O.
For mat Conversion Specifications.
C Language Escape Sequences.
Positioning a Stream.
File Stream Locking.
Unlocked File Stream I/O.
Standard I/O Efficiency.
6. Date and Time Operations.
The Complexities of Converting Time.
Getting the Current Time.
The difftime Function.
Setting the Current Time.
Getting the Current Time Zone.
Converting between UNIX Time and Calendar Time.
The localtime and localtime_r Functions.
The gmtime and gmtime_r Functions.
The mktime Function.
For matted Date I/O.
Converting a Date to a For matted String.
Converting a For matted String to a Date.
7. Users and Groups.
The Password File.
The Shadow Password File.
Reading and Encrypting Passwords.
The Group File.
The utmpx and wtmpx Files.
The utmp and wtmp Files.
The lastlog File.
The shells File.
8. System Information and Resource Limits.
System Information and Identification.
System Resource Limits.
Per-Process Resource Limits.
The Resource Control Facility.
Resource Control Examples.
Resource Usage Information.
Determining Resource Usage Using the /proc File System.
Determining the System’s Load Average.
9. Secure C Programming.
The Program’s Environment.
The Principle of Least Privilege.
Using chroot Jails.
Tips For Writing Secure Programs.
PART III. INPUT/OUTPUT.
10. Files and Directories.
The stat , fstat , and lstat Functions.
Set-User-ID and Set-Group-ID.
The Sticky Bit.
File Access Permissions.
The access Function.
The umask Function.
The chmod and fchmod Functions.
The chown , fchown , and lchown Functions.
The link and unlink Functions.
The remove and rename Functions.
Resolving Paths that Might Contain Symbolic Links.
The symlink and readlink Functions.
Changing a File’s Access and Modification Times.
Creating and Removing Directories.
The chdir , fchdir , and getcwd Functions.
The chroot and fchroot Functions.
The sync and fsync Functions.
Putting It All Together.
11. Working with File Systems.
The Mounted File System Table.
The mntfs File System ioctl commands.
File System Defaults.
Mounting and Unmounting File Systems.
Obtaining the Status of a File System.
Reading File System Data Structures.
12. Terminal I/O.
Overview of Terminal I/O.
Special Input Characters.
Getting and Setting Terminal Attributes.
Terminal Option Flags.
Baud Rate Functions.
Line Control Functions.
Terminal Window Size.
Device-Independent Terminal Control.
13. Advanced I/O.
Record Locking Using fcntl.
Record Locking Using lockf.
Deadlock and Livelock.
Lock Inheritance and Release.
Mandatory Versus Advisory Locking.
The STREAMS I/O Subsystem.
The putmsg and putpmsg Functions.
The getmsg and getpmsg Functions.
STREAMS ioctl Operations.
STREAMS I/O Using read and write.
The select Function.
The poll Function.
The /dev/poll Device Driver.
Asynchronous I/O With STREAMS Device Files.
Asynchronous I/O With Other Files.
The readv and writev Functions.
The sendfile and sendfilev Functions.
Memory Mapped I/O.
The mmap and munmap Functions.
The mprotect Function.
The madvise Function.
The msync Function.
Locking Pages in Memory.
The memcntl Function.
Summary of Memory Mapped I/O.
Access Control Lists.
The acl and facl Functions.
The aclfromtext and acltotext Functions.
The aclcheck Function.
The aclfrommode and acltomode Functions.
The aclsort Function.
Extended File Attributes.
The openat and attropen Functions.
The fstatat Function.
The unlinkat Function.
The renameat Function.
The fchownat Function.
The futimesat Function.
Changing Extended Attribute File Permissions.
PART IV. PROCESSES AND PROCESS CONTROL.
14. The Environment of a UNIX Process.
Process Star t-Up.
Command Line Arguments.
The Memory Layout of a C Program.
The setjmp and longjmp Functions.
15. Process Control.
The fork and fork1 Functions.
The vfork Function.
The exit and _exit Functions.
The wait Function.
The waitpid Function.
The wait3 and wait4 Functions.
The waitid Function.
The exec Functions.
The system Function.
16. Process Relationships.
The tcgetpgrp and tcsetpgrp Functions.
The tcgetsid Function.
Shell Execution of Programs.
Orphaned Process Groups.
The signal Function.
The sigset Function.
The pause Function.
The sighold , sigrelse , sigignore , and sigpause Functions.
Interrupted System Calls.
Comparing the SIGCHLD and SIGCLD Signals.
The kill , killpg , raise , sigsend , and sigsendset Functions.
The alarm Function.
The sigprocmask Function.
The sigpending Function.
The sigaction Function.
The sigfpe Function.
The sigsetjmp and siglongjmp Functions.
The sigsuspend Function.
The sigwait Function.
The abort Function.
The system Function Revisited.
The sleep Function Revisited.
Job Control Signals.
Alternate Signal Stacks.
System Signal Messages.
The sig2str and str2sig Functions.
18. Daemon Processes.
Characteristics of Daemons.
The STREAMS log Driver.
The syslog Facility.
Becoming a Daemon.
Starting Only One Copy of a Daemon.
PART V. INTERPROCESS COMMUNICATION.
19. Interprocess Communication Using Pipes and FIFOs.
The popen and pclose Functions.
Iterative Versus Concurrent Servers.
20. The System V Interprocess Communication Facility.
System V IPC Concepts.
System V Message Queues.
System V Semaphores Sets.
System V Shared Memory.
21. Advanced Interprocess Communication.
Passing File Descriptors.
An Open Server, Version 1.
Client-Server Connection Functions.
An Open Server, Version 2.
Basic Door Functions.
Door Information Functions.
Advanced Door Facilities.
Premature Termination of a Door Client or Server.
PART VI. PSEUDO TERMINALS.
23. Pseudo Terminals.
Opening a Pseudo Terminal Device.
The pty_fork Function.
The pty Program.
Using the pty Program.
Appendix A. An Internationalization and Localization Primer.
The setlocale Function.
Creating a Message Catalogue.
The bindtextdomain Function.
The gettext , dgettext , and dcgettext Functions.
The textdomain Function.
The strcoll and strxfrm Functions.
Checklist for Writing Internationalized Programs.
Appendix B. The BSD Source Compatibility Package.
Functions That Have Been Removed from the SCP.
Obsolescent SCP-Originated Functions.
SCP-Originated Functions That Are Not Obsolescent.
Appendix C. Function Summary.
Appendix D. Miscellaneous Source Code.
Our Header File, ssp.h.
Standard Error Functions.
File Status Flags Functions.
Section Locking Function.
Our readn and writen Functions.
Ter mination Status Function.
Our Version of snprintf.
Appendix E. Solutions to Selected Exercises.
In the tradition of Stevens' Advanced Programming in the UNIX Environment, programming advice and a thorough reference for Solaris.
° The first significant programming book aimed specifically at the Solaris operating environment
° Real-world case studies, poignant examples, and illustrative diagrams rolled up into a comprehensive text
° Covers all versions of Solaris, from Solaris 2.5 through Solaris 9
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.