| <!-- |
| 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>Signal 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="Pthread Interfaces" href="08_pthread.html" /> |
| <link rel="prev" title="Clocks and Timers" href="06_clocks_timers.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"><a class="reference internal" href="04_message_queue.html">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 current"><a class="current reference internal" href="#">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>Signal Interfaces</li> |
| |
| |
| <li class="wy-breadcrumbs-aside"> |
| |
| |
| <a href="../../_sources/reference/user/07_signals.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="signal-interfaces"> |
| <h1>Signal Interfaces<a class="headerlink" href="#signal-interfaces" title="Permalink to this headline">¶</a></h1> |
| <p><strong>Tasks and Signals</strong>. NuttX provides signal interfaces for tasks and |
| pthreads. Signals are used to alter the flow control of tasks by |
| communicating asynchronous events within or between task contexts. Any |
| task or interrupt handler can post (or send) a signal to a particular |
| task using its task ID. The task being signaled will execute |
| task-specified signal handler function the next time that the task has |
| priority. The signal handler is a user-supplied function that is bound |
| to a specific signal and performs whatever actions are necessary |
| whenever the signal is received.</p> |
| <p>By default, here are no predefined actions for any signal. The default |
| action for all signals (i.e., when no signal handler has been supplied |
| by the user) is to ignore the signal. In this sense, all NuttX are <em>real |
| time</em> signals by default. If the configuration option |
| <code class="docutils literal notranslate"><span class="pre">CONFIG_SIG_DEFAULT=y</span></code> is included, some signals will perform their |
| default actions dependent upon addition configuration settings as |
| summarized in the following table:</p> |
| <table class="docutils align-default"> |
| <colgroup> |
| <col style="width: 12%" /> |
| <col style="width: 35%" /> |
| <col style="width: 53%" /> |
| </colgroup> |
| <thead> |
| <tr class="row-odd"><th class="head"><p>Signal</p></th> |
| <th class="head"><p>Action</p></th> |
| <th class="head"><p>Additional Configuration</p></th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr class="row-even"><td><p>SIGUSR1</p></td> |
| <td><p>Abnormal Termination</p></td> |
| <td><p>CONFIG_SIG_SIGUSR1_ACTION</p></td> |
| </tr> |
| <tr class="row-odd"><td><p>SIGUSR2</p></td> |
| <td><p>Abnormal Termination</p></td> |
| <td><p>CONFIG_SIG_SIGUSR2_ACTION</p></td> |
| </tr> |
| <tr class="row-even"><td><p>SIGALRM</p></td> |
| <td><p>Abnormal Termination</p></td> |
| <td><p>CONFIG_SIG_SIGALRM_ACTION</p></td> |
| </tr> |
| <tr class="row-odd"><td><p>SIGPOLL</p></td> |
| <td><p>Abnormal Termination</p></td> |
| <td><p>CONFIG_SIG_SIGPOLL_ACTION</p></td> |
| </tr> |
| <tr class="row-even"><td><p>SIGSTOP</p></td> |
| <td><p>Suspend task</p></td> |
| <td><p>CONFIG_SIG_SIGSTOP_ACTION</p></td> |
| </tr> |
| <tr class="row-odd"><td><p>SIGTSTP</p></td> |
| <td><p>Suspend task</p></td> |
| <td><p>CONFIG_SIG_SIGSTOP_ACTION</p></td> |
| </tr> |
| <tr class="row-even"><td><p>SIGCONT</p></td> |
| <td><p>Resume task</p></td> |
| <td><p>CONFIG_SIG_SIGSTOP_ACTION</p></td> |
| </tr> |
| <tr class="row-odd"><td><p>SIGINT</p></td> |
| <td><p>Abnormal Termination</p></td> |
| <td><p>CONFIG_SIG_SIGKILL_ACTION</p></td> |
| </tr> |
| <tr class="row-even"><td><p>SIGKILL</p></td> |
| <td><p>Abnormal Termination</p></td> |
| <td><p>CONFIG_SIG_SIGKILL_ACTION</p></td> |
| </tr> |
| </tbody> |
| </table> |
| <p>Tasks may also suspend themselves and wait until a signal is received.</p> |
| <p><strong>Tasks Groups</strong>. NuttX supports both tasks and pthreads. The primary |
| difference between tasks and pthreads is the tasks are much more |
| independent. Tasks can create pthreads and those pthreads will share the |
| resources of the task. The main task and its children pthreads together |
| are referred as a <em>task group</em>. A task group is used in NuttX to emulate |
| a POSIX <em>process</em>.</p> |
| <div class="admonition note"> |
| <p class="admonition-title">Note</p> |
| <p>Behavior of features related to task groups depend of NuttX |
| configuration settings. See also the<a class="reference external" href="https://cwiki.apache.org/confluence/display/NUTTX/NuttX+Tasking">NuttX |
| Tasking</a>page |
| and the<a class="reference external" href="https://cwiki.apache.org/confluence/display/NUTTX/Tasks+vs.+Threads+FAQ">Tasks vs. Threads |
| FAQ</a>for |
| additional information on tasks and threads in NuttX.</p> |
| </div> |
| <p><strong>Signaling Multi-threaded Task Groups</strong>. The behavior of signals in the |
| multi-thread task group is complex. NuttX emulates a process model with |
| task groups and follows the POSIX rules for signaling behavior. Normally |
| when you signal the task group you would signal using the task ID of the |
| main task that created the group (in practice, a different task should |
| not know the IDs of the internal threads created within the task group); |
| that ID is remembered by the task group (even if the main task thread |
| exits).</p> |
| <p>Here are some of the things that should happen when you signal a |
| multi-threaded task group:</p> |
| <ul class="simple"> |
| <li><p>If a task group receives a signal then one and only one indeterminate |
| thread in the task group which is not blocking the signal will |
| receive the signal.</p></li> |
| <li><p>If a task group receives a signal and more than one thread is waiting |
| on that signal, then one and only one indeterminate thread out of |
| that waiting group will receive the signal.</p></li> |
| </ul> |
| <p>You can mask out that signal using ‘’sigprocmask()’’ (or |
| ‘’pthread_sigmask()’’). That signal will then be effectively disabled |
| and will never be received in those threads that have the signal masked. |
| On creation of a new thread, the new thread will inherit the signal mask |
| of the parent thread that created it. So you if block signal signals on |
| one thread then create new threads, those signals will also be blocked |
| in the new threads as well.</p> |
| <p>You can control which thread receives the signal by controlling the |
| signal mask. You can, for example, create a single thread whose sole |
| purpose it is to catch a particular signal and respond to it: Simply |
| block the signal in the main task; then the signal will be blocked in |
| all of the pthreads in the group too. In the one “signal processing” |
| pthread, enable the blocked signal. This thread will then be only thread |
| that will receive the signal.</p> |
| <p><strong>Signal Interfaces</strong>. The following signal handling interfaces are |
| provided by NuttX:</p> |
| <ul class="simple"> |
| <li><p><a class="reference internal" href="#c.sigemptyset" title="sigemptyset"><code class="xref c c-func docutils literal notranslate"><span class="pre">sigemptyset()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.sigfillset" title="sigfillset"><code class="xref c c-func docutils literal notranslate"><span class="pre">sigfillset()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.sigaddset" title="sigaddset"><code class="xref c c-func docutils literal notranslate"><span class="pre">sigaddset()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.sigdelset" title="sigdelset"><code class="xref c c-func docutils literal notranslate"><span class="pre">sigdelset()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.sigismember" title="sigismember"><code class="xref c c-func docutils literal notranslate"><span class="pre">sigismember()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.sigaction" title="sigaction"><code class="xref c c-func docutils literal notranslate"><span class="pre">sigaction()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.sigignore" title="sigignore"><code class="xref c c-func docutils literal notranslate"><span class="pre">sigignore()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.sigset" title="sigset"><code class="xref c c-func docutils literal notranslate"><span class="pre">sigset()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.sigprocmask" title="sigprocmask"><code class="xref c c-func docutils literal notranslate"><span class="pre">sigprocmask()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.sighold" title="sighold"><code class="xref c c-func docutils literal notranslate"><span class="pre">sighold()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.sigrelse" title="sigrelse"><code class="xref c c-func docutils literal notranslate"><span class="pre">sigrelse()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.sigpending" title="sigpending"><code class="xref c c-func docutils literal notranslate"><span class="pre">sigpending()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.sigsuspend" title="sigsuspend"><code class="xref c c-func docutils literal notranslate"><span class="pre">sigsuspend()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.sigpause" title="sigpause"><code class="xref c c-func docutils literal notranslate"><span class="pre">sigpause()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.sigwaitinfo" title="sigwaitinfo"><code class="xref c c-func docutils literal notranslate"><span class="pre">sigwaitinfo()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.sigtimedwait" title="sigtimedwait"><code class="xref c c-func docutils literal notranslate"><span class="pre">sigtimedwait()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.sigqueue" title="sigqueue"><code class="xref c c-func docutils literal notranslate"><span class="pre">sigqueue()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.kill" title="kill"><code class="xref c c-func docutils literal notranslate"><span class="pre">kill()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.pause" title="pause"><code class="xref c c-func docutils literal notranslate"><span class="pre">pause()</span></code></a></p></li> |
| </ul> |
| <dl class="c function"> |
| <dt id="c.sigemptyset"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">sigemptyset</span></code><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.sigset_t" title="sigset_t"><span class="pre">sigset_t</span></a> <span class="pre">*</span><em><span class="pre">set</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.sigemptyset" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Initializes the signal set specified by |
| set such that all signals are excluded.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>set</strong> – Signal set to initialize.</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>), or -1 (<code class="docutils literal notranslate"><span class="pre">ERROR</span></code>) if the signal set cannot be |
| initialized.</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.sigfillset"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">sigfillset</span></code><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.sigset_t" title="sigset_t"><span class="pre">sigset_t</span></a> <span class="pre">*</span><em><span class="pre">set</span></em><span class="sig-paren">)</span><span class="pre">;</span><a class="headerlink" href="#c.sigfillset" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Initializes the signal set specified by |
| set such that all signals are included.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>set</strong> – Signal set to initialize</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>), or -1 (<code class="docutils literal notranslate"><span class="pre">ERROR</span></code>) if the signal set cannot be |
| initialized.</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.sigaddset"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">sigaddset</span></code><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.sigset_t" title="sigset_t"><span class="pre">sigset_t</span></a> <span class="pre">*</span><em><span class="pre">set</span></em>, <span class="pre">int</span> <em><span class="pre">signo</span></em><span class="sig-paren">)</span><span class="pre">;</span><a class="headerlink" href="#c.sigaddset" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Adds the signal specified by signo to the |
| signal set specified by set.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>set</strong> – Signal set to add signal to</p></li> |
| <li><p><strong>signo</strong> – Signal to add</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>), or -1 (<code class="docutils literal notranslate"><span class="pre">ERROR</span></code>) if the signal number is invalid.</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.sigdelset"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">sigdelset</span></code><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.sigset_t" title="sigset_t"><span class="pre">sigset_t</span></a> <span class="pre">*</span><em><span class="pre">set</span></em>, <span class="pre">int</span> <em><span class="pre">signo</span></em><span class="sig-paren">)</span><span class="pre">;</span><a class="headerlink" href="#c.sigdelset" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Deletes the signal specified by signo |
| from the signal set specified by set.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>set</strong> – Signal set to delete the signal from</p></li> |
| <li><p><strong>signo</strong> – Signal to delete</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>), or -1 (<code class="docutils literal notranslate"><span class="pre">ERROR</span></code>) if the signal number is invalid.</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.sigismember"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">sigismember</span></code><span class="sig-paren">(</span><em class="property"><span class="pre">const</span></em> <a class="reference internal" href="structures.html#c.sigset_t" title="sigset_t"><span class="pre">sigset_t</span></a> <span class="pre">*</span><em><span class="pre">set</span></em>, <span class="pre">int</span> <em><span class="pre">signo</span></em><span class="sig-paren">)</span><span class="pre">;</span><a class="headerlink" href="#c.sigismember" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Tests whether the signal specified by |
| signo is a member of the set specified by set.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>set</strong> – Signal set to test</p></li> |
| <li><p><strong>signo</strong> – Signal to test for</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><ul class="simple"> |
| <li><p>1 (TRUE), if the specified signal is a member of the set,</p></li> |
| <li><p>0 (OK or FALSE), if it is not, or</p></li> |
| <li><p>-1 (<code class="docutils literal notranslate"><span class="pre">ERROR</span></code>) if the signal number is invalid.</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.sigaction"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">sigaction</span></code><span class="sig-paren">(</span><span class="pre">int</span> <em><span class="pre">signo</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="#c.sigaction" title="sigaction"><span class="pre">sigaction</span></a> <span class="pre">*</span><em><span class="pre">act</span></em>, <em class="property"><span class="pre">struct</span></em> <a class="reference internal" href="#c.sigaction" title="sigaction"><span class="pre">sigaction</span></a> <span class="pre">*</span><em><span class="pre">oact</span></em><span class="sig-paren">)</span><span class="pre">;</span><a class="headerlink" href="#c.sigaction" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Allows the calling task to examine and/or |
| specify the action to be associated with a specific signal.</p> |
| <p>The structure sigaction, used to describe an action to be taken, is |
| defined to include the following members:</p> |
| <blockquote> |
| <div><ul class="simple"> |
| <li><p><code class="docutils literal notranslate"><span class="pre">sa_u.sa_handler</span></code>. A pointer to a signal-catching function.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">sa_u.sa_sigaction</span></code>. An alternative form for the signal catching |
| function.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">sa_mask</span></code>. Additional set of signals to be blocked during execution |
| of the signal-catching function.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">sa_flags</span></code>: Special flags to affect behavior of a signal.</p></li> |
| </ul> |
| </div></blockquote> |
| <p>If the argument act is not NULL, it points to a structure specifying the |
| action to be associated with the specified signal. If the argument oact |
| is not NULL, the action previously associated with the signal is stored |
| in the location pointed to by the argument oact. If the argument act is |
| NULL, signal handling is unchanged by this function call; thus, the call |
| can be used to inquire about the current handling of a given signal.</p> |
| <p>When a signal is caught by a signal-catching function installed by the |
| sigaction() function, a new signal mask is calculated and installed for |
| the duration of the signal-catching function. This mask is formed by |
| taking the union of the current signal mask and the value of the sa_mask |
| for the signal being delivered, and then including the signal being |
| delivered. If and when the signal handler returns, the original signal |
| mask is restored.</p> |
| <p>Signal catching functions execute in the same address environment as the |
| task that called sigaction() to install the signal-catching function.</p> |
| <p>Once an action is installed for a specific signal, it remains installed |
| until another action is explicitly requested by another call to |
| sigaction().</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>sig</strong> – Signal of interest</p></li> |
| <li><p><strong>act</strong> – Location of new handler</p></li> |
| <li><p><strong>oact</strong> – Location to store old handler</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>), or -1 (<code class="docutils literal notranslate"><span class="pre">ERROR</span></code>) if the signal number is invalid.</p> |
| </dd> |
| </dl> |
| <p><strong>POSIX Compatibility:</strong> Comparable to the POSIX interface of the same |
| name. Differences from the POSIX implementation include:</p> |
| <blockquote> |
| <div><ul class="simple"> |
| <li><p>There are no default actions so the special value <code class="docutils literal notranslate"><span class="pre">SIG_DFL</span></code> is |
| treated like <code class="docutils literal notranslate"><span class="pre">SIG_IGN</span></code>.</p></li> |
| <li><p>All <code class="docutils literal notranslate"><span class="pre">sa_flags</span></code> in struct sigaction of act input are ignored (all |
| treated like <code class="docutils literal notranslate"><span class="pre">SA_SIGINFO</span></code>). The one exception is if |
| <code class="docutils literal notranslate"><span class="pre">CONFIG_SCHED_CHILD_STATUS</span></code> is defined; then <code class="docutils literal notranslate"><span class="pre">SA_NOCLDWAIT</span></code> is |
| supported but only for <code class="docutils literal notranslate"><span class="pre">SIGCHLD</span></code>.</p></li> |
| </ul> |
| </div></blockquote> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.sigignore"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">sigignore</span></code><span class="sig-paren">(</span><span class="pre">int</span> <em><span class="pre">signo</span></em><span class="sig-paren">)</span><span class="pre">;</span><a class="headerlink" href="#c.sigignore" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Sets the disposition of <code class="docutils literal notranslate"><span class="pre">signo</span></code> to <code class="docutils literal notranslate"><span class="pre">SIG_IGN</span></code>.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>signo</strong> – The signal number to act on</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><ul class="simple"> |
| <li><p>Zero is returned upon successful completion, otherwise -1 (<code class="docutils literal notranslate"><span class="pre">ERROR</span></code>) |
| is returned with the errno set appropriately. The <code class="docutils literal notranslate"><span class="pre">errno</span></code> value of |
| <code class="docutils literal notranslate"><span class="pre">EINVAL</span></code>, for example, would indicate that <code class="docutils literal notranslate"><span class="pre">signo</span></code> argument is |
| not a valid signal number.</p></li> |
| </ul> |
| </p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.sigset"> |
| <span class="pre">void</span> <span class="pre">(</span><span class="pre">*</span><code class="sig-name descname"><span class="pre">sigset</span></code><span class="sig-paren">(</span><span class="pre">int</span> <em><span class="pre">signo</span></em>, <span class="pre">void</span> <span class="pre">(</span><span class="pre">*</span><em><span class="pre">disp</span></em><span class="pre">)</span><span class="sig-paren">(</span><span class="pre">int</span><span class="sig-paren">)</span><span class="sig-paren">)</span><span class="pre">)</span><span class="sig-paren">(</span><span class="pre">int</span><span class="sig-paren">)</span><span class="pre">;</span><a class="headerlink" href="#c.sigset" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Modifies signal dispositions. |
| The <code class="docutils literal notranslate"><span class="pre">signo</span></code> argument specifies the signal. The <code class="docutils literal notranslate"><span class="pre">disp</span></code> argument |
| specifies the signal’s disposition, which may be <code class="docutils literal notranslate"><span class="pre">SIG_DFL</span></code>, |
| <code class="docutils literal notranslate"><span class="pre">SIG_IGN</span></code>, or the address of a signal handler. If <code class="docutils literal notranslate"><span class="pre">disp</span></code> is the |
| address of a signal handler, the system will add <code class="docutils literal notranslate"><span class="pre">signo</span></code> to the |
| calling process’s signal mask before executing the signal handler; when |
| the signal handler returns, the system will restore the calling |
| process’s signal mask to its state prior to the delivery of the signal. |
| <code class="docutils literal notranslate"><span class="pre">signo</span></code> will be removed from the calling process’s signal mask.</p> |
| <p>NOTE: The value <code class="docutils literal notranslate"><span class="pre">SIG_HOLD</span></code> for <code class="docutils literal notranslate"><span class="pre">disp</span></code> is not currently supported.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>signo</strong> – The signal number to operate on</p></li> |
| <li><p><strong>disp</strong> – The new disposition of the signal</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><ul class="simple"> |
| <li><p>Upon successful completion, <code class="docutils literal notranslate"><span class="pre">sigset()</span></code> will the previous |
| disposition of the signal. Otherwise, <code class="docutils literal notranslate"><span class="pre">SIG_ERR</span></code> will be returned |
| and <code class="docutils literal notranslate"><span class="pre">errno</span></code> set to indicate the error.</p></li> |
| </ul> |
| </p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.sigprocmask"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">sigprocmask</span></code><span class="sig-paren">(</span><span class="pre">int</span> <em><span class="pre">how</span></em>, <em class="property"><span class="pre">const</span></em> <a class="reference internal" href="structures.html#c.sigset_t" title="sigset_t"><span class="pre">sigset_t</span></a> <span class="pre">*</span><em><span class="pre">set</span></em>, <a class="reference internal" href="structures.html#c.sigset_t" title="sigset_t"><span class="pre">sigset_t</span></a> <span class="pre">*</span><em><span class="pre">oset</span></em><span class="sig-paren">)</span><span class="pre">;</span><a class="headerlink" href="#c.sigprocmask" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Allows the calling task to examine and/or |
| change its signal mask. If the set is not NULL, then it points to a set |
| of signals to be used to change the currently blocked set. The value of |
| how indicates the manner in which the set is changed.</p> |
| <p>If there are any pending unblocked signals after the call to |
| sigprocmask(), those signals will be delivered before sigprocmask() |
| returns.</p> |
| <p>If sigprocmask() fails, the signal mask of the task is not changed.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>how</strong> – How the signal mask will be changed. |
| - <code class="docutils literal notranslate"><span class="pre">SIG_BLOCK</span></code> The resulting set is the union of the current set and the signal set pointed to by the <code class="docutils literal notranslate"><span class="pre">set</span></code> input parameter. |
| - <code class="docutils literal notranslate"><span class="pre">SIG_UNBLOCK</span></code> The resulting set is the intersection of the current set and the complement of the signal set pointed to by the <code class="docutils literal notranslate"><span class="pre">set</span></code> input parameter. |
| - <code class="docutils literal notranslate"><span class="pre">SIG_SETMASK</span></code> The resulting set is the signal set pointed to by the <code class="docutils literal notranslate"><span class="pre">set</span></code> input parameter.</p></li> |
| <li><p><strong>set</strong> – Location of the new signal mask</p></li> |
| <li><p><strong>oset</strong> – Location to store the old signal mask</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>), or -1 (<code class="docutils literal notranslate"><span class="pre">ERROR</span></code>) if how is invalid.</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.sighold"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">sighold</span></code><span class="sig-paren">(</span><span class="pre">int</span> <em><span class="pre">signo</span></em><span class="sig-paren">)</span><span class="pre">;</span><a class="headerlink" href="#c.sighold" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Adds <code class="docutils literal notranslate"><span class="pre">signo</span></code> to the calling process’s signal mask</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>signo</strong> – Identifies the signal to be blocked.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p>Zero is returned upon successful completion, otherwise -1 (<code class="docutils literal notranslate"><span class="pre">ERROR</span></code>) |
| is returned with the errno set appropriately. The <code class="docutils literal notranslate"><span class="pre">errno</span></code> value of |
| <code class="docutils literal notranslate"><span class="pre">EINVAL</span></code>, for example, would indicate that <code class="docutils literal notranslate"><span class="pre">signo</span></code> argument is |
| not a valid signal number.</p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.sigrelse"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">sigrelse</span></code><span class="sig-paren">(</span><span class="pre">int</span> <em><span class="pre">signo</span></em><span class="sig-paren">)</span><span class="pre">;</span><a class="headerlink" href="#c.sigrelse" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Removes <code class="docutils literal notranslate"><span class="pre">signo</span></code> from the calling process’s signal mask</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>signo</strong> – Identifies the signal to be unblocked.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p>Zero is returned upon successful completion, otherwise -1 (<code class="docutils literal notranslate"><span class="pre">ERROR</span></code>) |
| is returned with the errno set appropriately. The <code class="docutils literal notranslate"><span class="pre">errno</span></code> value of |
| <code class="docutils literal notranslate"><span class="pre">EINVAL</span></code>, for example, would indicate that <code class="docutils literal notranslate"><span class="pre">signo</span></code> argument is |
| not a valid signal number.</p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.sigpending"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">sigpending</span></code><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.sigset_t" title="sigset_t"><span class="pre">sigset_t</span></a> <span class="pre">*</span><em><span class="pre">set</span></em><span class="sig-paren">)</span><span class="pre">;</span><a class="headerlink" href="#c.sigpending" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Stores the returns the set of signals |
| that are blocked for delivery and that are pending for the calling task |
| in the space pointed to by set.</p> |
| <p>If the task receiving a signal has the signal blocked via its |
| sigprocmask, the signal will pend until it is unmasked. Only one pending |
| signal (for a given signo) is retained by the system. This is consistent |
| with POSIX which states: “If a subsequent occurrence of a pending signal |
| is generated, it is implementation defined as to whether the signal is |
| delivered more than once.”</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>set</strong> – The location to return the pending signal set.</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>) 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.</p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.sigsuspend"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">sigsuspend</span></code><span class="sig-paren">(</span><em class="property"><span class="pre">const</span></em> <a class="reference internal" href="structures.html#c.sigset_t" title="sigset_t"><span class="pre">sigset_t</span></a> <span class="pre">*</span><em><span class="pre">set</span></em><span class="sig-paren">)</span><span class="pre">;</span><a class="headerlink" href="#c.sigsuspend" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Replaces the signal mask with |
| the set of signals pointed to by the argument set and then suspends the |
| task until delivery of a signal to the task.</p> |
| <p>If the effect of the set argument is to unblock a pending signal, then |
| no wait is performed.</p> |
| <p>The original signal mask is restored when sigsuspend() returns.</p> |
| <p>Waiting for an empty signal set stops a task without freeing any |
| resources (a very bad idea).</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>set</strong> – The value of the signal <strong>mask</strong> to use while suspended.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p>-1 (<code class="docutils literal notranslate"><span class="pre">ERROR</span></code>) always</p> |
| </dd> |
| </dl> |
| <p><strong>POSIX Compatibility:</strong> Comparable to the POSIX interface of the same |
| name. Differences from the POSIX specification include:</p> |
| <ul class="simple"> |
| <li><p>POSIX does not indicate that the original signal mask is restored.</p></li> |
| <li><p>POSIX states that sigsuspend() “suspends the task until delivery of a |
| signal whose action is either to execute a signal-catching function |
| or to terminate the task.” Only delivery of the signal is required in |
| the present implementation (even if the signal is ignored).</p></li> |
| </ul> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.sigpause"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">sigpause</span></code><span class="sig-paren">(</span><span class="pre">int</span> <em><span class="pre">signo</span></em><span class="sig-paren">)</span><span class="pre">;</span><a class="headerlink" href="#c.sigpause" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Removes <code class="docutils literal notranslate"><span class="pre">signo</span></code> from the calling process’s signal mask and suspend the calling process |
| until a signal is received. The <code class="docutils literal notranslate"><span class="pre">sigpause()</span></code>) function will restore |
| the process’s signal mask to its original state before returning.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>set</strong> – Identifies the signal to be unblocked while waiting.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">sigpause</span></code> always returns -1 (<code class="docutils literal notranslate"><span class="pre">ERROR</span></code>). On a successful wait for |
| a signal, the <code class="docutils literal notranslate"><span class="pre">errno</span></code> will be set to <code class="docutils literal notranslate"><span class="pre">EINTR</span></code>.</p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.sigwaitinfo"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">sigwaitinfo</span></code><span class="sig-paren">(</span><em class="property"><span class="pre">const</span></em> <a class="reference internal" href="structures.html#c.sigset_t" title="sigset_t"><span class="pre">sigset_t</span></a> <span class="pre">*</span><em><span class="pre">set</span></em>, <em class="property"><span class="pre">struct</span></em> <a class="reference internal" href="structures.html#c.siginfo" title="siginfo"><span class="pre">siginfo</span></a> <span class="pre">*</span><em><span class="pre">info</span></em><span class="sig-paren">)</span><span class="pre">;</span><a class="headerlink" href="#c.sigwaitinfo" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <p>Equivalent to sigtimedwait() with a NULL timeout parameter. (see below).</p> |
| <blockquote> |
| <div><dl class="field-list simple"> |
| <dt class="field-odd">param set</dt> |
| <dd class="field-odd"><p>The set of pending signals to wait for.</p> |
| </dd> |
| <dt class="field-even">param info</dt> |
| <dd class="field-even"><p>The returned signal values</p> |
| </dd> |
| <dt class="field-odd">return</dt> |
| <dd class="field-odd"><p>Signal number that cause the wait to be terminated, otherwise -1 |
| (<code class="docutils literal notranslate"><span class="pre">ERROR</span></code>) is returned.</p> |
| </dd> |
| </dl> |
| <p><strong>POSIX Compatibility:</strong> Comparable to the POSIX interface of the same |
| name.</p> |
| </div></blockquote> |
| <dl class="c function"> |
| <dt id="c.sigtimedwait"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">sigtimedwait</span></code><span class="sig-paren">(</span><em class="property"><span class="pre">const</span></em> <a class="reference internal" href="structures.html#c.sigset_t" title="sigset_t"><span class="pre">sigset_t</span></a> <span class="pre">*</span><em><span class="pre">set</span></em>, <em class="property"><span class="pre">struct</span></em> <a class="reference internal" href="structures.html#c.siginfo" title="siginfo"><span class="pre">siginfo</span></a> <span class="pre">*</span><em><span class="pre">info</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">timeout</span></em><span class="sig-paren">)</span><span class="pre">;</span><a class="headerlink" href="#c.sigtimedwait" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Selects the pending signal set specified |
| by the argument set. If multiple signals are pending in set, it will |
| remove and return the lowest numbered one. If no signals in set are |
| pending at the time of the call, the calling task will be suspended |
| until one of the signals in set becomes pending OR until the task |
| interrupted by an unblocked signal OR until the time interval specified |
| by timeout (if any), has expired. If timeout is NULL, then the timeout |
| interval is forever.</p> |
| <p>If the info argument is non-NULL, the selected signal number is stored |
| in the si_signo member and the cause of the signal is store in the |
| si_code member. The content of si_value is only meaningful if the signal |
| was generated by sigqueue(). The following values for si_code are |
| defined in signal.h:</p> |
| <ul class="simple"> |
| <li><p><code class="docutils literal notranslate"><span class="pre">SI_USER</span></code>. Signal sent from kill, raise, or abort</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">SI_QUEUE</span></code>. Signal sent from sigqueue</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">SI_TIMER</span></code>. Signal is result of timer expiration</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">SI_ASYNCIO</span></code>. Signal is the result of asynchronous IO completion</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">SI_MESGQ</span></code>. Signal generated by arrival of a message on an empty |
| message queue.</p></li> |
| </ul> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>set</strong> – The set of pending signals to wait for.</p></li> |
| <li><p><strong>info</strong> – The returned signal values</p></li> |
| <li><p><strong>timeout</strong> – The amount of time to wait</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p>Signal number that cause the wait to be terminated, otherwise -1 |
| (<code class="docutils literal notranslate"><span class="pre">ERROR</span></code>) is returned.</p> |
| </dd> |
| </dl> |
| <p><strong>POSIX Compatibility:</strong> Comparable to the POSIX interface of the same |
| name. Differences from the POSIX interface include:</p> |
| <ul class="simple"> |
| <li><p>Values for si_codes differ</p></li> |
| <li><p>No mechanism to return cause of ERROR. (It can be inferred from |
| si_code in a non-standard way).</p></li> |
| <li><p>POSIX states that “If no signal is pending at the time of the call, |
| the calling task will be suspended until one or more signals in set |
| become pending or until it is interrupted by an unblocked, <em>caught</em> |
| signal.” The present implementation does not require that the |
| unblocked signal be caught; the task will be resumed even if the |
| unblocked signal is ignored.</p></li> |
| </ul> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.sigqueue"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">sigqueue</span></code><span class="sig-paren">(</span><span class="pre">int</span> <em><span class="pre">tid</span></em>, <span class="pre">int</span> <em><span class="pre">signo</span></em>, <em class="property"><span class="pre">union</span></em> <a class="reference internal" href="structures.html#c.sigval" title="sigval"><span class="pre">sigval</span></a> <em><span class="pre">value</span></em><span class="sig-paren">)</span><span class="pre">;</span><a class="headerlink" href="#c.sigqueue" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Sends the signal specified by signo with |
| the signal parameter value to the task specified by tid.</p> |
| <p>If the receiving task has the signal blocked via its sigprocmask, the |
| signal will pend until it is unmasked. Only one pending signal (for a |
| given signo) is retained by the system. This is consistent with POSIX |
| which states: “If a subsequent occurrence of a pending signal is |
| generated, it is implementation defined as to whether the signal is |
| delivered more than once.”</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>tid</strong> – ID of the task to receive signal</p></li> |
| <li><p><strong>signo</strong> – Signal number</p></li> |
| <li><p><strong>value</strong> – Value to pass to task with signal</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><p>On success (at least one signal was sent), zero (<code class="docutils literal notranslate"><span class="pre">OK</span></code>) is returned. |
| On error, -1 (<code class="docutils literal notranslate"><span class="pre">ERROR</span></code>) is returned, and |
| <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">EGAIN</span></code>. The limit of signals which may be queued has been |
| reached.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">EINVAL</span></code>. signo was invalid.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">EPERM</span></code>. The task does not have permission to send the signal to |
| the receiving process.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">ESRCH</span></code>. No process has a PID matching pid.</p></li> |
| </ul> |
| </p> |
| </dd> |
| </dl> |
| <p><strong>POSIX Compatibility:</strong> Comparable to the POSIX interface of the same |
| name. Differences from the POSIX interface include:</p> |
| <ul class="simple"> |
| <li><p>Default action is to ignore signals.</p></li> |
| <li><p>Signals are processed one at a time in order</p></li> |
| <li><p>POSIX states that, “If signo is zero (the null signal), error |
| checking will be performed but no signal is actually sent.” There is |
| no null signal in the present implementation; a zero signal will be |
| sent.</p></li> |
| </ul> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.kill"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">kill</span></code><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.pid_t" title="pid_t"><span class="pre">pid_t</span></a> <em><span class="pre">pid</span></em>, <span class="pre">int</span> <em><span class="pre">sig</span></em><span class="sig-paren">)</span><span class="pre">;</span><a class="headerlink" href="#c.kill" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>The kill() system call can be used to send any signal |
| to any task.</p> |
| <p>If the receiving task has the signal blocked via its sigprocmask, the |
| signal will pend until it is unmasked. Only one pending signal (for a |
| given signo) is retained by the system. This is consistent with POSIX |
| which states: “If a subsequent occurrence of a pending signal is |
| generated, it is implementation defined as to whether the signal is |
| delivered more than once.”</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>pid</strong> – The id of the task to receive the signal. The POSIX |
| <code class="docutils literal notranslate"><span class="pre">kill()</span></code> specification encodes process group information as zero |
| and negative pid values. Only positive, non-zero values of pid are |
| supported by this implementation. ID of the task to receive signal</p></li> |
| <li><p><strong>signo</strong> – The signal number to send. If signo is zero, no signal is |
| sent, but all error checking is performed.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p>OK or ERROR</p> |
| </dd> |
| </dl> |
| <p><strong>POSIX Compatibility:</strong> Comparable to the POSIX interface of the same |
| name. Differences from the POSIX interface include:</p> |
| <ul class="simple"> |
| <li><p>Default action is to ignore signals.</p></li> |
| <li><p>Signals are processed one at a time in order</p></li> |
| <li><p>Sending of signals to ‘process groups’ is not supported in NuttX.</p></li> |
| </ul> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.pause"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">pause</span></code><span class="sig-paren">(</span><span class="pre">void</span><span class="sig-paren">)</span><span class="pre">;</span><a class="headerlink" href="#c.pause" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Suspends the calling thread until delivery of a non-blocked signal.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Returns</dt> |
| <dd class="field-odd"><p>Since <code class="docutils literal notranslate"><span class="pre">pause()</span></code> suspends thread execution |
| indefinitely unless interrupted a signal, there is no successful |
| completion return value. A value of -1 (<code class="docutils literal notranslate"><span class="pre">ERROR</span></code> will always be |
| returned and errno set to indicate the error (<code class="docutils literal notranslate"><span class="pre">EINTR</span></code>).</p> |
| </dd> |
| </dl> |
| <p><strong>POSIX Compatibility:</strong> In the POSIX description of this function is |
| the <code class="docutils literal notranslate"><span class="pre">pause()</span></code> function will suspend the calling thread until delivery |
| of a signal whose action is either to execute a signal-catching function |
| or to terminate the process. This implementation only waits for any |
| non-blocked signal to be received.</p> |
| </dd></dl> |
| |
| </div> |
| |
| |
| </div> |
| |
| </div> |
| <footer> |
| <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> |
| <a href="08_pthread.html" class="btn btn-neutral float-right" title="Pthread Interfaces" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a> |
| <a href="06_clocks_timers.html" class="btn btn-neutral float-left" title="Clocks and Timers" 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> |