sun.com docs.sun.com My Sun Worldwide Sites
Programming Interfaces Guide


September 2008
This book describes interfaces specific to the Solaris™ 10 environment in areas such as shared memory, transport selection, and real-time administration. This book also describes applications that relate to API/ABI compliance, such as appcert. The ONC+ Developer's Guide describes higher-level networking interfaces.
--

Document Information

Preface

1.  Memory and CPU Management

Memory Management Interfaces

Creating and Using Mappings

Removing Mappings

Cache Control

Using mincore

Using mlock and munlock

Using mlockall and munlockall

Using msync

Library-Level Dynamic Memory

Dynamic Memory Allocation

Dynamic Memory Debugging

check -access

check -leaks [-frames n] [-match m]

check -memuse [-frames n] [-match m]

check -all [-frames n] [-match m]

check [funcs] [files] [loadobjects]

Other Memory Control Interfaces

Using sysconf

Using mprotect

Using brk and sbrk

CPU Performance Counters

API Additions to libcpc

Initialization Interfaces

Hardware Query Interfaces

Configuration Interfaces

Binding

Sampling

Buffer Operations

Activation Interfaces

Error Handling Interfaces

2.  Remote Shared Memory API for Solaris Clusters

Overview of the Shared Memory Model

API Framework

API Library Functions

Interconnect Controller Operations

rsm_get_controller

rsm_release_controller

rsm_get_controller_attr

Cluster Topology Operations

rsm_get_interconnect_topology

rsm_free_interconnect_topology

Data Structures

Administrative Operations

Memory Segment Operations

Export-Side Memory Segment Operations

Memory Segment Creation and Destruction

Memory Segment Publish, Republish, and Unpublish

Memory Segment Rebind

Import-Side Memory Segment Operations

Memory Segment Connection and Disconnection

Memory Access Primitives

Scatter-Gather Access

Segment Mapping

Barrier Operations

Event Operations

RSMAPI General Usage Notes

Segment Allocation and File Descriptor Usage

Export-Side Considerations

Import-Side Considerations

RSM Configurable Parameters

RSMAPI Usage Example

3.  Session Description Protocol API

Session Description API Overview

SDP Library Functions

Creating the SDP Session Structure

Creating a New SDP Session Structure

Adding an Origin Field to the SDP Session Structure

Adding a Name Field to the SDP Session Structure

Adding an Information Field to the SDP Session Structure

Adding a URI Field to the SDP Session Structure

Adding an Email Field to the SDP Session Structure

Adding a Telephone Tield to the SDP Session Structure

Adding a Connection Field to the SDP Session Structure

Adding a Bandwidth Field to the SDP Session Structure

Adding a Time Field to the SDP Session Structure

Adding a Repeat Field to the SDP Session Structure

Adding a Zone Field to the SDP Session Structure

Adding a Key Field to the SDP Session Structure

Adding an Attribute Field to the SDP Session Structure

Adding a Media Field to the SDP Session Structure

Code Sample: Building an SDP Session Structure

Searching the SDP Session Structure

Finding an Attribute in an SDP Session Structure

Finding Media in an SDP Session Structure

Finding a Media Format in an SDP Session Structure

Shutting Down the SDP Session Structure

Deleting Fields From the SDP Session Structure

Deleting Fields From the SDP Media Structure

Deleting Media From the SDP Media Structure

Deleting an Attribute From the SDP Media Structure

Deleting an Attribute From the SDP Media Structure

SDP API Utility Functions

Parsing the SDP Session Structure

Cloning an Existing SDP Session Structure

Converting an SDP Session Structure to a String

4.  Process Scheduler

Overview of the Scheduler

Time-Sharing Class

System Class

Real-time Class

Interactive Class

Fair-Share Class

Fixed-Priority Class

Commands and Interfaces

priocntl Usage

priocntl Interface

Interactions With Other Interfaces

Kernel Processes

Using fork and exec

Using nice

init(1M)

Scheduling and System Performance

Process State Transition

5.  Input/Output Interfaces

Files and I/O Interfaces

Basic File I/O

Advanced File I/O

File System Control

Using File and Record Locking

Choosing a Lock Type

Selecting Advisory or Mandatory Locking

Cautions About Mandatory Locking

Supported File Systems

Opening a File for Locking

Setting a File Lock

Setting and Removing Record Locks

Getting Lock Information

Process Forking and Locks

Deadlock Handling

Terminal I/O Functions

6.  Interprocess Communication

Pipes Between Processes

Named Pipes

Sockets Overview

POSIX Interprocess Communication

POSIX Messages

POSIX Semaphores

POSIX Shared Memory

System V IPC

Permissions for Messages, Semaphores, and Shared Memory

IPC Interfaces, Key Arguments, and Creation Flags

System V Messages

Initializing a Message Queue

Controlling Message Queues

Sending and Receiving Messages

System V Semaphores

Initializing a Semaphore Set

Controlling Semaphores

Semaphore Operations

System V Shared Memory

Accessing a Shared Memory Segment

Controlling a Shared Memory Segment

Attaching and Detaching a Shared Memory Segment

7.  Socket Interfaces

SunOS 4 Binary Compatibility

Overview of Sockets

Socket Libraries

Socket Types

