Archivo shm.h

Finalidad

Describe las estructuras que utilizan las subrutinas que realizan operaciones de memoria compartida.

Sintaxis

#include < sys/shm.h >

Descripción

El archivo de cabecera shm.h define las siguientes constantes simbólicas, tipos y estructuras:

Tipos:

typedef unsigned short   shmatt_t;

Constantes simbólicas:

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

Hay una estructura de datos de ID de memoria compartida para cada memoria compartida y segmento de archivo correlacionado en el sistema.

Estructuras

La estructura shmid_ds contiene los miembros siguientes:
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
La estructura shminfo contiene los miembros siguientes:
unsigned int        shmmax           max shared memory segment size
int                 shmmin           min shared memory segment size
int                 shmmni           # of shared memory identifiers
Los tipos pid_t, time_t, key_ty size_t se definen tal como se describe en <sys/types.h>. Se declaran como funciones las siguientes:
void  *shmat(int, const void *, int);
int    shmctl(int, int, struct shmid_ds *);
int    shmdt(const void *);
int    shmget(key_t, size_t, int);

Además, todos los símbolos de <sys/ipc.h> se definirán cuando se incluya esta cabecera.