.TH shmdt() "" "" "General Function (libc)"
.PC "Detach a shared-memory segment from a process"
.B "#include <sys/types.h>"
.B "#include <sys/ipc.h>"
.B "#include <sys/shm.h>"
\fBchar *shmdt (\fIshmaddr\^\fB)\fR
\fBchar *\fIshmaddr\^\fB;\fR
.PP
.B shmdt()
detaches the shared-memory segment at address
.I shmaddr
from the calling process.
If all went well,
.B shmdt()
returns returns zero;
otherwise, it returns \-1 and sets
.B errno
to an appropriate value.
In particular, it sets
.B errno
to
.B EINVAL
if
.I shmaddr
does not point to the beginning of a shared-memory segment.
.SH Example
For an example of this function, see the Lexicon entry for
.BR shmget() .
.SH "See Also"
.Xr "libc," libc
.Xr "shmctl()," shmctl
.Xr "shmdt()," shmdt
.Xr "shmget()" shmget
.SH Notes
The \*(CO implementation of shared memory does not yet support
attaching a shared-memory segment to a user-defined address.
Therefore, you should always set
.I shmaddr
to zero.
