>>-shmget--key--+-----------------+--permissions---------------><
'-size--+-------+-'
'-flags-'
Function
shmget locates
or creates a shared memory segment.
Parameters
- key
- The memory segment key. The value must be 4 bytes.
- size
- The size of the shared memory segment. The default is 0.
- flags
- The type of connection. The default is either 0,
which obtains the existing queue, or a sum of any of the following
flags:
IPC_CREAT |
Creates an entry if the key does not exist. |
IPC_EXCL |
Fails if the key exists. |
IPC_MEGA |
Allocates in megabytes. |
IPC_SHAREAS |
Shares within an address space. |
- permissions
- Permission settings in octal (the default is 600). It is dependent
on the flags being specified.
Example
'shmget WJSM 4096 (ipc_creat)'
Usage notes
Upon return, RETVAL contains -1 if
the service failed. Otherwise, the segment ID is returned.