195 lines
7.0 KiB
HTML
195 lines
7.0 KiB
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 The Open Group, All Rights Reserved -->
|
|
<title>msgget</title>
|
|
</head>
|
|
<body bgcolor="white">
|
|
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
|
|
</script>
|
|
|
|
<basefont size="3"> <a name="msgget"></a> <a name="tag_03_394"></a><!-- msgget -->
|
|
<!--header start-->
|
|
<center><font size="2">The Open Group Base Specifications Issue 6<br>
|
|
IEEE Std 1003.1-2001<br>
|
|
Copyright © 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
|
|
|
|
<!--header end-->
|
|
<hr size="2" noshade>
|
|
<h4><a name="tag_03_394_01"></a>NAME</h4>
|
|
|
|
<blockquote>msgget - get the XSI message queue identifier</blockquote>
|
|
|
|
<h4><a name="tag_03_394_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 msgget(key_t</tt> <i>key</i><tt>, int</tt> <i>msgflg</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_394_03"></a>DESCRIPTION</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>msgget</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 function
|
|
interoperates 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>msgget</i>() function shall return the message queue identifier associated with the argument <i>key</i>.</p>
|
|
|
|
<p>A message queue identifier, associated message queue, and data structure (see <a href=
|
|
"../basedefs/sys/msg.h.html"><i><sys/msg.h></i></a>), shall be created for the argument <i>key</i> if one of the following is
|
|
true:</p>
|
|
|
|
<ul>
|
|
<li>
|
|
<p>The argument <i>key</i> is equal to IPC_PRIVATE.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>The argument <i>key</i> does not already have a message queue identifier associated with it, and (<i>msgflg</i> & IPC_CREAT)
|
|
is non-zero.</p>
|
|
</li>
|
|
</ul>
|
|
|
|
<p>Upon creation, the data structure associated with the new message queue identifier shall be initialized as follows:</p>
|
|
|
|
<ul>
|
|
<li>
|
|
<p><b>msg_perm.cuid</b>, <b>msg_perm.uid</b>, <b>msg_perm.cgid</b>, and <b>msg_perm.gid</b> shall be set equal to the effective
|
|
user ID and effective group ID, respectively, of the calling process.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>The low-order 9 bits of <b>msg_perm.mode</b> shall be set equal to the low-order 9 bits of <i>msgflg</i>.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p><b>msg_qnum</b>, <b>msg_lspid</b>, <b>msg_lrpid</b>, <b>msg_stime</b>, and <b>msg_rtime</b> shall be set equal to 0.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p><b>msg_ctime</b> shall be set equal to the current time.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p><b>msg_qbytes</b> shall be set equal to the system limit.</p>
|
|
</li>
|
|
</ul>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_394_04"></a>RETURN VALUE</h4>
|
|
|
|
<blockquote>
|
|
<p>Upon successful completion, <i>msgget</i>() shall return a non-negative integer, namely a message queue identifier. Otherwise,
|
|
it shall return -1 and set <i>errno</i> to indicate the error.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_394_05"></a>ERRORS</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>msgget</i>() function shall fail if:</p>
|
|
|
|
<dl compact>
|
|
<dt>[EACCES]</dt>
|
|
|
|
<dd>A message queue identifier exists for the argument <i>key</i>, but operation permission as specified by the low-order 9 bits of
|
|
<i>msgflg</i> would not be granted; see <a href="xsh_chap02_07.html#tag_02_07"><i>XSI Interprocess Communication</i></a> .</dd>
|
|
|
|
<dt>[EEXIST]</dt>
|
|
|
|
<dd>A message queue identifier exists for the argument <i>key</i> but ((<i>msgflg</i> & IPC_CREAT) && (<i>msgflg</i>
|
|
& IPC_EXCL)) is non-zero.</dd>
|
|
|
|
<dt>[ENOENT]</dt>
|
|
|
|
<dd>A message queue identifier does not exist for the argument <i>key</i> and (<i>msgflg</i> & IPC_CREAT) is 0.</dd>
|
|
|
|
<dt>[ENOSPC]</dt>
|
|
|
|
<dd>A message queue identifier is to be created but the system-imposed limit on the maximum number of allowed message queue
|
|
identifiers system-wide would be exceeded.</dd>
|
|
</dl>
|
|
</blockquote>
|
|
|
|
<hr>
|
|
<div class="box"><em>The following sections are informative.</em></div>
|
|
|
|
<h4><a name="tag_03_394_06"></a>EXAMPLES</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_394_07"></a>APPLICATION USAGE</h4>
|
|
|
|
<blockquote>
|
|
<p>The POSIX Realtime Extension defines alternative interfaces for interprocess communication (IPC). Application developers who
|
|
need 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 alternative
|
|
interfaces.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_394_08"></a>RATIONALE</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_394_09"></a>FUTURE DIRECTIONS</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_394_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="msgctl.html"><i>msgctl</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_394_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_394_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 USAGE
|
|
section.</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>
|
|
|