Interface Sets

Socket Basics

Socket Creation

Binding Local Names

Connection Establishment

Connection Errors

Data Transfer

Closing Sockets

Connecting Stream Sockets

Input/Output Multiplexing

Datagram Sockets

Standard Routines

Host and Service Names

Host Names - hostent

Network Names - netent

Protocol Names - protoent

Service Names - servent

Other Routines

Client-Server Programs

Sockets and Servers

Sockets and Clients

Connectionless Servers

Advanced Socket Topics

Out-of-Band Data

Nonblocking Sockets

Asynchronous Socket I/O

Interrupt-Driven Socket I/O

Signals and Process Group ID

Selecting Specific Protocols

Address Binding

Socket Options

inetd Daemon

Broadcasting and Determining Network Configuration

Using Multicast

Sending IPv4 Multicast Datagrams

Receiving IPv4 Multicast Datagrams

Sending IPv6 Multicast Datagrams

Receiving IPv6 Multicast Datagrams

Stream Control Transmission Protocol

SCTP Stack Implementation

SCTP Socket Interfaces

sctp_bindx()

sctp_opt_info()

sctp_recvmsg()

sctp_sendmsg()

sctp_send()

Branched-off Association

sctp_getpaddrs()

sctp_freepaddrs()

sctp_getladdrs()

sctp_freeladdrs()

Code Examples of SCTP Use

8.  Programming With XTI and TLI

What Are XTI and TLI?

XTI/TLI Read/Write Interface

Write Data

Read Data

Close Connection

Advanced XTI/TLI Topics

Asynchronous Execution Mode

Advanced XTI/TLI Programming Example

Asynchronous Networking

Networking Programming Models

Asynchronous Connectionless-Mode Service

Making the Endpoint Asynchronous

Asynchronous Network Transfers

Asynchronous Connection-Mode Service

Asynchronously Establishing a Connection

Asynchronous Use of a Connection

Asynchronous Open

Transferring a File Descriptor

State Transitions

XTI/TLI States

Outgoing Events

Incoming Events

State Tables

Guidelines to Protocol Independence

XTI/TLI Versus Socket Interfaces

Socket-to-XTI/TLI Equivalents

Additions to the XTI Interface

9.  Packet Filtering Hooks

Packet Filtering Architecture

Network Interface Information

Network Addresses

Non-address Information

Network Interface Events

Network Interface Event Concurrency

Packet Injection

Network Protocol Interface

Network Interfaces

Packet Interception

Network Interface Events

Callback Entitlements

Checksums

Code Examples

Packet Filtering Structures

Packet Filtering Events

Network Events

Packet Events

Network Interface Events

Packet Filtering Functions

Defining a Network Protocol Within the netinfo Interface

Declaration of the net_info_t Structure

Selecting an Indexing Scheme

Registering and Deregistering net_info_t

The Access Functions of net_info_t

10.  Transport Selection and Name-to-Address Mapping

Transport Selection

Name-to-Address Mapping

straddr.so Library

Using the Name-to-Address Mapping Routines

11.  Real-time Programming and Administration

Basic Rules of Real-time Applications

Factors that Degrade Response Time

Synchronous I/O Calls

Interrupt Servicing

Shared Libraries

Priority Inversion

Sticky Locks

Runaway Real-time Processes

Asynchronous I/O Behavior

Real-time Files

The Real-Time Scheduler

Dispatch Latency

Scheduling Classes

Dispatch Queue

Dispatching Processes

Process Pre-emption

Kernel Priority Inversion

User Priority Inversion

Interface Calls That Control Scheduling

Using priocntl

Other interface calls

Utilities That Control Scheduling

priocntl(1)

dispadmin(1M)

Configuring Scheduling

Dispatcher Parameter Table

Reconfiguring config_rt_dptbl

Memory Locking

Locking a Page

Unlocking a Page

Locking All Pages

Recovering Sticky Locks

High Performance I/O

POSIX Asynchronous I/O

Solaris Asynchronous I/O

Notification (SIGIO)

Using aioread

Using aiowrite

Using aiocancel

Using aiowait

Using poll()

Using the poll Driver

Using close

Synchronized I/O

Synchronization Modes

Synchronizing a File

Interprocess Communication

Processing Signals

Pipes, Named Pipes, and Message Queues

Using Semaphores

Shared Memory

Asynchronous Network Communication

Modes of Networking

Timing Facilities

Timestamp Interfaces

Interval Timer Interfaces

12.  The Solaris ABI and ABI Tools

What is the Solaris ABI?

Defining the Solaris ABI

Symbol Versioning in Solaris Libraries

Using Symbol Versioning to Label the Solaris ABI

Solaris ABI Tools

appcert Utility

What appcert Checks

Private Symbol Usage

Static Linking

Unbound Symbols

What appcert Does Not Check

Working with appcert

appcert Options

Using appcert for Application Triage

appcert Results

Correcting Problems Reported by appcert

Using apptrace for Application Verification

Application Verification

Running apptrace

Interpreting apptrace Output

A.  UNIX Domain Sockets

Creating Sockets

Local Name Binding

Establishing a Connection

Index

Company Info Contact Terms of Use Privacy Copyright 1994-2008 Sun Microsystems, Inc.