Describes the structures that are used by the subroutines that perform shared memory operations.
The shm.h header file defines the following symbolic constants, types, and structures:
typedef unsigned short shmatt_t;
SHMLBA segment low boundary address multiple SHMLBA_EXTSHM SHMLBA value when enviornment 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.
The structure shmid_ds contains the following members:
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
The structure shminfo contains the following members:
int shmmax max shared memory segment size int shmmin min shared memory segment size int shmmni # of shared memory identifiers
The types pid_t, time_t, key_t, and size_t are defined as described in <sys/types.h>. The following are declared as functions:
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.
This file is part of Base Operating System (BOS) Runtime.
The types.h file.
The shmat, shmctl, shmdt, and shmget subroutines.