Your Browser is not longer supported
Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...
{{viewport.spaceProperty.prod}}
shmdt - shared memory detach operation
&pagelevel(4)&pagelevel
Syntax | #include <sys/shm.h> int shmdt(const void *shmaddr); |
Description | shmdt() detaches the shared memory segment located at the address specified with shmaddr from the data segment of the calling process.
Restriction In this version of the POSIX subsystem, a shared memory area can only exist if it is attached to a process. The behavior of shmdt() therefore deviates from XPG4 in the following respect: when the last process has detached itself from a shared memory area, the memory area is released. The administration data for the memory area is, however, retained by the POSIX kernel. If another process subsequently attaches itself to the same shared memory area, the earlier contents are lost. (End) |
Return val. | 0 | if successful. shmdt() decrements the value of shm_nattach in the data structure associated with the shared memory ID. |
-1 | if an error occurs. The shared memory segment is not detached. errno is set to indicate the error. |
Errors | shmdt() will fail if:
|
| EINVAL
| The value of shmaddr is not the data segment starting address of a shared memory segment. |
See also | exec , exit() , fork() , shmat() , shmctl() , shmget() , sys/shm.h , section “Interprocess communication”.
|