246 lines
6.4 KiB
HTML
246 lines
6.4 KiB
HTML
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||
|
<html>
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||
|
<meta name="Copyright" content="Copyright (c) 2006 by IBM Corporation">
|
||
|
<title>shmdt()-Detach Shared Memory Segment from Calling Process</title>
|
||
|
<!-- Begin Header Records ========================================== -->
|
||
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
||
|
<!-- US Government Users Restricted Rights -->
|
||
|
<!-- Use, duplication or disclosure restricted by -->
|
||
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
||
|
<!-- Change History: -->
|
||
|
<!-- YYMMDD USERID Change description -->
|
||
|
<!-- Direct1 SCRIPT J converted by B2H R4.1 (346) (CMS) by V2KEA304 -->
|
||
|
<!-- at RCHVMW2 on 17 Feb 1999 at 11:05:09 -->
|
||
|
<!-- Edited by Kersten Feb 02 -->
|
||
|
<!-- This file has undergone html cleanup on 05/01/02 by JET -->
|
||
|
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
|
||
|
</head>
|
||
|
<body>
|
||
|
<!--End Header Records -->
|
||
|
<!-- Java sync-link -->
|
||
|
<script type="text/javascript" language="Javascript" src="../rzahg/synch.js">
|
||
|
</script>
|
||
|
|
||
|
<a name="Top_Of_Page"></a>
|
||
|
|
||
|
<h2>shmdt()--Detach Shared Memory Segment from Calling Process</h2>
|
||
|
|
||
|
<div class="box" style="width: 60%;">
|
||
|
<br>
|
||
|
Syntax<br>
|
||
|
<pre>
|
||
|
#include <sys/shm.h>
|
||
|
|
||
|
int shmdt(const void *shmaddr);
|
||
|
</pre>
|
||
|
|
||
|
<br>
|
||
|
Service Program Name: QP0ZUSHR<br>
|
||
|
<!-- iddvc RMBR -->
|
||
|
<br>
|
||
|
Default Public Authority: *USE<br>
|
||
|
<!-- iddvc RMBR -->
|
||
|
<br>
|
||
|
Threadsafe: Yes<br>
|
||
|
<!-- iddvc RMBR -->
|
||
|
<br>
|
||
|
</div>
|
||
|
|
||
|
<p>The <strong>shmdt()</strong> function detaches the shared memory segment
|
||
|
specified by <em>shmaddr</em> from the calling job. The <em>shmaddr</em>
|
||
|
is the value returned by the <a href="ipcshmat.htm">shmat</a> function.<br>
|
||
|
</p>
|
||
|
|
||
|
<p>The system maintains status information about a shared memory segment which can
|
||
|
be retrieved with the <a href="ipcshmct.htm">shmctl()</a> function. When a shared
|
||
|
memory segment is successfully detached, the system sets the members of the
|
||
|
<samp>shmid_ds</samp> structure as follows:<p>
|
||
|
|
||
|
<ul>
|
||
|
<li><samp>shm_nattch</samp> is decremented by 1.<p></li>
|
||
|
|
||
|
<li><samp>shm_lpid</samp> is set to the process ID of the calling thread.<p></li>
|
||
|
|
||
|
<li><samp>shm_dtime</samp> is set to the current time.</li>
|
||
|
</ul>
|
||
|
|
||
|
<br>
|
||
|
<h3>Parameters</h3>
|
||
|
|
||
|
<dl>
|
||
|
<dt><strong>shmaddr</strong></dt>
|
||
|
|
||
|
<dd>(Input) Address of the shared memory segment to be detached.</dd>
|
||
|
</dl>
|
||
|
|
||
|
<br>
|
||
|
<h3>Authorities</h3>
|
||
|
|
||
|
<p><strong><a name="TBLAHDT1">Authorization Required for
|
||
|
shmdt()</a></strong></p>
|
||
|
|
||
|
<table border cellpadding="5">
|
||
|
<!-- cols="60 20 20" -->
|
||
|
<tr>
|
||
|
<th align="left" valign="bottom">Object Referred to</th>
|
||
|
<th align="left" valign="bottom">Authority Required</th>
|
||
|
<th align="left" valign="bottom">errno</th>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td align="left" valign="top">Shared memory segment to be detached</td>
|
||
|
<td align="left" valign="top">None</td>
|
||
|
<td align="left" valign="top">None</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
|
||
|
<br>
|
||
|
<br>
|
||
|
<h3>Return Value</h3>
|
||
|
|
||
|
<table cellpadding="5">
|
||
|
<!-- cols="5 95" -->
|
||
|
<tr>
|
||
|
<td align="left" valign="top"><em>0</em></td>
|
||
|
<td align="left" valign="top"><strong>shmdt()</strong> was successful.</td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td align="left" valign="top" nowrap><em>-1</em></td>
|
||
|
<td align="left" valign="top"><strong>shmdt()</strong> was not successful. The
|
||
|
<em>errno</em> variable is set to indicate the error.</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
|
||
|
<br>
|
||
|
<br>
|
||
|
<h3>Error Conditions</h3>
|
||
|
|
||
|
<p>If <strong>shmdt()</strong> is not successful, <em>errno</em> usually
|
||
|
indicates one of the following errors. Under some conditions, <em>errno</em>
|
||
|
could indicate an error other than those listed here.</p>
|
||
|
|
||
|
<dl>
|
||
|
<dt><em>[EDAMAGE]</em></dt>
|
||
|
|
||
|
<dd>
|
||
|
<p>A damaged object was encountered.</p>
|
||
|
|
||
|
<p>The shared memory segment has been damaged by a previous shared memory
|
||
|
operation.</p>
|
||
|
</dd>
|
||
|
|
||
|
<dt><em>[EFAULT]</em></dt>
|
||
|
|
||
|
<dd>
|
||
|
<p>The address used for an argument is not correct.</p>
|
||
|
|
||
|
<p>In attempting to use an argument in a call, the system detected an address
|
||
|
that is not valid.</p>
|
||
|
|
||
|
<p>While attempting to access a parameter passed to this function, the system
|
||
|
detected an address that is not valid.</p>
|
||
|
</dd>
|
||
|
|
||
|
<dt><em>[EINVAL]</em></dt>
|
||
|
|
||
|
<dd>
|
||
|
<p>The value specified for the argument is not correct.</p>
|
||
|
|
||
|
<p>A function was passed incorrect argument values, or an operation was
|
||
|
attempted on an object and the operation specified is not supported for that
|
||
|
type of object.</p>
|
||
|
|
||
|
<p>An argument value is not valid, out of range, or NULL.</p>
|
||
|
|
||
|
<p>The value of <em>shmaddr</em> is not the start address of a
|
||
|
shared memory segment.</p>
|
||
|
</dd>
|
||
|
|
||
|
<dt><em>[ENOSYS]</em></dt>
|
||
|
|
||
|
<dd>
|
||
|
<p>Function not implemented.</p>
|
||
|
|
||
|
<p>An attempt was made to use a function that is not available in this
|
||
|
implementation for any object or any arguments.</p>
|
||
|
|
||
|
<p>The function is not implemented.</p>
|
||
|
</dd>
|
||
|
|
||
|
<dt><em>[EUNKNOWN]</em></dt>
|
||
|
|
||
|
<dd>
|
||
|
<p>Unknown system state.</p>
|
||
|
|
||
|
<p>The operation failed because of an unknown system state. See any messages in
|
||
|
the job log and correct any errors that are indicated, then retry the
|
||
|
operation.</p>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
|
||
|
<br>
|
||
|
<h3>Error Messages</h3>
|
||
|
|
||
|
<p>None.</p>
|
||
|
|
||
|
<br>
|
||
|
<h3><a name="USAGE_NOTES">Usage Notes</a></h3>
|
||
|
|
||
|
<ol>
|
||
|
<li>This function does not delete the shared memory segment. To delete a shared
|
||
|
memory segment, use the <strong>shmctl()</strong> function with the <em>cmd</em>
|
||
|
parameter set to IPC_RMID.</li>
|
||
|
</ol>
|
||
|
|
||
|
<br>
|
||
|
<h3>Related Information</h3>
|
||
|
|
||
|
<ul>
|
||
|
<li>The <<strong>sys/shm.h</strong>> file (see <a href="unix13.htm">
|
||
|
Header Files for UNIX-Type Functions</a>)<br>
|
||
|
<br>
|
||
|
</li>
|
||
|
|
||
|
<li><a href="ipcshmat.htm">shmat()</a>--Attach Shared Memory Segment to Current
|
||
|
Process<br>
|
||
|
<br>
|
||
|
</li>
|
||
|
|
||
|
<li><a href="ipcshmct.htm">shmctl()</a>--Perform Shared Memory Control
|
||
|
Operations<br>
|
||
|
<br>
|
||
|
</li>
|
||
|
|
||
|
<li><a href="ipcshmgt.htm">shmget()</a>--Get ID of Shared Memory Segment with
|
||
|
Key</li>
|
||
|
</ul>
|
||
|
|
||
|
<br>
|
||
|
<h3>Example</h3>
|
||
|
|
||
|
<p>See <a href="../apiref/aboutapis.htm#codedisclaimer">Code disclaimer information</a>
|
||
|
for information pertaining to code examples.</p>
|
||
|
|
||
|
<p>For an example of using this function, see <a href="../apiref/apiexusmem.htm">
|
||
|
Using Semaphores and Shared Memory</a> in Examples: APIs.</p>
|
||
|
|
||
|
<br>
|
||
|
<hr>
|
||
|
API introduced: V3R6
|
||
|
|
||
|
<hr>
|
||
|
<center>
|
||
|
<table cellpadding="2" cellspacing="2">
|
||
|
<tr align="center">
|
||
|
<td valign="middle" align="center"><a href="#Top_Of_Page">Top</a> | <a href=
|
||
|
"unix.htm">UNIX-Type APIs</a> | <a href="aplist.htm">APIs by category</a></td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</center>
|
||
|
</body>
|
||
|
</html>
|
||
|
|