SHM(2) 386BSD Programmer's Manual SHM(2)
NAME
shmat, shmctl, shmdt, shmget - shared memory operations
SYNOPSIS
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
void *
shmat(int shmid, void *shmaddr, int shmflg)
int
shmctl(int shmid, int cmd, void *buf)
int
shmdt(void *shmaddr)
int
shmget(key_t key, int size, int shmflg)
DESCRIPTION
System V defines a set of operations for shared memory that is a
manditory part of the iBCS2 standard for Intel X86 processors. The
segments are either part of a global table accessible via appropriate
permissions by all processes, or private(IPC_PRIVATE) segments known only
to the process group. The segments are identified by a shared memory
identifier shmid, a unique integer value returned on creation. This
interface is made up of the following four functions:
The shmget() function creates a shared memory segment, entering it into
the systems global pool of shared memory segments. If successful, a
shared memory identifier is returned.
The shmctl() function provides control and status operations for existing
shared memory segments, as specified by cmd. Among them, the segments can
be removed(IPC_RMID), protection and permissions (re)assigned(IPC_SET),
and the details of the segment can be extracted from the
system(IPC_STAT).
The shmat() function attaches a shared memory segment to an address in
the user's address space (specified by shmaddr ) to allow the segment to
be accessed by the program as ordinary memory.
The shmdt() function detaches a shared memory segment at the address in
the user's address space (specified by shmaddr ).
386BSD February 14, 1994 1