📄 syscalls_75.html
字号:
<!-- This HTML file has been created by texi2html 1.29
from syscalls.texi on 4 June 1994 -->
<TITLE>Syscall specifications of Linux - msgget</TITLE>
<P>Go to the <A HREF="syscalls_74.html" tppabs="http://personal.xfol.com/%7erezaie/syscall/syscalls_74.html">previous</A>, <A HREF="syscalls_76.html" tppabs="http://personal.xfol.com/%7erezaie/syscall/syscalls_76.html">next</A> section.<P>
<H2><A NAME="SEC75" HREF="syscalls_toc.html#SEC75" tppabs="http://personal.xfol.com/%7erezaie/syscall/syscalls_toc.html#SEC75">msgget</A></H2>
<P>
<H3>SYNOPSIS</H3>
<P>
<CODE>int msgget(key_t <VAR>key</VAR>, int <VAR>msgflg</VAR>);</CODE>
<P>
<H3>PARAMETERS</H3>
<P>
<VAR>key</VAR>: [in] the message queue identifier to get.
<P>
<VAR>msgflg</VAR>: [in] some flags (see description).
<P>
<H3>DESCRIPTION</H3>
<P>
Gets a message queue identifier. If <VAR>key</VAR> is <CODE>IPC_PRIVATE</CODE>, a
new queue is created, otherwise the result depends on <VAR>msgflg</VAR>. The
possible values for <VAR>msgflg</VAR> are:
<P>
<DL COMPACT>
<DT><CODE>IPC_CREAT</CODE>
<DD>creates a new queue for the key if it does not already exist.
<P>
<DT><CODE>IPC_EXCL</CODE>
<DD>if there is already a existing queue associated with <VAR>key</VAR>, the call
fails.
</DL>
<P>
The 9 lower bits of <VAR>msgflg</VAR> specify the permission bits of the new
queue. They have the same layout and meaning as those for files.
However, the execute permissions are meaningless for queues.
<P>
When creating a queue the system sets the appropriate parameters in the
<CODE>msqid_ds</CODE> structure associated with the new queue. When accessing
an already existing queue, the system simply check if the queue can be
accessed.
<P>
<H3>RETURN VALUE</H3>
<P>
On success, the call returns the new queue identificator. On error -1 is
returned and <CODE>errno</CODE> is set to one of the following values:
<P>
<UL>
<LI><CODE>EACCESS</CODE>: the task has no access permission to the queue.
<LI><CODE>EEXIST</CODE>: <CODE>IPC_CREAT</CODE> and <CODE>IPC_EXCL</CODE> were specified
and the queue already exists.
<LI><CODE>EIDRM</CODE>: the message queue no longer exists in the system.
<LI><CODE>ENOENT</CODE>: the message queue never existed.
<LI><CODE>ENOSPC</CODE>: the maximum number of message queues for the system
has been reached.
<LI><CODE>ENOMEM</CODE>
</UL>
<P>
<P>Go to the <A HREF="syscalls_74.html" tppabs="http://personal.xfol.com/%7erezaie/syscall/syscalls_74.html">previous</A>, <A HREF="syscalls_76.html" tppabs="http://personal.xfol.com/%7erezaie/syscall/syscalls_76.html">next</A> section.<P>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -