⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shmctl.html

📁 IEEE 1003.1-2003, Single Unix Specification v3
💻 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>shmctl</title></head><body bgcolor="white"><script type="text/javascript" language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> <a name="shmctl"></a> <a name="tag_03_676"></a><!-- shmctl --> <!--header start--><center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1, 2003 Edition<br>Copyright &copy; 2001-2003 The IEEE and The Open Group, All Rights reserved.</font></center><!--header end--><hr size="2" noshade><h4><a name="tag_03_676_01"></a>NAME</h4><blockquote>shmctl - XSI shared memory control operations</blockquote><h4><a name="tag_03_676_02"></a>SYNOPSIS</h4><blockquote class="synopsis"><div class="box"><code><tt><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> #include &lt;<a href="../basedefs/sys/shm.h.html">sys/shm.h</a>&gt;<br><br> int shmctl(int</tt> <i>shmid</i><tt>, int</tt> <i>cmd</i><tt>, struct shmid_ds *</tt><i>buf</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_676_03"></a>DESCRIPTION</h4><blockquote><p>The <i>shmctl</i>() function operates on XSI shared memory (see the Base Definitions volume of IEEE&nbsp;Std&nbsp;1003.1-2001,<a href="../basedefs/xbd_chap03.html#tag_03_340">Section 3.340, Shared Memory Object</a>). It is unspecified whether this functioninteroperates with the realtime interprocess communication facilities defined in <a href="xsh_chap02_08.html#tag_02_08"><i>Realtime</i></a> .</p><p>The <i>shmctl</i>() function provides a variety of shared memory control operations as specified by <i>cmd</i>. The followingvalues for <i>cmd</i> are available:</p><dl compact><dt>IPC_STAT</dt><dd>Place the current value of each member of the <b>shmid_ds</b> data structure associated with <i>shmid</i> into the structurepointed to by <i>buf</i>. The contents of the structure are defined in <a href="../basedefs/sys/shm.h.html"><i>&lt;sys/shm.h&gt;</i></a>.</dd><dt>IPC_SET</dt><dd>Set the value of the following members of the <b>shmid_ds</b> data structure associated with <i>shmid</i> to the correspondingvalue found in the structure pointed to by <i>buf</i>: <pre><tt>shm_perm.uidshm_perm.gidshm_perm.mode   </tt> Low-order nine bits.</pre><p>IPC_SET can only be executed by a process that has an effective user ID equal to either that of a process with appropriateprivileges or to the value of <i>shm_perm.cuid</i> or <i>shm_perm.uid</i> in the <b>shmid_ds</b> data structure associated with<i>shmid</i>.</p></dd><dt>IPC_RMID</dt><dd>Remove the shared memory identifier specified by <i>shmid</i> from the system and destroy the shared memory segment and<b>shmid_ds</b> data structure associated with it. IPC_RMID can only be executed by a process that has an effective user ID equalto either that of a process with appropriate privileges or to the value of <i>shm_perm.cuid</i> or <i>shm_perm.uid</i> in the<b>shmid_ds</b> data structure associated with <i>shmid</i>.</dd></dl></blockquote><h4><a name="tag_03_676_04"></a>RETURN VALUE</h4><blockquote><p>Upon successful completion, <i>shmctl</i>() shall return 0; otherwise, it shall return -1 and set <i>errno</i> to indicate theerror.</p></blockquote><h4><a name="tag_03_676_05"></a>ERRORS</h4><blockquote><p>The <i>shmctl</i>() function shall fail if:</p><dl compact><dt>[EACCES]</dt><dd>The argument <i>cmd</i> is equal to IPC_STAT and the calling process does not have read permission; see <a href="xsh_chap02_07.html#tag_02_07"><i>XSI Interprocess Communication</i></a> .</dd><dt>[EINVAL]</dt><dd>The value of <i>shmid</i> is not a valid shared memory identifier, or the value of <i>cmd</i> is not a valid command.</dd><dt>[EPERM]</dt><dd>The argument <i>cmd</i> is equal to IPC_RMID or IPC_SET and the effective user ID of the calling process is not equal to thatof a process with appropriate privileges and it is not equal to the value of <i>shm_perm.cuid</i> or <i>shm_perm.uid</i> in thedata structure associated with <i>shmid</i>.</dd></dl><p>The <i>shmctl</i>() function may fail if:</p><dl compact><dt>[EOVERFLOW]</dt><dd>The <i>cmd</i> argument is IPC_STAT and the <i>gid</i> or <i>uid</i> value is too large to be stored in the structure pointedto by the <i>buf</i> argument.</dd></dl></blockquote><hr><div class="box"><em>The following sections are informative.</em></div><h4><a name="tag_03_676_06"></a>EXAMPLES</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_676_07"></a>APPLICATION USAGE</h4><blockquote><p>The POSIX Realtime Extension defines alternative interfaces for interprocess communication. Application developers who need touse IPC should design their applications so that modules using the IPC routines described in <a href="xsh_chap02_07.html#tag_02_07"><i>XSI Interprocess Communication</i></a> can be easily modified to use the alternativeinterfaces.</p></blockquote><h4><a name="tag_03_676_08"></a>RATIONALE</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_676_09"></a>FUTURE DIRECTIONS</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_676_10"></a>SEE ALSO</h4><blockquote><p><a href="xsh_chap02_07.html#tag_02_07"><i>XSI Interprocess Communication</i></a> , <a href="xsh_chap02_08.html#tag_02_08"><i>Realtime</i></a> , <a href="shmat.html"><i>shmat</i>()</a> , <a href="shmdt.html"><i>shmdt</i>()</a> , <a href="shmget.html"><i>shmget</i>()</a> , <a href="shm_open.html"><i>shm_open</i>()</a> , <ahref="shm_unlink.html"><i>shm_unlink</i>()</a> , the Base Definitions volume of IEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/sys/shm.h.html"><i>&lt;sys/shm.h&gt;</i></a></p></blockquote><h4><a name="tag_03_676_11"></a>CHANGE HISTORY</h4><blockquote><p>First released in Issue 2. Derived from Issue 2 of the SVID.</p></blockquote><h4><a name="tag_03_676_12"></a>Issue 5</h4><blockquote><p>Moved from SHARED MEMORY to BASE.</p><p>The note about use of POSIX Realtime Extension IPC routines has been moved from FUTURE DIRECTIONS to a new APPLICATION USAGEsection.</p></blockquote><div class="box"><em>End of informative text.</em></div><hr><hr size="2" noshade><center><font size="2"><!--footer start-->UNIX &reg; is a registered Trademark of The Open Group.<br>POSIX &reg; 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 + -