void *shmat(int shmid, const void *shmaddr, int shmflg);
- If shmaddr is a NULL pointer, the segment is attached at the first available address as selected by the system.
- If shmaddr is not a NULL pointer and (shmflg & SHM_RND) is non-zero, the segment is attached at the address given by (shmaddr - (shmaddr % SHMLBA)).
- If shmaddr is not a NULL pointer and (shmflg & SHM_RND) is 0, the segment is attached at the address given by shmaddr.
The segment is attached for reading if (shmflg & SHM_RDONLY) is non-zero and the calling process has read permission, otherwise if (shmflg & SHM_RDONLY) is zero and the calling process has read and write permission, the segment is attached for reading and writing.
Upon successful completion,
You must explicitly remove shared memory segments after the last reference to them has been removed.
Is a unique positive integer created by a
shmget()system call and associated with a segment of shared memory.
Points to the desired address of the shared memory segment.
Specifies a set of flags that indicate the specific shared memory conditions and options to implement.
Operation permission is denied to the calling process.
shmaddr is not equal to zero, and the value of (shmaddr - (shmaddr % SHMLBA)) is an illegal address.
shmaddr is not equal to zero, (shmflg & SHM_RND) is 0, and the value of shmaddr is an illegal address.
shmid is not a valid shared memory identifier.
The number of shared memory segments attached to the calling process exceeds the system-imposed limit.
The available data space is not large enough to accommodate the shared memory segment.
UNIX 98, with exceptions.
Windows requires that attached shared memory regions be aligned on 64K
boundaries. If you attempt to use
On Windows 9x,
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
execl(), execle(), execlp(), execlpe(), execv(), execve(), execvp(), execvpe(), exit(), fork(), shmctl(), shmdt(), shmget()
PTC MKS Toolkit 10.1 Documentation Build 15.