VAXELN Guide to Using POSIX

*HyperReader

  CONTENTS

  Title Page

  Copyright Page

  Preface

  Part I    General Considerations

  1      Introduction

  2      Program Development

  2.1     Compiling, Linking, and Building a VAXELN POSIX Application
    2.1.1      Compiling a VAXELN POSIX Program
    2.1.2      Linking a VAXELN POSIX Program
    2.1.3      Using the System Builder

  2.2     Debugging VAXELN POSIX Programs

  2.3     Error Codes from VAXELN and Interpretation of errno

  2.4     Mixing VAXELN and POSIX Functions

  2.5     Using the Code Examples

  Part II    Program Control

  3      Process Primitives

  3.1     Controlling Processes
    3.1.1      Creating and Executing Processes
    3.1.2      Terminating Processes

  3.2     Using Signals to Coordinate Processes and Events
    3.2.1      Responding to Signals:  Default and Specified Action
    3.2.2      Using a Signal Mask in Interprocess Communication
    3.2.3      Using a Signal to Wake Up a Process That Is Pausing
    3.2.4      Using Signal Masks and Polling

  4      Process Environment

  4.1     Retrieving Process IDs

  4.2     Getting and Setting User IDs

  4.3     Retrieving Process Group IDs

  4.4     Retrieving the User's Group IDs

  4.5     Retrieving Information About the Current Operating System

  5      Directory and File Control

  5.1     Directory Control

  5.2     File Control

  6      Device and Class Specific Functions:  Controlling Terminals

  6.1     Getting and Setting Terminal Baud Rates

  6.2     Controlling the Terminal

  7      System Databases

  7.1     Creating the POSIX System Databases

  7.2     Accessing User Databases

  7.3     Accessing the Group Database

  7.4     Example Showing Database Access

  Part III    Realtime Functions

  8      Processes Synchronization with Binary Semaphores

  8.1     Persistent and Nonpersistent Semaphores

  8.2     Posting and Waiting for Binary Semaphores

  8.3     A Sample Program That Uses Binary Semaphores

  9      Shared Memory

  9.1     Creating and Referencing a Shared Memory Object

  9.2     Mapping Shared Memory Objects

  9.3     Sharing Data

  9.4     Cleaning Up a Shared Memory Object

  9.5     Passing Data Between Processes Through Shared Memory-an Example

  10     Process Memory Locking

  11     Priority Scheduling

  11.1    Scheduling Policies
    11.1.1     First-In/First-Out Scheduling
    11.1.2     Round-Robin Scheduling

  11.2    Scheduling Functions
    11.2.1     Retrieving the Priority and Scheduling Policy
    11.2.2     Setting the Priority and the Scheduling Policy
    11.2.3     Yielding to Another Process

  12     Clocks and Timers

  12.1    Using Data Structures and Resolution for Timing Functions
    12.1.1     Using the timespec Data Structure
    12.1.2     Using the itimerspec Data Structure
    12.1.3     Resolution of the System Clock and Timers

  12.2    Using the Systemwide Clock
    12.2.1     Retrieving System Time
    12.2.2     Setting the System Clock
    12.2.3     Managing Clock Drift
    12.2.4     Converting Time

  12.3    Using Timers
    12.3.1     Creating Timers
    12.3.2     Setting Timer Values
    12.3.3     Retrieving Timer Values
    12.3.4     Disabling Timers

  12.4    Using High-Resolution Sleep

  EXAMPLES

  2-1        Building a VAXELN POSIX Application

  3-1        Creating a Child Process

  3-2        Code for a Child Process

  3-3        Sending a Signal to Another Process

  3-4        Using the alarm( ) Function

  3-5        Using the sigpoll( ) and sigsend( ) Functions

  4-1        Retrieving Process IDs

  4-2        Getting Real and Effective User IDs

  4-3        Retrieving the Process Group ID

  4-4        Retrieving the User's Group IDs

  4-5        Retrieving Operating System and Hardware Information

  5-1        Writing and Reading Files

  6-1        Retrieving the Terminal Input Speed

  6-2        Controlling the Terminal

  7-1        Database Access

  8-1        Binary Semaphores

  9-1        Sharing Memory

  11-1       Setting Scheduling Policies

  12-1       Using the timespec Structure with nanosleep( )

  12-2       Using the time( ) and clock_gettime( ) Functions

  12-3       Creating and Setting Timers

  FIGURES

  2-1        VAXELN POSIX Application Development

  3-1        Components of a Process

  3-2        Creation of a Child Process

  3-3        Replacing the Program in the Child Process with a New Program

  3-4        Using fork( ) and an exec Function Together

  3-5        A Signal Mask That Blocks All Signals But Two

  9-1        Two Processes Share a Memory Object

  11-1       Lists of Runnable Processes at Various Priority Levels

  11-2       Round-Robin Process Scheduling-Using a Quantum

  11-3       Round-Robin Process Scheduling-Execution Sequences for a Single Priority

  TABLES

  3-1        Process Creation and Execution Functions

  3-2        Signals in VAXELN POSIX

  3-3        Signal Control Functions

  4-1        Functions for Controlling and Monitoring the Process Environment

  4-2        Process Environment Configurable System Limits and Options

  6-1        Functions for Controlling Terminals

  7-1        Functions for Accessing the System Databases

  7-2        User Database Structure

  7-3        Process Group Database Structure

  8-1        Binary Semaphore Functions

  9-1        Functions Related to Shared Memory

  9-2        Symbols for Shared Memory Functions Defined in <mman.h>

  10-1       Functions Related to Memory Locking

  11-1       Priority Scheduling Functions

  12-1       Values Used in Setting Timers

  12-2       Timing Resolution Functions

  12-3       Clock Functions

  12-4       Timer Functions