shmdt(2) DG/UX 4.30 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)
char * shmaddr;
PARAMETERS
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 shm_ctl).
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.
Licensed material--property of copyright holder(s) Page 1
shmdt(2) DG/UX 4.30 shmdt(2)
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.
EXCEPTIONS
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
The related system calls: exec(2), exit(2), fork(2),
ipcrm(1), ipcs(1), intro(2), shmctl(2), shmget(2).
Licensed material--property of copyright holder(s) Page 2