Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)

shmget(2) OSS System Calls Reference Manual
DESCRIPTION
The shmget() function returns the shared memory identifier for the shared memory segment
identified by the key parameter. If the key parameter already has a shared memory identifier
associated with it and (shmflag & IPC_CREAT) is 0 (zero), that identifier is returned.
A new shared memory identifier, the associated shared memory table entry, and a new shared
memory segment of at least size bytes are created when either of the following is true:
The value IPC_PRIVATE is used for the key parameter.
The key parameter does not already have a shared memory identifier associated with it,
and (shmflag & IPC_CREAT) is not 0 (zero).
After creating a new shared memory identifier, the shmget() function initializes the shared
memory table entry associated with the identifier as follows:
The creator’s user ID field (shm_perm.cuid) and owner’s user ID field (shm_perm.uid)
are set equal to the effective user ID of the calling process.
The creator’s group ID field (shm_perm.cgid) and owner’s group ID field
(shm_perm.gid) are set equal to the effective group ID of the calling process.
The least-significant nine bits of the access mode field (shm_perm.mode) are set equal
to the least-significant nine bits of the shmflag parameter.
The shared memory segment size eld (shm_segsz) is set to the value of the size parame-
ter.
The following fields are all set to 0 (zero):
shm_lpid, the process ID or PIN of the latest process that performed a shmat(),
shmdt(),orshmctl() operation
shm_nattch, the number of processes that currently have this region attached
shm_atime, the time of the last shmat() operation
shm_dtime, the time of the last shmdt() operation
The shm_ctime field is set equal to the current time. This field is updated when any of
the following events occur:
The shared memory identifier is created.
The permissions for the shared memory segment are changed.
The shared memory identifier is removed.
The process ID of the process that created the shared memory identifier (the shm_cpid
field) is set to the process ID or PIN of the calling OSS or Guardian process.
The shared memory identifier is used for the following purposes:
It identifies a specific entry in the system-maintained shared memory table.
It allows detection of references to a previously removed shared memory identifier.
786
Hewlett-Packard Company 527186-023