shm.h
Overview
Related Modules:
Description:
Declares APIs for creating, mapping, deleting, and controlling shared memory.
Since:
1.0
Version:
1.0
Summary
Data Structures
Describes limitations and attributes of system-level shared memory. |
|
Describes system resource information about the shared memory. |
Macros
SHMLBA 4096 |
|
SHM_R 0400 |
Indicates that the shared memory segment is readable. This macro is used for setting the shmflg parameter passed to functions such as shmget(). |
SHM_W 0200 |
Indicates that the shared memory segment is writable. This macro is used for setting the shmflg parameter passed to functions such as shmget(). |
SHM_RDONLY 010000 |
Indicates that the attached shared memory segment is read-only. This macro is used for setting the shmflg parameter passed to functions such as shmat(). |
SHM_RND 020000 |
Indicates that the shared memory address can be rounded to a value meeting the requirement (SHMLBA). This macro is used for setting the shmflg parameter passed to functions such as shmat(). |
SHM_REMAP 040000 |
Indicates that the memory segment can be remapped. This macro is used for setting the shmflg parameter passed to functions such as shmat(). |
SHM_EXEC 0100000 |
Indicates that the attached shared memory segment is executable. This macro is used for setting the shmflg parameter passed to functions such as shmat(). |
SHM_LOCK 11 |
Locks the shared memory segment in memory so that it cannot be swapped to the swap partition. This macro is used for setting the shmflg parameter passed to functions such as shmget(). |
SHM_UNLOCK 12 |
Unlocks the shared memory segment. This macro is used for setting the shmflg parameter passed to functions such as shmget(). |
Obtains a shmid_ds data structure. This macro is used for setting the cmd parameter passed to shmctl(). |
|
SHM_INFO 14 |
Obtains a shm_info data structure that includes system resource information about this shared memory segment. This macro is used for setting the cmd parameter passed to shmctl(). |
SHM_STAT_ANY (15 | (IPC_STAT & 0x100)) |
Obtains a shmid_ds data structure without permission check. This macro is used for setting the cmd parameter passed to shmctl(). |
Functions
shmat (int shmid, const void shmaddr, int shmflg) |
Attaches the shared memory segment identified by shmid to the address space of the current process. |
Performs a control operation specified by the cmd parameter on the shared memory segment identified by shmid. |
|
shmdt (const void shmaddr) |
Detaches the shared memory segment attached to the address pointed to by shmaddr from the address space of the calling process. |
shmget (key_t key, size_t size, int shmflg) |
Obtains or creates a shared memory segment with the specified size based on the ID specified by key. |