shmdt(2)
_________________________________________________________________
shmdt System Call
Detach a shared memory segment.
_________________________________________________________________
SYNTAX
#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
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
shmdt(2)
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.
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, exit, fork, intro, shmctl,
shmget.
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)