| <!-- |
| Documentation/_templates/layout.html |
| |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. The |
| ASF licenses this file to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance with the |
| License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| License for the specific language governing permissions and limitations |
| under the License. |
| --> |
| |
| |
| |
| <!DOCTYPE html> |
| <html class="writer-html5" lang="en" > |
| <head> |
| <meta charset="utf-8" /> |
| |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
| |
| <title>Named Message Queue Interfaces — NuttX latest documentation</title> |
| |
| |
| |
| <link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" /> |
| <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" /> |
| <link rel="stylesheet" href="../../_static/tabs.css" type="text/css" /> |
| <link rel="stylesheet" href="../../_static/custom.css" type="text/css" /> |
| |
| |
| |
| <link rel="shortcut icon" href="../../_static/favicon.ico"/> |
| |
| |
| |
| |
| |
| |
| |
| |
| <!--[if lt IE 9]> |
| <script src="../../_static/js/html5shiv.min.js"></script> |
| <![endif]--> |
| |
| |
| <script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script> |
| <script src="../../_static/jquery.js"></script> |
| <script src="../../_static/underscore.js"></script> |
| <script src="../../_static/doctools.js"></script> |
| |
| <script type="text/javascript" src="../../_static/js/theme.js"></script> |
| |
| |
| <link rel="index" title="Index" href="../../genindex.html" /> |
| <link rel="search" title="Search" href="../../search.html" /> |
| <link rel="next" title="Counting Semaphore Interfaces" href="05_counting_semaphore.html" /> |
| <link rel="prev" title="Task Control Interfaces" href="03_task_control.html" /> |
| </head> |
| |
| <body class="wy-body-for-nav"> |
| |
| |
| <div class="wy-grid-for-nav"> |
| |
| <nav data-toggle="wy-nav-shift" class="wy-nav-side"> |
| <div class="wy-side-scroll"> |
| <div class="wy-side-nav-search" > |
| |
| |
| <a href="../../index.html" class="icon icon-home"> NuttX |
| |
| |
| |
| |
| <img src="../../_static/NuttX.png" class="logo" alt="Logo"/> |
| |
| </a> |
| |
| <!-- this version selector is quite ugly, should be probably replaced by something |
| more modern --> |
| |
| <div class="version-selector"> |
| <select onchange="javascript:location.href = this.value;"> |
| |
| <option value="../../../latest" selected="selected">latest</option> |
| |
| <option value="../../../10.0.0" >10.0.0</option> |
| |
| <option value="../../../10.0.1" >10.0.1</option> |
| |
| <option value="../../../10.1.0" >10.1.0</option> |
| |
| <option value="../../../10.2.0" >10.2.0</option> |
| |
| <option value="../../../10.3.0" >10.3.0</option> |
| |
| <option value="../../../11.0.0" >11.0.0</option> |
| |
| <option value="../../../12.0.0" >12.0.0</option> |
| |
| <option value="../../../12.1.0" >12.1.0</option> |
| |
| <option value="../../../12.2.0" >12.2.0</option> |
| |
| <option value="../../../12.2.1" >12.2.1</option> |
| |
| <option value="../../../12.3.0" >12.3.0</option> |
| |
| <option value="../../../12.4.0" >12.4.0</option> |
| |
| <option value="../../../12.5.0" >12.5.0</option> |
| |
| <option value="../../../12.5.1" >12.5.1</option> |
| |
| <option value="../../../12.6.0" >12.6.0</option> |
| |
| <option value="../../../12.7.0" >12.7.0</option> |
| |
| <option value="../../../12.8.0" >12.8.0</option> |
| |
| <option value="../../../12.9.0" >12.9.0</option> |
| |
| <option value="../../../12.10.0" >12.10.0</option> |
| |
| <option value="../../../12.11.0" >12.11.0</option> |
| |
| </select> |
| </div> |
| |
| |
| <div role="search"> |
| <form id="rtd-search-form" class="wy-form" action="../../search.html" method="get"> |
| <input type="text" name="q" placeholder="Search docs" /> |
| <input type="hidden" name="check_keywords" value="yes" /> |
| <input type="hidden" name="area" value="default" /> |
| </form> |
| </div> |
| |
| </div> |
| |
| |
| <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> |
| |
| |
| |
| |
| |
| |
| <p class="caption"><span class="caption-text">Table of Contents</span></p> |
| <ul class="current"> |
| <li class="toctree-l1"><a class="reference internal" href="../../index.html">Home</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../introduction/index.html">Introduction</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../quickstart/index.html">Getting Started</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../contributing/index.html">Contributing</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../introduction/inviolables.html">The Inviolable Principles of NuttX</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../platforms/index.html">Supported Platforms</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../components/index.html">OS Components</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../applications/index.html">Applications</a></li> |
| <li class="toctree-l1 current"><a class="reference internal" href="../index.html">API Reference</a><ul class="current"> |
| <li class="toctree-l2 current"><a class="reference internal" href="index.html">Userspace API</a><ul class="current"> |
| <li class="toctree-l3"><a class="reference internal" href="01_task_control.html">Task Control Interfaces</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="02_task_scheduling.html">Task Scheduling Interfaces</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="03_task_control.html">Task Control Interfaces</a></li> |
| <li class="toctree-l3 current"><a class="current reference internal" href="#">Named Message Queue Interfaces</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="05_counting_semaphore.html">Counting Semaphore Interfaces</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="06_clocks_timers.html">Clocks and Timers</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="07_signals.html">Signal Interfaces</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="08_pthread.html">Pthread Interfaces</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="09_env_vars.html">Environment Variables</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="10_filesystem.html">File System Interfaces</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="11_network.html">Network Interfaces</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="12_shared_memory.html">Shared Memory Interfaces</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="13_boardctl.html">Board IOCTL</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="13_logging.html">Logging</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="structures.html">OS Data Structures</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l2"><a class="reference internal" href="../os/index.html">Architecture APIs</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l1"><a class="reference internal" href="../../faq/index.html">FAQ</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../guides/index.html">Guides</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../glossary.html">Glossary</a></li> |
| </ul> |
| |
| |
| |
| </div> |
| |
| </div> |
| </nav> |
| |
| <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> |
| |
| |
| <nav class="wy-nav-top" aria-label="top navigation"> |
| |
| <i data-toggle="wy-nav-top" class="fa fa-bars"></i> |
| <a href="../../index.html">NuttX</a> |
| |
| </nav> |
| |
| |
| <div class="wy-nav-content"> |
| |
| <div class="rst-content"> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <div role="navigation" aria-label="breadcrumbs navigation"> |
| |
| <ul class="wy-breadcrumbs"> |
| |
| <li><a href="../../index.html" class="icon icon-home"></a> »</li> |
| |
| <li><a href="../index.html">API Reference</a> »</li> |
| |
| <li><a href="index.html">Userspace API</a> »</li> |
| |
| <li>Named Message Queue Interfaces</li> |
| |
| |
| <li class="wy-breadcrumbs-aside"> |
| |
| |
| <a href="../../_sources/reference/user/04_message_queue.rst.txt" rel="nofollow"> View page source</a> |
| |
| |
| </li> |
| |
| </ul> |
| |
| |
| <hr/> |
| </div> |
| <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> |
| <div itemprop="articleBody"> |
| |
| <div class="section" id="named-message-queue-interfaces"> |
| <h1>Named Message Queue Interfaces<a class="headerlink" href="#named-message-queue-interfaces" title="Permalink to this headline">¶</a></h1> |
| <p>NuttX supports POSIX named message queues for inter-task communication. |
| Any task may send or receive messages on named message queues. Interrupt |
| handlers may send messages via named message queues.</p> |
| <blockquote> |
| <div><ul class="simple"> |
| <li><p><a class="reference internal" href="#c.mq_open" title="mq_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">mq_open()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.mq_close" title="mq_close"><code class="xref c c-func docutils literal notranslate"><span class="pre">mq_close()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.mq_unlink" title="mq_unlink"><code class="xref c c-func docutils literal notranslate"><span class="pre">mq_unlink()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.mq_send" title="mq_send"><code class="xref c c-func docutils literal notranslate"><span class="pre">mq_send()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.mq_timedsend" title="mq_timedsend"><code class="xref c c-func docutils literal notranslate"><span class="pre">mq_timedsend()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.mq_receive" title="mq_receive"><code class="xref c c-func docutils literal notranslate"><span class="pre">mq_receive()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.mq_timedreceive" title="mq_timedreceive"><code class="xref c c-func docutils literal notranslate"><span class="pre">mq_timedreceive()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.mq_notify" title="mq_notify"><code class="xref c c-func docutils literal notranslate"><span class="pre">mq_notify()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.mq_setattr" title="mq_setattr"><code class="xref c c-func docutils literal notranslate"><span class="pre">mq_setattr()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.mq_getattr" title="mq_getattr"><code class="xref c c-func docutils literal notranslate"><span class="pre">mq_getattr()</span></code></a></p></li> |
| </ul> |
| </div></blockquote> |
| <dl class="c function"> |
| <dt id="c.mq_open"> |
| <a class="reference internal" href="structures.html#c.mqd_t" title="mqd_t"><span class="pre">mqd_t</span></a> <code class="sig-name descname"><span class="pre">mq_open</span></code><span class="sig-paren">(</span><em class="property"><span class="pre">const</span></em> <span class="pre">char</span> <span class="pre">*</span><em><span class="pre">mqName</span></em>, <span class="pre">int</span> <em><span class="pre">oflags</span></em>, <span class="pre">...</span><span class="sig-paren">)</span><a class="headerlink" href="#c.mq_open" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Establishes a connection between a named message queue and the calling |
| task. After a successful call of mq_open(), the task can reference the |
| message queue using the address returned by the call. The message queue |
| remains usable until it is closed by a successful call to mq_close().</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>mqName</strong> – Name of the queue to open</p></li> |
| <li><p><strong>oflags</strong> – <p>Open flags. These may be any combination of:</p> |
| <ul> |
| <li><p><code class="docutils literal notranslate"><span class="pre">O_RDONLY</span></code>. Open for read access.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">O_WRONLY</span></code>. Open for write access.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">O_RDWR</span></code>. Open for both read & write access.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">O_CREAT</span></code>. Create message queue if it does not already exist.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">O_EXCL</span></code>. Name must not exist when opened.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">O_NONBLOCK</span></code>. Don’t wait for data.</p></li> |
| </ul> |
| </p></li> |
| <li><p><strong>...</strong> – <p><strong>Optional parameters</strong>. When the O_CREAT flag is specified, |
| POSIX requires that a third and fourth parameter be supplied:</p> |
| <ul> |
| <li><p><code class="docutils literal notranslate"><span class="pre">mode</span></code>. The mode parameter is of type mode_t. In the POSIX |
| specification, this mode value provides file permission bits for |
| the message queue. This parameter is required but not used in the |
| present implementation.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">attr</span></code>. A pointer to an mq_attr that is provided to initialize. |
| the message queue. If attr is NULL, then the messages queue is |
| created with implementation-defined default message queue |
| attributes. If attr is non-NULL, then the message queue mq_maxmsg |
| attribute is set to the corresponding value when the queue is |
| created. The mq_maxmsg attribute determines the maximum number of |
| messages that can be queued before addition attempts to send |
| messages on the message queue fail or cause the sender to block; |
| the mq_msgsize attribute determines the maximum size of a message |
| that can be sent or received. Other elements of attr are ignored |
| (i.e, set to default message queue attributes).</p></li> |
| </ul> |
| </p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p>A message queue descriptor or -1 (<code class="docutils literal notranslate"><span class="pre">ERROR</span></code>)</p> |
| </dd> |
| </dl> |
| <p><strong>POSIX Compatibility:</strong> Comparable to the POSIX interface of the same |
| name. Differences from the full POSIX implementation include:</p> |
| <ul class="simple"> |
| <li><p>The mq_msgsize attributes determines the maximum size of a message |
| that may be sent or received. In the present implementation, this |
| maximum message size is limited at 22 bytes.</p></li> |
| </ul> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.mq_close"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">mq_close</span></code><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.mqd_t" title="mqd_t"><span class="pre">mqd_t</span></a> <em><span class="pre">mqdes</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.mq_close" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Used to indicate that the calling task is finished with the specified |
| message queued <code class="docutils literal notranslate"><span class="pre">mqdes</span></code>. The <code class="docutils literal notranslate"><span class="pre">mq_close()</span></code> deallocates any system |
| resources allocated by the system for use by this task for its message |
| queue.</p> |
| <p>If the calling task has attached a notification request to the message |
| queue via this <code class="docutils literal notranslate"><span class="pre">mqdes</span></code> (see <code class="docutils literal notranslate"><span class="pre">mq_notify()</span></code>), this attachment will be |
| removed and the message queue is available for another task to attach |
| for notification.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>mqdes</strong> – Message queue descriptor.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p>0 (<code class="docutils literal notranslate"><span class="pre">OK</span></code>) if the message queue is closed successfully, otherwise, -1 |
| (<code class="docutils literal notranslate"><span class="pre">ERROR</span></code>).</p> |
| </dd> |
| </dl> |
| <p><strong>Assumptions/Limitations:</strong></p> |
| <blockquote> |
| <div><ul class="simple"> |
| <li><p>The behavior of a task that is blocked on either a <code class="docutils literal notranslate"><span class="pre">mq_send()</span></code> or |
| <code class="docutils literal notranslate"><span class="pre">mq_receive()</span></code> is undefined when <code class="docutils literal notranslate"><span class="pre">mq_close()</span></code> is called.</p></li> |
| <li><p>The result of using this message queue descriptor after successful |
| return from <code class="docutils literal notranslate"><span class="pre">mq_close()</span></code> is undefined.</p></li> |
| </ul> |
| </div></blockquote> |
| <p><strong>POSIX Compatibility:</strong> Comparable to the POSIX interface of the same |
| name.</p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.mq_unlink"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">mq_unlink</span></code><span class="sig-paren">(</span><em class="property"><span class="pre">const</span></em> <span class="pre">char</span> <span class="pre">*</span><em><span class="pre">mqName</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.mq_unlink" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Removes the message queue named by |
| “mqName.” If one or more tasks have the message queue open when |
| <code class="docutils literal notranslate"><span class="pre">mq_unlink()</span></code> is called, removal of the message queue is postponed |
| until all references to the message queue have been closed.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>mqName</strong> – Name of the message queue</p></li> |
| </ul> |
| </dd> |
| </dl> |
| <p><strong>POSIX Compatibility:</strong> Comparable to the POSIX interface of the same |
| name.</p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.mq_send"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">mq_send</span></code><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.mqd_t" title="mqd_t"><span class="pre">mqd_t</span></a> <em><span class="pre">mqdes</span></em>, <em class="property"><span class="pre">const</span></em> <span class="pre">void</span> <span class="pre">*</span><em><span class="pre">msg</span></em>, <a class="reference internal" href="structures.html#c.size_t" title="size_t"><span class="pre">size_t</span></a> <em><span class="pre">msglen</span></em>, <span class="pre">int</span> <em><span class="pre">prio</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.mq_send" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Adds the specified message, <code class="docutils literal notranslate"><span class="pre">msg</span></code>, to the message queue, <code class="docutils literal notranslate"><span class="pre">mqdes</span></code>. |
| The <code class="docutils literal notranslate"><span class="pre">msglen</span></code> parameter specifies the length of the message in bytes |
| pointed to by <code class="docutils literal notranslate"><span class="pre">msg</span></code>. This length must not exceed the maximum message |
| length from the <code class="docutils literal notranslate"><span class="pre">mq_getattr()</span></code>.</p> |
| <p>If the message queue is not full, <code class="docutils literal notranslate"><span class="pre">mq_send()</span></code> will place the <code class="docutils literal notranslate"><span class="pre">msg</span></code> |
| in the message queue at the position indicated by the <code class="docutils literal notranslate"><span class="pre">prio</span></code> argument. |
| Messages with higher priority will be inserted before lower priority |
| messages The value of <code class="docutils literal notranslate"><span class="pre">prio</span></code> must not exceed <code class="docutils literal notranslate"><span class="pre">MQ_PRIO_MAX</span></code>.</p> |
| <p>If the specified message queue is full and <code class="docutils literal notranslate"><span class="pre">O_NONBLOCK</span></code> is not set in |
| the message queue, then <code class="docutils literal notranslate"><span class="pre">mq_send()</span></code> will block until space becomes |
| available to the queue the message.</p> |
| <p>If the message queue is full and <code class="docutils literal notranslate"><span class="pre">NON_BLOCK</span></code> is set, the message is |
| not queued and <code class="docutils literal notranslate"><span class="pre">ERROR</span></code> is returned.</p> |
| <p><strong>NOTE</strong>: <code class="docutils literal notranslate"><span class="pre">mq_send()</span></code> may be called from an interrupt handler. |
| However, it behaves differently when called from the interrupt level:</p> |
| <ul class="simple"> |
| <li><p>It does not check the size of the queue. It will always post the |
| message, even if there are already too many messages in queue. This is |
| because the interrupt handler does not have the option of waiting for |
| the message queue to become non-full.</p></li> |
| <li><p>It doesn’t allocate new memory (because you cannot allocate memory |
| from an interrupt handler). Instead, there is a pool of pre-allocated |
| message structures that may be used just for sending messages from |
| interrupt handlers. The number of such pre-allocated messages is set |
| by the <code class="docutils literal notranslate"><span class="pre">PREALLOC_MQ_IRQ_MSGS</span></code> configuration parameter.</p></li> |
| </ul> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>mqdes</strong> – Message queue descriptor.</p></li> |
| <li><p><strong>msg</strong> – Message to send.</p></li> |
| <li><p><strong>msglen</strong> – The length of the message in bytes.</p></li> |
| <li><p><strong>prio</strong> – The priority of the message.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><p>On success, <code class="docutils literal notranslate"><span class="pre">mq_send()</span></code> returns 0 (<code class="docutils literal notranslate"><span class="pre">OK</span></code>); on |
| error, -1 (<code class="docutils literal notranslate"><span class="pre">ERROR</span></code>) is returned, with <code class="docutils literal notranslate"><span class="pre">`errno</span></code> <#ErrnoAccess>`__ set |
| to indicate the error:</p> |
| <ul class="simple"> |
| <li><p><code class="docutils literal notranslate"><span class="pre">EAGAIN</span></code>. The queue was empty, and the <code class="docutils literal notranslate"><span class="pre">O_NONBLOCK</span></code> flag was set |
| for the message queue description referred to by <code class="docutils literal notranslate"><span class="pre">mqdes</span></code>.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">EINVAL</span></code>. Either <code class="docutils literal notranslate"><span class="pre">msg</span></code> or <code class="docutils literal notranslate"><span class="pre">mqdes</span></code> is <code class="docutils literal notranslate"><span class="pre">NULL</span></code> or the value of |
| <code class="docutils literal notranslate"><span class="pre">prio</span></code> is invalid.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">EPERM</span></code>. Message queue opened not opened for writing.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">EMSGSIZE</span></code>. <code class="docutils literal notranslate"><span class="pre">msglen</span></code> was greater than the <code class="docutils literal notranslate"><span class="pre">maxmsgsize</span></code> |
| attribute of the message queue.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">EINTR</span></code>. The call was interrupted by a signal handler.</p></li> |
| </ul> |
| </p> |
| </dd> |
| </dl> |
| <p><strong>POSIX Compatibility:</strong> Comparable to the POSIX interface of the same |
| name.</p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.mq_timedsend"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">mq_timedsend</span></code><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.mqd_t" title="mqd_t"><span class="pre">mqd_t</span></a> <em><span class="pre">mqdes</span></em>, <em class="property"><span class="pre">const</span></em> <span class="pre">char</span> <span class="pre">*</span><em><span class="pre">msg</span></em>, <a class="reference internal" href="structures.html#c.size_t" title="size_t"><span class="pre">size_t</span></a> <em><span class="pre">msglen</span></em>, <span class="pre">int</span> <em><span class="pre">prio</span></em>, <em class="property"><span class="pre">const</span></em> <em class="property"><span class="pre">struct</span></em> <a class="reference internal" href="structures.html#c.timespec" title="timespec"><span class="pre">timespec</span></a> <span class="pre">*</span><em><span class="pre">abstime</span></em><span class="sig-paren">)</span><span class="pre">;</span><a class="headerlink" href="#c.mq_timedsend" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Adds the specified message, <code class="docutils literal notranslate"><span class="pre">msg</span></code>, to the message queue, <code class="docutils literal notranslate"><span class="pre">mqdes</span></code>. |
| The <code class="docutils literal notranslate"><span class="pre">msglen</span></code> parameter specifies the length of the message in bytes |
| pointed to by <code class="docutils literal notranslate"><span class="pre">msg</span></code>. This length must not exceed the maximum message |
| length from the <code class="docutils literal notranslate"><span class="pre">mq_getattr()</span></code>.</p> |
| <p>If the message queue is not full, <code class="docutils literal notranslate"><span class="pre">mq_timedsend()</span></code> will place the |
| <code class="docutils literal notranslate"><span class="pre">msg</span></code> in the message queue at the position indicated by the <code class="docutils literal notranslate"><span class="pre">prio</span></code> |
| argument. Messages with higher priority will be inserted before lower |
| priority messages The value of <code class="docutils literal notranslate"><span class="pre">prio</span></code> must not exceed <code class="docutils literal notranslate"><span class="pre">MQ_PRIO_MAX</span></code>.</p> |
| <p>If the specified message queue is full and <code class="docutils literal notranslate"><span class="pre">O_NONBLOCK</span></code> is not set in |
| the message queue, then <code class="docutils literal notranslate"><span class="pre">mq_send()</span></code> will block until space becomes |
| available to the queue the message or until a timeout occurs.</p> |
| <p><code class="docutils literal notranslate"><span class="pre">mq_timedsend()</span></code> behaves just like <code class="docutils literal notranslate"><span class="pre">mq_send()</span></code>, except that if the |
| queue is full and the <code class="docutils literal notranslate"><span class="pre">O_NONBLOCK</span></code> flag is not enabled for the message |
| queue description, then <code class="docutils literal notranslate"><span class="pre">abstime</span></code> points to a structure which |
| specifies a ceiling on the time for which the call will block. This |
| ceiling is an absolute timeout in seconds and nanoseconds since the |
| Epoch (midnight on the morning of 1 January 1970).</p> |
| <p>If the message queue is full, and the timeout has already expired by the |
| time of the call, <code class="docutils literal notranslate"><span class="pre">mq_timedsend()</span></code> returns immediately.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>mqdes</strong> – Message queue descriptor.</p></li> |
| <li><p><strong>msg</strong> – Message to send.</p></li> |
| <li><p><strong>msglen</strong> – The length of the message in bytes.</p></li> |
| <li><p><strong>prio</strong> – The priority of the message.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><p>On success, <code class="docutils literal notranslate"><span class="pre">mq_send()</span></code> returns 0 (<code class="docutils literal notranslate"><span class="pre">OK</span></code>); on |
| error, -1 (<code class="docutils literal notranslate"><span class="pre">ERROR</span></code>) is returned, with <code class="docutils literal notranslate"><span class="pre">`errno</span></code> <#ErrnoAccess>`__ set |
| to indicate the error:</p> |
| <ul class="simple"> |
| <li><p><code class="docutils literal notranslate"><span class="pre">EAGAIN</span></code>. The queue was empty, and the <code class="docutils literal notranslate"><span class="pre">O_NONBLOCK</span></code> flag was set |
| for the message queue description referred to by <code class="docutils literal notranslate"><span class="pre">mqdes</span></code>.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">EINVAL</span></code>. Either <code class="docutils literal notranslate"><span class="pre">msg</span></code> or <code class="docutils literal notranslate"><span class="pre">mqdes</span></code> is <code class="docutils literal notranslate"><span class="pre">NULL</span></code> or the value of |
| <code class="docutils literal notranslate"><span class="pre">prio</span></code> is invalid.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">EPERM</span></code>. Message queue opened not opened for writing.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">EMSGSIZE</span></code>. <code class="docutils literal notranslate"><span class="pre">msglen</span></code> was greater than the <code class="docutils literal notranslate"><span class="pre">maxmsgsize</span></code> |
| attribute of the message queue.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">EINTR</span></code>. The call was interrupted by a signal handler.</p></li> |
| </ul> |
| </p> |
| </dd> |
| </dl> |
| <p><strong>POSIX Compatibility:</strong> Comparable to the POSIX interface of the same |
| name.</p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.mq_receive"> |
| <span class="pre">ssize_t</span> <code class="sig-name descname"><span class="pre">mq_receive</span></code><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.mqd_t" title="mqd_t"><span class="pre">mqd_t</span></a> <em><span class="pre">mqdes</span></em>, <span class="pre">void</span> <span class="pre">*</span><em><span class="pre">msg</span></em>, <a class="reference internal" href="structures.html#c.size_t" title="size_t"><span class="pre">size_t</span></a> <em><span class="pre">msglen</span></em>, <span class="pre">int</span> <span class="pre">*</span><em><span class="pre">prio</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.mq_receive" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Receives the oldest of the highest priority messages from the message |
| queue specified by <code class="docutils literal notranslate"><span class="pre">mqdes</span></code>. If the size of the buffer in bytes, |
| <code class="docutils literal notranslate"><span class="pre">msgLen</span></code>, is less than the <code class="docutils literal notranslate"><span class="pre">mq_msgsize</span></code> attribute of the message |
| queue, <code class="docutils literal notranslate"><span class="pre">mq_receive()</span></code> will return an error. Otherwise, the selected |
| message is removed from the queue and copied to <code class="docutils literal notranslate"><span class="pre">msg</span></code>.</p> |
| <p>If the message queue is empty and <code class="docutils literal notranslate"><span class="pre">O_NONBLOCK</span></code> was not set, |
| <code class="docutils literal notranslate"><span class="pre">mq_receive()</span></code> will block until a message is added to the message |
| queue. If more than one task is waiting to receive a message, only the |
| task with the highest priority that has waited the longest will be |
| unblocked.</p> |
| <p>If the queue is empty and <code class="docutils literal notranslate"><span class="pre">O_NONBLOCK</span></code> is set, <code class="docutils literal notranslate"><span class="pre">ERROR</span></code> will be |
| returned.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>mqdes</strong> – Message Queue Descriptor.</p></li> |
| <li><p><strong>msg</strong> – Buffer to receive the message.</p></li> |
| <li><p><strong>msglen</strong> – Size of the buffer in bytes.</p></li> |
| <li><p><strong>prio</strong> – If not NULL, the location to store message priority.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><p>On success, the length of the selected message in bytes is |
| returned. On failure, -1 (<code class="docutils literal notranslate"><span class="pre">ERROR</span></code>) is returned and the |
| <code class="docutils literal notranslate"><span class="pre">`errno</span></code> <#ErrnoAccess>`__ is set appropriately:</p> |
| <ul class="simple"> |
| <li><p><code class="docutils literal notranslate"><span class="pre">EAGAIN</span></code> The queue was empty and the <code class="docutils literal notranslate"><span class="pre">O_NONBLOCK</span></code> flag was set |
| for the message queue description referred to by <code class="docutils literal notranslate"><span class="pre">mqdes</span></code>.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">EPERM</span></code> Message queue opened not opened for reading.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">EMSGSIZE</span></code> <code class="docutils literal notranslate"><span class="pre">msglen</span></code> was less than the <code class="docutils literal notranslate"><span class="pre">maxmsgsize</span></code> attribute of |
| the message queue.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">EINTR</span></code> The call was interrupted by a signal handler.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">EINVAL</span></code> Invalid <code class="docutils literal notranslate"><span class="pre">msg</span></code> or <code class="docutils literal notranslate"><span class="pre">mqdes</span></code></p></li> |
| </ul> |
| </p> |
| </dd> |
| </dl> |
| <p><strong>POSIX Compatibility:</strong> Comparable to the POSIX interface of the same |
| name.</p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.mq_timedreceive"> |
| <span class="pre">ssize_t</span> <code class="sig-name descname"><span class="pre">mq_timedreceive</span></code><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.mqd_t" title="mqd_t"><span class="pre">mqd_t</span></a> <em><span class="pre">mqdes</span></em>, <span class="pre">void</span> <span class="pre">*</span><em><span class="pre">msg</span></em>, <a class="reference internal" href="structures.html#c.size_t" title="size_t"><span class="pre">size_t</span></a> <em><span class="pre">msglen</span></em>, <span class="pre">int</span> <span class="pre">*</span><em><span class="pre">prio</span></em>, <em class="property"><span class="pre">const</span></em> <em class="property"><span class="pre">struct</span></em> <a class="reference internal" href="structures.html#c.timespec" title="timespec"><span class="pre">timespec</span></a> <span class="pre">*</span><em><span class="pre">abstime</span></em><span class="sig-paren">)</span><span class="pre">;</span><a class="headerlink" href="#c.mq_timedreceive" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Receives the oldest of the highest priority messages from the message |
| queue specified by <code class="docutils literal notranslate"><span class="pre">mqdes</span></code>. If the size of the buffer in bytes, |
| <code class="docutils literal notranslate"><span class="pre">msgLen</span></code>, is less than the <code class="docutils literal notranslate"><span class="pre">mq_msgsize</span></code> attribute of the message |
| queue, <code class="docutils literal notranslate"><span class="pre">mq_timedreceive()</span></code> will return an error. Otherwise, the |
| selected message is removed from the queue and copied to <code class="docutils literal notranslate"><span class="pre">msg</span></code>.</p> |
| <p>If the message queue is empty and <code class="docutils literal notranslate"><span class="pre">O_NONBLOCK</span></code> was not set, |
| <code class="docutils literal notranslate"><span class="pre">mq_timedreceive()</span></code> will block until a message is added to the message |
| queue (or until a timeout occurs). If more than one task is waiting to |
| receive a message, only the task with the highest priority that has |
| waited the longest will be unblocked.</p> |
| <p><code class="docutils literal notranslate"><span class="pre">mq_timedreceive()</span></code> behaves just like <code class="docutils literal notranslate"><span class="pre">mq_receive()</span></code>, except that if |
| the queue is empty and the <code class="docutils literal notranslate"><span class="pre">O_NONBLOCK</span></code> flag is not enabled for the |
| message queue description, then <code class="docutils literal notranslate"><span class="pre">abstime</span></code> points to a structure which |
| specifies a ceiling on the time for which the call will block. This |
| ceiling is an absolute timeout in seconds and nanoseconds since the |
| Epoch (midnight on the morning of 1 January 1970).</p> |
| <p>If no message is available, and the timeout has already expired by the |
| time of the call, <code class="docutils literal notranslate"><span class="pre">mq_timedreceive()</span></code> returns immediately.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>mqdes</strong> – Message Queue Descriptor.</p></li> |
| <li><p><strong>msg</strong> – Buffer to receive the message.</p></li> |
| <li><p><strong>msglen</strong> – Size of the buffer in bytes.</p></li> |
| <li><p><strong>prio</strong> – If not NULL, the location to store message priority.</p></li> |
| <li><p><strong>abstime</strong> – The absolute time to wait until a timeout is declared.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><p>On success, the length of the selected message in bytes is |
| returned. On failure, -1 (<code class="docutils literal notranslate"><span class="pre">ERROR</span></code>) is returned and the |
| <code class="docutils literal notranslate"><span class="pre">`errno</span></code> <#ErrnoAccess>`__ is set appropriately:</p> |
| <ul class="simple"> |
| <li><p><code class="docutils literal notranslate"><span class="pre">EAGAIN</span></code>: The queue was empty and the <code class="docutils literal notranslate"><span class="pre">O_NONBLOCK</span></code> flag was set |
| for the message queue description referred to by <code class="docutils literal notranslate"><span class="pre">mqdes</span></code>.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">EPERM</span></code>: Message queue opened not opened for reading.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">EMSGSIZE</span></code>: <code class="docutils literal notranslate"><span class="pre">msglen</span></code> was less than the <code class="docutils literal notranslate"><span class="pre">maxmsgsize</span></code> attribute |
| of the message queue.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">EINTR</span></code>: The call was interrupted by a signal handler.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">EINVAL</span></code>: Invalid <code class="docutils literal notranslate"><span class="pre">msg</span></code> or <code class="docutils literal notranslate"><span class="pre">mqdes</span></code> or <code class="docutils literal notranslate"><span class="pre">abstime</span></code></p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">ETIMEDOUT</span></code>: The call timed out before a message could be |
| transferred.</p></li> |
| </ul> |
| </p> |
| </dd> |
| </dl> |
| <p><strong>POSIX Compatibility:</strong> Comparable to the POSIX interface of the same |
| name.</p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.mq_notify"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">mq_notify</span></code><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.mqd_t" title="mqd_t"><span class="pre">mqd_t</span></a> <em><span class="pre">mqdes</span></em>, <span class="pre">FAR</span> <em class="property"><span class="pre">const</span></em> <em class="property"><span class="pre">struct</span></em> <a class="reference internal" href="structures.html#c.sigevent" title="sigevent"><span class="pre">sigevent</span></a> <span class="pre">*</span><em><span class="pre">notification</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.mq_notify" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>If the <code class="docutils literal notranslate"><span class="pre">notification</span></code> input parameter is not <code class="docutils literal notranslate"><span class="pre">NULL</span></code>, this function |
| connects the task with the message queue such that the specified signal |
| will be sent to the task whenever the message queue changes from empty |
| to non-empty. One notification can be attached to a message queue.</p> |
| <p>If <code class="docutils literal notranslate"><span class="pre">notification</span></code>; is <code class="docutils literal notranslate"><span class="pre">NULL</span></code>, the attached notification is detached |
| (if it was held by the calling task) and the queue is available to |
| attach another notification.</p> |
| <p>When the notification is sent to the registered task, its registration |
| will be removed. The message queue will then be available for |
| registration.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>mqdes</strong> – Message queue descriptor</p></li> |
| <li><p><strong>notification</strong> – <p>Real-time signal structure containing:</p> |
| <ul> |
| <li><p><code class="docutils literal notranslate"><span class="pre">sigev_notify</span></code>. Should be SIGEV_SIGNAL (but actually ignored)</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">sigev_signo</span></code>. The signo to use for the notification</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">sigev_value</span></code>. Value associated with the signal</p></li> |
| </ul> |
| </p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><p>On success <code class="docutils literal notranslate"><span class="pre">mq_notify()</span></code> returns 0; on error, -1 |
| is returned, with <code class="docutils literal notranslate"><span class="pre">errno</span></code> set to indicate the error:</p> |
| <ul class="simple"> |
| <li><p><code class="docutils literal notranslate"><span class="pre">EBADF</span></code>. The descriptor specified in <code class="docutils literal notranslate"><span class="pre">mqdes</span></code> is invalid.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">EBUSY</span></code>. Another process has already registered to receive |
| notification for this message queue.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">EINVAL</span></code>. <code class="docutils literal notranslate"><span class="pre">sevp->sigev_notify</span></code> is not one of the permitted |
| values; or <code class="docutils literal notranslate"><span class="pre">sevp->sigev_notify</span></code> is <code class="docutils literal notranslate"><span class="pre">SIGEV_SIGNAL</span></code> and |
| <code class="docutils literal notranslate"><span class="pre">sevp->sigev_signo</span></code> is not a valid signal number.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">ENOMEM</span></code>. Insufficient memory.</p></li> |
| </ul> |
| </p> |
| </dd> |
| </dl> |
| <p><strong>POSIX Compatibility:</strong> Comparable to the POSIX interface of the same |
| name. Differences from the full POSIX implementation include:</p> |
| <ul class="simple"> |
| <li><p>The notification signal will be sent to the registered task even if |
| another task is waiting for the message queue to become non-empty. |
| This is inconsistent with the POSIX specification which states, “If a |
| process has registered for notification of message arrival at a |
| message queue and some process is blocked in <code class="docutils literal notranslate"><span class="pre">mq_receive</span></code> waiting |
| to receive a message when a message arrives at the queue, the |
| arriving message will satisfy the appropriate <code class="docutils literal notranslate"><span class="pre">mq_receive()</span></code> … |
| The resulting behavior is as if the message queue remains empty, and |
| no notification will be sent.”</p></li> |
| </ul> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.mq_setattr"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">mq_setattr</span></code><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.mqd_t" title="mqd_t"><span class="pre">mqd_t</span></a> <em><span class="pre">mqdes</span></em>, <em class="property"><span class="pre">const</span></em> <em class="property"><span class="pre">struct</span></em> <a class="reference internal" href="structures.html#c.mq_attr" title="mq_attr"><span class="pre">mq_attr</span></a> <span class="pre">*</span><em><span class="pre">mqStat</span></em>, <em class="property"><span class="pre">struct</span></em> <a class="reference internal" href="structures.html#c.mq_attr" title="mq_attr"><span class="pre">mq_attr</span></a> <span class="pre">*</span><em><span class="pre">oldMqStat</span></em><span class="sig-paren">)</span><span class="pre">;</span><a class="headerlink" href="#c.mq_setattr" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Sets the attributes associated with the specified message queue “mqdes.” |
| Only the “O_NONBLOCK” bit of the “mq_flags” can be changed.</p> |
| <p>If <code class="docutils literal notranslate"><span class="pre">oldMqStat</span></code> is non-null, mq_setattr() will store the previous message |
| queue attributes at that location (just as would have been returned by |
| mq_getattr()).</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>mqdes</strong> – Message queue descriptor</p></li> |
| <li><p><strong>mqStat</strong> – New attributes</p></li> |
| <li><p><strong>oldMqState</strong> – Old attributes</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p>0 (<code class="docutils literal notranslate"><span class="pre">OK</span></code>) if attributes are set successfully, otherwise -1 |
| (<code class="docutils literal notranslate"><span class="pre">ERROR</span></code>).</p> |
| </dd> |
| </dl> |
| <p><strong>POSIX Compatibility:</strong> Comparable to the POSIX interface of the same |
| name.</p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.mq_getattr"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">mq_getattr</span></code><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.mqd_t" title="mqd_t"><span class="pre">mqd_t</span></a> <em><span class="pre">mqdes</span></em>, <em class="property"><span class="pre">struct</span></em> <a class="reference internal" href="structures.html#c.mq_attr" title="mq_attr"><span class="pre">mq_attr</span></a> <span class="pre">*</span><em><span class="pre">mqStat</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.mq_getattr" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Gets status information and attributes associated with the specified |
| message queue.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>mqdes</strong> – Message queue descriptor</p></li> |
| <li><p><strong>mqStat</strong> – <p>Buffer in which to return attributes. The returned |
| attributes include:</p> |
| <ul> |
| <li><p><code class="docutils literal notranslate"><span class="pre">mq_maxmsg</span></code>. Max number of messages in queue.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">mq_msgsize</span></code>. Max message size.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">mq_flags</span></code>. Queue flags.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">mq_curmsgs</span></code>. Number of messages currently in queue.</p></li> |
| </ul> |
| </p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p>0 (<code class="docutils literal notranslate"><span class="pre">OK</span></code>) if attributes provided, -1 (<code class="docutils literal notranslate"><span class="pre">ERROR</span></code>) otherwise.</p> |
| </dd> |
| </dl> |
| <p><strong>POSIX Compatibility:</strong> Comparable to the POSIX interface of the same |
| name.</p> |
| </dd></dl> |
| |
| </div> |
| |
| |
| </div> |
| |
| </div> |
| <footer> |
| <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> |
| <a href="05_counting_semaphore.html" class="btn btn-neutral float-right" title="Counting Semaphore Interfaces" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a> |
| <a href="03_task_control.html" class="btn btn-neutral float-left" title="Task Control Interfaces" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a> |
| </div> |
| |
| <hr/> |
| |
| <div role="contentinfo"> |
| <p> |
| © Copyright 2020, The Apache Software Foundation. |
| |
| </p> |
| </div> |
| |
| </footer> |
| </div> |
| </div> |
| |
| </section> |
| |
| </div> |
| |
| |
| <script type="text/javascript"> |
| jQuery(function () { |
| SphinxRtdTheme.Navigation.enable(true); |
| }); |
| </script> |
| |
| |
| |
| |
| |
| |
| </body> |
| </html> |