ipc (5) - Linux Manuals
ipc: System V interprocess communication mechanisms
NAME
svipc - System V interprocess communication mechanisms
SYNOPSIS
#include <sys/msg.h> #include <sys/sem.h> #include <sys/shm.h>
DESCRIPTION
This manual page refers to the Linux implementation of the System V interprocess communication (IPC) mechanisms: message queues, semaphore sets, and shared memory segments. In the following, the word resource means an instantiation of one among such mechanisms.Resource access permissions
For each resource, the system uses a common structure of type struct ipc_perm to store information needed in determining permissions to perform an IPC operation. The ipc_perm structure includes the following members:
struct ipc_perm {
The
mode
member of the
ipc_perm
structure defines, with its lower 9 bits, the access permissions to the
resource for a process executing an IPC system call.
The permissions are interpreted as follows:
Bits 0100, 0010, and 0001 (the execute bits) are unused by the system.
Furthermore,
"write"
effectively means
"alter"
for a semaphore set.
The same system header file also defines the following symbolic
constants:
Note that
IPC_PRIVATE
is a
key_t
type, while all the other symbolic constants are flag fields and can
be OR'ed into an
int
type variable.
struct msqid_ds {
A semaphore is a data structure of type
struct sem
containing the following members:
struct sem {
struct shmid_ds {
0400 Read by user.
0200 Write by user.
0040 Read by group.
0020 Write by group.
0004 Read by others.
0002 Write by others.
Message queues
A message queue is uniquely identified by a positive integer
(its msqid)
and has an associated data structure of type
struct msqid_ds,
defined in
<sys/msg.h>,
containing the following members:
Semaphore sets
A semaphore set is uniquely identified by a positive integer
(its semid)
and has an associated data structure of type
struct semid_ds,
defined in
<sys/sem.h>,
containing the following members:
Shared memory segments
A shared memory segment is uniquely identified by a positive integer
(its shmid)
and has an associated data structure of type
struct shmid_ds,
defined in
<sys/shm.h>,
containing the following members: