shm.h ファイル

目的

共用メモリー操作を実行するサブルーチンによって使用される構造体について説明します。

構文

#include <sys/shm.h>

説明

shm.h ヘッダー・ファイルは、以下のシンボリック定数、タイプ、および構造体を定義します。

タイプ:

typedef unsigned short   shmatt_t;

シンボリック定数:

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

システム内の共用メモリーおよびマップされたファイル・セグメントごとに、共用メモリー ID データ構造があります。

ストラクチャー

構造体 shmid_ds には、以下のメンバーが含まれています。
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
構造体 shminfo には、以下のメンバーが含まれています。
unsigned int        shmmax           max shared memory segment size
int                 shmmin           min shared memory segment size
int                 shmmni           # of shared memory identifiers
タイプ pid_ttime_tkey_t、および size_t は、 <sys/types.h>で説明されているように定義されます。 以下は関数として宣言されます。
void  *shmat(int, const void *, int);
int    shmctl(int, int, struct shmid_ds *);
int    shmdt(const void *);
int    shmget(key_t, size_t, int);

さらに、このヘッダーが組み込まれると、 <sys/ipc.h> からのすべてのシンボルが定義されます。