| SHMGET(2) | 21 January 1990 | SHMGET(2) |
| NAME |
| shmget - get shared memory segment identifier |
| SYNOPSIS |
|
|
| DESCRIPTION |
|
shmget() returns the shared memory identifier associated with key. A shared memory identifier and associated data structure and shared memory segment of at least size bytes (see intro(2)) are created for key if one of the following are true:
Upon creation, the data structure associated with the new shared memory identifier is initialized as follows:
A shared memory identifier (shmid) is a unique positive integer created by a shmget(2) system call. Each shmid has a segment of memory (referred to as a shared memory segment) and a data structure associated with it. The data structure is referred to as shmid_ds and contains the following members:
shm_perm is an ipc_perm structure that specifies the shared memory operation permission (see below). This structure includes the following members:
shm_segsz specifies the size of the shared memory segment. shm_cpid is the process ID of the process that created the shared memory identifier. shm_lpid is the process ID of the last process that performed a shmop(2) operation. shm_nattch is the number of processes that currently have this segment attached. shm_atime is the time of the last shmat operation, shm_dtime is the time of the last shmdt operation, and shm_ctime is the time of the last shmctl(2) operation that changed one of the members of the above structure. |
| RETURN |
| shmget() returns a non-negative shared memory identifier on success. On failure, it returns -1 and sets errno to indicate the error. |
| ERRORS |
|
| SEE |
| SHMGET(2) | 21 January 1990 | SHMGET(2) |