📄 shm_unlink.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta name="generator" content="HTML Tidy, see www.w3.org"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 --><!-- Copyright (c) 2001-2003 The Open Group, All Rights Reserved --><title>shm_unlink</title></head><body bgcolor="white"><script type="text/javascript" language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> <a name="shm_unlink"></a> <a name="tag_03_674"></a><!-- shm_unlink --> <!--header start--><center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1, 2003 Edition<br>Copyright © 2001-2003 The IEEE and The Open Group, All Rights reserved.</font></center><!--header end--><hr size="2" noshade><h4><a name="tag_03_674_01"></a>NAME</h4><blockquote>shm_unlink - remove a shared memory object (<b>REALTIME</b>)</blockquote><h4><a name="tag_03_674_02"></a>SYNOPSIS</h4><blockquote class="synopsis"><div class="box"><code><tt><sup>[<a href="javascript:open_code('SHM')">SHM</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> #include <<a href="../basedefs/sys/mman.h.html">sys/mman.h</a>><br><br> int shm_unlink(const char *</tt><i>name</i><tt>); <img src="../images/opt-end.gif" alt="[Option End]" border="0"></tt></code></div><tt><br></tt></blockquote><h4><a name="tag_03_674_03"></a>DESCRIPTION</h4><blockquote><p>The <i>shm_unlink</i>() function shall remove the name of the shared memory object named by the string pointed to by<i>name</i>.</p><p>If one or more references to the shared memory object exist when the object is unlinked, the name shall be removed before<i>shm_unlink</i>() returns, but the removal of the memory object contents shall be postponed until all open and map references tothe shared memory object have been removed.</p><p>Even if the object continues to exist after the last <i>shm_unlink</i>(), reuse of the name shall subsequently cause <a href="../functions/shm_open.html"><i>shm_open</i>()</a> to behave as if no shared memory object of this name exists (that is, <a href="../functions/shm_open.html"><i>shm_open</i>()</a> will fail if O_CREAT is not set, or will create a new shared memory object ifO_CREAT is set).</p></blockquote><h4><a name="tag_03_674_04"></a>RETURN VALUE</h4><blockquote><p>Upon successful completion, a value of zero shall be returned. Otherwise, a value of -1 shall be returned and <i>errno</i> setto indicate the error. If -1 is returned, the named shared memory object shall not be changed by this function call.</p></blockquote><h4><a name="tag_03_674_05"></a>ERRORS</h4><blockquote><p>The <i>shm_unlink</i>() function shall fail if:</p><dl compact><dt>[EACCES]</dt><dd>Permission is denied to unlink the named shared memory object.</dd><dt>[ENAMETOOLONG]</dt><dd>The length of the <i>name</i> argument exceeds {PATH_MAX} or a pathname component is longer than {NAME_MAX}.</dd><dt>[ENOENT]</dt><dd>The named shared memory object does not exist.</dd></dl></blockquote><hr><div class="box"><em>The following sections are informative.</em></div><h4><a name="tag_03_674_06"></a>EXAMPLES</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_674_07"></a>APPLICATION USAGE</h4><blockquote><p>Names of memory objects that were allocated with <a href="../functions/open.html"><i>open</i>()</a> are deleted with <a href="../functions/unlink.html"><i>unlink</i>()</a> in the usual fashion. Names of memory objects that were allocated with <a href="../functions/shm_open.html"><i>shm_open</i>()</a> are deleted with <i>shm_unlink</i>(). Note that the actual memory object is notdestroyed until the last close and unmap on it have occurred if it was already in use.</p></blockquote><h4><a name="tag_03_674_08"></a>RATIONALE</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_674_09"></a>FUTURE DIRECTIONS</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_674_10"></a>SEE ALSO</h4><blockquote><p><a href="close.html"><i>close</i>()</a> , <a href="mmap.html"><i>mmap</i>()</a> , <a href="munmap.html"><i>munmap</i>()</a> , <ahref="shmat.html"><i>shmat</i>()</a> , <a href="shmctl.html"><i>shmctl</i>()</a> , <a href="shmdt.html"><i>shmdt</i>()</a> , <ahref="shm_open.html"><i>shm_open</i>()</a> , the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/sys/mman.h.html"><i><sys/mman.h></i></a></p></blockquote><h4><a name="tag_03_674_11"></a>CHANGE HISTORY</h4><blockquote><p>First released in Issue 5. Included for alignment with the POSIX Realtime Extension.</p></blockquote><h4><a name="tag_03_674_12"></a>Issue 6</h4><blockquote><p>The <i>shm_unlink</i>() function is marked as part of the Shared Memory Objects option.</p><p>In the DESCRIPTION, text is added to clarify that reusing the same name after a <i>shm_unlink</i>() will not attach to the oldshared memory object.</p><p>The [ENOSYS] error condition has been removed as stubs need not be provided if an implementation does not support the SharedMemory Objects option.</p></blockquote><div class="box"><em>End of informative text.</em></div><hr><hr size="2" noshade><center><font size="2"><!--footer start-->UNIX ® is a registered Trademark of The Open Group.<br>POSIX ® is a registered Trademark of The IEEE.<br>[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>]</font></center><!--footer end--><hr size="2" noshade></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -