0%

Book Description

Advanced UNIX Programming goes beyond the fundamentals of UNIX programming and presents information and techniques the readers needs to expand their knowledge base. Designed for professional UNIX programmers, this book builds on the skills and knowledge the reader already possesses. It includes coverage of internet processes, interprocess control, file system manipulation, synchronization, and much more.

Table of Contents

  1. Copyright
  2. About The Author
  3. Acknowledgments
  4. Introduction
  5. Files and Directories
    1. Compiler Notes and Options
      1. Online Manual Pages
      2. Example Code in This Book
      3. Compiling C Programs
      4. Managing Compiler Warnings
      5. Compiling to Standards
      6. Summary
    2. UNIX File System Objects
      1. File System Objects
      2. Permissions
      3. Working with Files Under UNIX
      4. UNIX File I/O
      5. Summary
    3. Error Handling and Reporting
      1. Determining Success or Failure
      2. Determining the Reason for Failure
      3. The Old errno Value
      4. The New errno Value
      5. Reporting on errno Values
      6. Testing for Errors Using stdio(3)
      7. Summary
    4. UNIX Input and Output
      1. The umask(2) Function and umask Bits
      2. Reading and Writing
      3. Seeking Within a File
      4. Truncating Files
      5. Sparse Files
      6. Forcing Data to Media
      7. Scattered Reading and Writing
      8. Determining Your tty Name
      9. Summary
    5. File Locking
      1. Understanding Lock Types
      2. The Lock File Technique
      3. Record Locking
      4. Summary
    6. Managing Files and Their Properties
      1. Removing Files
      2. Linking Files
      3. Moving Files
      4. Obtaining File System Information
      5. Testing Access to a File
      6. Symbolic Links
      7. File Permissions and Ownership
      8. Named Pipes (FIFOs)
      9. Obtaining Size and Configuration Information
      10. Summary
    7. Directory Management
      1. Obtaining the Working Directory
      2. Changing the Current Directory
      3. Making a New Directory
      4. Removing a Directory
      5. Opening a Directory for Searching
      6. Closing a Directory
      7. Searching a Directory
      8. Rewinding to the Start of a Directory
      9. Saving Position Within a Directory
      10. Restoring Position Within a Directory
      11. Scanning a Directory
      12. Walking a Directory Structure
      13. Changing Your Root Directory
      14. Summary
    8. Temporary Files and Process Cleanup
      1. Creating Temporary Files
      2. Making Files Temporary
      3. Summary
  6. Library Functions
    1. UNIX Command-Line Processing
      1. Command-Line Conventions
      2. Arguments That Look Like Options
      3. The getopt(3) Function
      4. The getsubopt(3) Function
      5. GNU Long Options Extension
      6. Summary
    2. Conversion Functions
      1. Simple Conversion Functions
      2. Using sscanf(3) for Conversion and Validation
      3. The strtol(3) and strtoul(3) Functions
      4. Large Integer Conversions
      5. BSD strtoq(3) and strtouq(3) Functions
      6. The strtod(3) Function
      7. Summary
    3. UNIX Date and Time Facilities
      1. Time Zones
      2. Defining the Date and Time Data Type
      3. Time Conversion Functions
      4. Customizing Date and Time Formats with strftime(3)
      5. Summary
    4. User ID, Password, and Group Management
      1. Introduction to UNIX User Management
      2. The getuid(2) and geteuid(2) Functions
      3. The getgid(2) and getegid(2) Functions
      4. Real, Effective, and Saved User ID
      5. Setting User ID
      6. Setting Group ID
      7. The FreeBSD Function issetugid(2)
      8. The /etc/passwd File
      9. The Password Database Routines
      10. The Group Database
      11. Related Re-entrant Functions
      12. Supplementary Groups
      13. Summary
    5. Static and Shared Libraries
      1. The Static Library
      2. The Shared Library
      3. Comparing Static and Shared Libraries
      4. Dynamic Library Loading
      5. Summary
    6. Database Library Routines
      1. The NDBM Database
      2. An NDBM Database Example
      3. Summary
  7. Advanced Concepts
    1. Signals
      1. Understanding UNIX Signals
      2. Reliable and Unreliable Signals
      3. The Unreliable signal(3) API
      4. The Reliable Signal API
      5. Controlling Signals
      6. Applying the alarm(3) Function
      7. Calling Functions from a Signal Handler
      8. Applying the EINTR Error Code
      9. Raising Signals
      10. Summary
    2. Efficient I/O Scheduling
      1. Non-Blocking I/O
      2. I/O Scheduling Functions
      3. I/O Polling
      4. Summary
    3. Timers
      1. The Sleep Functions
      2. Interval Timer Functions
      3. Summary
    4. Pipes and Processes
      1. UNIX Pipes
      2. External Processes Without Pipes
      3. Summary
    5. Forked Processes
      1. Overview of the UNIX Fork Process
      2. The fork(2) Function
      3. Waiting for Process Completion
      4. Executing New Programs
      5. Summary
    6. Pattern Matching
      1. Shell Patterns
      2. String Pattern Functions
      3. The glob(3) Function
      4. Summary
    7. Regular Expressions
      1. Understanding Regular Expressions
      2. The Regular Expression Library
      3. Summary
    8. Interprocess Communications
      1. Types of IPC
      2. The Message Queue
      3. Shared Memory
      4. Semaphores
      5. Referencing IPC Resources
      6. Destroying IPC Resources
      7. Summary
    9. Message Queues
      1. Controlling a Message Queue
      2. Sending and Receiving Messages
      3. Applying Message Queues
      4. Summary
    10. Semaphores
      1. Semaphore Utility Program
      2. Creating and Accessing Semaphore Sets
      3. Destroying Semaphore Sets
      4. Controlling Semaphores
      5. Using Semaphores
      6. Summary
    11. Shared Memory
      1. The globvar Utility Program
      2. Shared Memory System Calls
      3. Using Shared Memory
      4. Summary
    12. Memory-Mapped Files
      1. Determining the Page Size
      2. Creating Memory Mappings
      3. Controlling Memory-Mapped Regions
      4. Destroying Memory Mappings
      5. Summary
    13. X Window Programming
      1. Event-Driven Programming
      2. An Xlib Client Program
      3. Summary
  8. Index
18.189.193.172