shmdt() - detach shared memory segment
#include <sys/shm.h>
int shmdt(const void *shmaddr)
The shmdt(2) function detaches the shared memory segment at shmaddr from the address space of the calling process.
The function parameters are:
To delete a shared memory segment, use shmctl(2).
The header file <sys/shm.h> includes <sys/ipc.h>.
On success, the shmdt(2) function returns 0 and decrements the value of shm_nattach in the data structure associated with the shared memory segment.
On failure, the function return s-1 and sets errno
The shmdt(2) function can fail for the following reasons:
shmat(2)
shmctl(2)
shmget(2)