📄 msgctl.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>msgctl</title></head><body bgcolor="white"><script type="text/javascript" language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> <a name="msgctl"></a> <a name="tag_03_393"></a><!-- msgctl --> <!--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_393_01"></a>NAME</h4><blockquote>msgctl - XSI message control operations</blockquote><h4><a name="tag_03_393_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 <<a href="../basedefs/sys/msg.h.html">sys/msg.h</a>><br><br> int msgctl(int</tt> <i>msqid</i><tt>, int</tt> <i>cmd</i><tt>, struct msqid_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_393_03"></a>DESCRIPTION</h4><blockquote><p>The <i>msgctl</i>() function operates on XSI message queues (see the Base Definitions volume of IEEE Std 1003.1-2001,<a href="../basedefs/xbd_chap03.html#tag_03_224">Section 3.224, Message Queue</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>msgctl</i>() function shall provide message control operations as specified by <i>cmd</i>. The following values for<i>cmd</i>, and the message control operations they specify, are:</p><dl compact><dt>IPC_STAT</dt><dd>Place the current value of each member of the <b>msqid_ds</b> data structure associated with <i>msqid</i> into the structurepointed to by <i>buf</i>. The contents of this structure are defined in <a href="../basedefs/sys/msg.h.html"><i><sys/msg.h></i></a>.</dd><dt>IPC_SET</dt><dd>Set the value of the following members of the <b>msqid_ds</b> data structure associated with <i>msqid</i> to the correspondingvalue found in the structure pointed to by <i>buf</i>: <pre><tt>msg_perm.uidmsg_perm.gidmsg_perm.modemsg_qbytes</tt></pre><p>IPC_SET can only be executed by a process with appropriate privileges or that has an effective user ID equal to the value of<b>msg_perm.cuid</b> or <b>msg_perm.uid</b> in the <b>msqid_ds</b> data structure associated with <i>msqid</i>. Only a process withappropriate privileges can raise the value of <b>msg_qbytes</b>.</p></dd><dt>IPC_RMID</dt><dd>Remove the message queue identifier specified by <i>msqid</i> from the system and destroy the message queue and <b>msqid_ds</b>data structure associated with it. IPC_RMD can only be executed by a process with appropriate privileges or one that has aneffective user ID equal to the value of <b>msg_perm.cuid</b> or <b>msg_perm.uid</b> in the <b>msqid_ds</b> data structureassociated with <i>msqid</i>.</dd></dl></blockquote><h4><a name="tag_03_393_04"></a>RETURN VALUE</h4><blockquote><p>Upon successful completion, <i>msgctl</i>() shall return 0; otherwise, it shall return -1 and set <i>errno</i> to indicate theerror.</p></blockquote><h4><a name="tag_03_393_05"></a>ERRORS</h4><blockquote><p>The <i>msgctl</i>() function shall fail if:</p><dl compact><dt>[EACCES]</dt><dd>The argument <i>cmd</i> is 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>msqid</i> is not a valid message queue identifier; or the value of <i>cmd</i> is not a valid command.</dd><dt>[EPERM]</dt><dd>The argument <i>cmd</i> is IPC_RMID or IPC_SET and the effective user ID of the calling process is not equal to that of aprocess with appropriate privileges and it is not equal to the value of <b>msg_perm.cuid</b> or <b>msg_perm.uid</b> in the datastructure associated with <i>msqid</i>.</dd><dt>[EPERM]</dt><dd>The argument <i>cmd</i> is IPC_SET, an attempt is being made to increase to the value of <b>msg_qbytes</b>, and the effectiveuser ID of the calling process does not have appropriate privileges.</dd></dl></blockquote><hr><div class="box"><em>The following sections are informative.</em></div><h4><a name="tag_03_393_06"></a>EXAMPLES</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_393_07"></a>APPLICATION USAGE</h4><blockquote><p>The POSIX Realtime Extension defines alternative interfaces for interprocess communication (IPC). Application developers whoneed to use 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_393_08"></a>RATIONALE</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_393_09"></a>FUTURE DIRECTIONS</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_393_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="mq_close.html"><i>mq_close</i>()</a> , <a href="mq_getattr.html"><i>mq_getattr</i>()</a> , <a href="mq_notify.html"><i>mq_notify</i>()</a> , <a href="mq_open.html"><i>mq_open</i>()</a> , <a href="mq_receive.html"><i>mq_receive</i>()</a> , <a href="mq_send.html"><i>mq_send</i>()</a> , <a href="mq_setattr.html"><i>mq_setattr</i>()</a> , <a href="mq_unlink.html"><i>mq_unlink</i>()</a> , <a href="msgget.html"><i>msgget</i>()</a> , <a href="msgrcv.html"><i>msgrcv</i>()</a> ,<a href="msgsnd.html"><i>msgsnd</i>()</a> , the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/sys/msg.h.html"><i><sys/msg.h></i></a></p></blockquote><h4><a name="tag_03_393_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_393_12"></a>Issue 5</h4><blockquote><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 ® 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 + -