shmdt(2) DG/UX 5.4R3.00 shmdt(2)
NAME
shmdt - detach a shared memory segment
SYNOPSIS
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
int shmdt (shmaddr)
void * shmaddr;
where:
shmaddr The byte address of the attached shared memory segment to
be detached. This must equal the value returned by shmat
when the shared segment was attached.
DESCRIPTION
Shmdt detaches the shared memory segment located at the address
specified by shmaddr from the calling process's data segment.
Upon successful completion, this call changes the following fields in
the shared memory data structure associated with the shared segment:
shm_lpid Changed to equal the process id of the calling
process.
shm_dtime Changed to equal the current time.
shm_nattach Decremented by 1.
Detaching a shared memory segment makes it no longer available to the
calling process. Other users who still have the shared memory
segment attached are not affected. However, the calling process may
not be able to re-attach to the segment. This will be the case if a
remove operation has been performed on the shared memory segment (see
the IPC_RMID operation of shmctl).
Calls to either exec or exit cause implicit detach operations on all
shared segments that a process has attached. These implicit detach
operations change only the shm_nattach field of the shared memory
data structure as described above for explicit detach calls. The
shm_lpid and shm_dtime fields remain unchanged by these implicit
detach operations.
Shmdt will fail and not detach the shared memory segment if an error
occurs.
ACCESS CONTROL
No access permission is required to detach a shared memory segment.
RETURN VALUE
0 The detach operation was successful.
-1 An error occurred. errno is set to indicate the error.
Licensed material--property of copyright holder(s) 1
shmdt(2) DG/UX 5.4R3.00 shmdt(2)
DIAGNOSTICS
Errno may be set to the following error code:
EINVAL Shmaddr is not the starting address of any shared memory
segment currently attached to the calling process.
SEE ALSO
intro(2), exec(2), exit(2), _exit(2), fork(2), ipcrm(1), ipcs(1),
shmctl(2), shmget(2).
Licensed material--property of copyright holder(s) 2