JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Programming Interfaces Guide
search filter icon
search icon

Document Information

Preface

1.  Memory and CPU Management

2.  Remote Shared Memory API for Solaris Clusters

3.  Session Description Protocol API

4.  Process Scheduler

5.  Locality Group APIs

6.  Input/Output Interfaces

7.  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

8.  Socket Interfaces

9.  Programming With XTI and TLI

10.  Packet Filtering Hooks

11.  Transport Selection and Name-to-Address Mapping

12.  Real-time Programming and Administration

13.  The Solaris ABI and ABI Tools

A.  UNIX Domain Sockets

Index

POSIX Interprocess Communication

POSIX interprocess communication (IPC) is a variation of System V interprocess communication. It was introduced in the Solaris 7 release. Like System V objects, POSIX IPC objects have read and write, but not execute, permissions for the owner, the owner's group, and for others. There is no way for the owner of a POSIX IPC object to assign a different owner. POSIX IPC includes the following features:

Unlike the System V IPC interfaces, the POSIX IPC interfaces are all multithread safe.

POSIX Messages

The POSIX message queue interfaces are listed in the following table.

Table 7-2 POSIX Message Queue Interfaces

Interface Name
Purpose
Connects to, and optionally creates, a named message queue
Ends the connection to an open message queue
Ends the connection to an open message queue and causes the queue to be removed when the last process closes it
Places a message in the queue
Receives (removes) the oldest, highest priority message from the queue
Notifies a process or thread that a message is available in the queue
Set or get message queue attributes

POSIX Semaphores

POSIX semaphores are much lighter weight than are System V semaphores. A POSIX semaphore structure defines a single semaphore, not an array of up to 25 semaphores.

The POSIX semaphore interfaces are shown below.

sem_open(3RT)

Connects to, and optionally creates, a named semaphore

sem_init(3RT)

Initializes a semaphore structure (internal to the calling program, so not a named semaphore)

sem_close(3RT)

Ends the connection to an open semaphore

sem_unlink(3RT)

Ends the connection to an open semaphore and causes the semaphore to be removed when the last process closes it

sem_destroy(3RT)

Initializes a semaphore structure (internal to the calling program, so not a named semaphore)

sem_getvalue(3RT)

Copies the value of the semaphore into the specified integer

sem_wait(3RT), sem_trywait(3RT)

Blocks while the semaphore is held by other processes or returns an error if the semaphore is held by another process

sem_post(3RT)

Increments the count of the semaphore

POSIX Shared Memory

POSIX shared memory is actually a variation of mapped memory (see Creating and Using Mappings). The major differences are:

The options in shm_open(3RT) are substantially fewer than the number of options provided in open(2).