Describes the structures that are used by the subroutines that perform shared memory operations.
#include <sys/shm.h>
The shm.h header file defines the following symbolic constants, types, and structures:
Types:
typedef unsigned short shmatt_t;
Symbolic Constants:
SHMLBA segment low boundary address multiple
SHMLBA_EXTSHM SHMLBA value when environment variable EXTSHM=ON
SHM_RDONLY attach read-only (else read-write)
SHM_RND round attach address to SHMLBA
SHM_MAP map a file instead of share a segment
SHM_FMAP fast file map
SHM_COPY deferred update
SHM_R read permission
SHM_W write permission
SHM_DEST destroy segment when # attached = 0
ZERO_MEM for disclaim
SHMHISEG highest shared memory segment allowed
SHMLOSEG lowest shared memory segment allowed
NSHMSEGS number of shared memory segments allowed
There is a shared mem id data structure for each shared memory and mapped file segment in the system.
Structures
struct ipc_perm shm_perm operation permission struct
size_t shm_segsz size of segment in bytes
pid_t shm_lpid process ID of last shared memory operation
pid_t shm_cpid pid of creator
shmatt_t shm_nattch number of current attaches
time_t shm_atime last shmat time
time_t shm_dtime time of last shmdt
time_t shm_ctime time of last change by shmctl
unsigned int shmmax max shared memory segment size
int shmmin min shared memory segment size
int shmmni # of shared memory identifiers
void *shmat(int, const void *, int);
int shmctl(int, int, struct shmid_ds *);
int shmdt(const void *);
int shmget(key_t, size_t, int);
In addition, all of the symbols from <sys/ipc.h> will be defined when this header is included.