Standards / Extensions | C or C++ | Dependencies |
---|---|---|
XPG4 |
both |
#define _XOPEN_SOURCE
#include <sys/shm.h>
int shmdt(const void *shmaddr);
The shmdt() function detaches from the calling process's address space the shared memory segment located at the address specified by the argument shmaddr.
Storage in the user address space for a segment with the __IPC_SHAREAS attribute is not cleaned up unless the segment is no longer attached to by other processes in the address space.
If successful, shmdt() decrements the value of shm_nattach in the data structure associated with the shared memory ID of the attached shared memory segment and returns 0.