Detaches a shared memory segment.
Standard C Library (libc.a)
#include <sys/shm.h>
int shmdt (SharedMemoryAddress)
const void * SharedMemoryAddress;
The shmdt subroutine detaches from the data segment of the calling process the shared memory segment located at the address specified by the SharedMemoryAddress parameter.
Mapped file segments are automatically detached when the mapped file is closed. However, you can use the shmdt subroutine to explicitly release the segment register used to map a file. Shared memory segments must be explicitly detached with the shmdt subroutine.
If the file was mapped for writing, the shmdt subroutine updates the mtime and ctime time stamps.
The following limits apply to shared memory:
SharedMemoryAddress | Specifies the data segment start address of a shared memory segment. |
When successful, the shmdt subroutine returns a value of 0. Otherwise, the shared memory segment at the address specified by the SharedMemoryAddress parameter is not detached, a value of 1 is returned, and the errno global variable is set to indicate the error.
The shmdt subroutine is unsuccessful if the following condition is true:
EINVAL | The value of the SharedMemoryAddress parameter is not the data-segment start address of a shared memory segment. |
The exec subroutine, exit subroutine, fork subroutine, fsync subroutine, mmap subroutine, munmap subroutine, shmat subroutine, shmctl subroutine, shmget subroutine.
The ipcs command and ipcrm command.
List of Memory Manipulation Services, Subroutines Overview, Understanding Memory Mapping in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.