| <!-- |
| 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>Task Control 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="Task Scheduling Interfaces" href="02_task_scheduling.html" /> |
| <link rel="prev" title="Userspace API" href="index.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 current"><a class="current reference internal" href="#">Task Control Interfaces</a><ul> |
| <li class="toctree-l4"><a class="reference internal" href="#functions">Functions</a></li> |
| </ul> |
| </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"><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>Task Control Interfaces</li> |
| |
| |
| <li class="wy-breadcrumbs-aside"> |
| |
| |
| <a href="../../_sources/reference/user/01_task_control.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="task-control-interfaces"> |
| <h1>Task Control Interfaces<a class="headerlink" href="#task-control-interfaces" title="Permalink to this headline">¶</a></h1> |
| <p><strong>Tasks</strong>. NuttX is a flat address OS. As such it does not support |
| <em>processes</em> in the way that, say, Linux does. NuttX only supports simple |
| threads running within the same address space. However, the programming |
| model makes a distinction between <em>tasks</em> and <em>pthreads</em>:</p> |
| <blockquote> |
| <div><ul class="simple"> |
| <li><p><em>tasks</em> are threads which have a degree of independence</p></li> |
| <li><p><a class="reference external" href="#Pthread">pthreads</a> share some resources.</p></li> |
| </ul> |
| </div></blockquote> |
| <p><strong>File Descriptors and Streams</strong>. This applies, in particular, in the |
| area of opened file descriptors and streams. When a task is started |
| using the interfaces in this section, it will be created with at most |
| three open files.</p> |
| <p>If <code class="docutils literal notranslate"><span class="pre">CONFIG_DEV_CONSOLE</span></code> is defined, the first three file descriptors |
| (corresponding to stdin, stdout, stderr) will be duplicated for the new |
| task. Since these file descriptors are duplicated, the child task can |
| free close them or manipulate them in any way without effecting the |
| parent task. File-related operations (open, close, etc.) within a task |
| will have no effect on other tasks. Since the three file descriptors are |
| duplicated, it is also possible to perform some level of redirection.</p> |
| <p>pthreads, on the other hand, will always share file descriptors with the |
| parent thread. In this case, file operations will have effect only all |
| pthreads the were started from the same parent thread.</p> |
| <p><strong>Executing Programs within a File System</strong>. NuttX also provides |
| internal interfaces for the execution of separately built programs that |
| reside in a file system. These internal interfaces are, however, |
| non-standard and are documented with the NuttX binary |
| loader and NXFLAT documentation.</p> |
| <p><strong>Task Control Interfaces</strong>. The following task control interfaces are |
| provided by NuttX:</p> |
| <div class="admonition note"> |
| <p class="admonition-title">Note</p> |
| <p>Maybe this can be converted into a table, or could otherwise |
| be replaced by the index if these are sectioned in this way.</p> |
| </div> |
| <p>Non-standard task control interfaces inspired by VxWorks interfaces:</p> |
| <blockquote> |
| <div><ul class="simple"> |
| <li><p><a class="reference internal" href="#c.task_create" title="task_create"><code class="xref c c-func docutils literal notranslate"><span class="pre">task_create()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.task_delete" title="task_delete"><code class="xref c c-func docutils literal notranslate"><span class="pre">task_delete()</span></code></a></p></li> |
| <li><p><code class="xref c c-func docutils literal notranslate"><span class="pre">task_restart()</span></code></p></li> |
| </ul> |
| </div></blockquote> |
| <p>Non-standard extensions to VxWorks-like interfaces to support POSIX |
| <a class="reference external" href="https://cwiki.apache.org/confluence/display/NUTTX/Cancellation+Points">Cancellation |
| Points</a>.</p> |
| <blockquote> |
| <div><ul class="simple"> |
| <li><p><a class="reference internal" href="#c.task_setcancelstate" title="task_setcancelstate"><code class="xref c c-func docutils literal notranslate"><span class="pre">task_setcancelstate()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.task_setcanceltype" title="task_setcanceltype"><code class="xref c c-func docutils literal notranslate"><span class="pre">task_setcanceltype()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.task_testcancel" title="task_testcancel"><code class="xref c c-func docutils literal notranslate"><span class="pre">task_testcancel()</span></code></a></p></li> |
| </ul> |
| </div></blockquote> |
| <p>Standard interfaces</p> |
| <blockquote> |
| <div><ul class="simple"> |
| <li><p><a class="reference internal" href="#c.exit" title="exit"><code class="xref c c-func docutils literal notranslate"><span class="pre">exit()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.getpid" title="getpid"><code class="xref c c-func docutils literal notranslate"><span class="pre">getpid()</span></code></a></p></li> |
| </ul> |
| </div></blockquote> |
| <p>Standard <code class="docutils literal notranslate"><span class="pre">vfork</span></code> and <code class="docutils literal notranslate"><span class="pre">exec[v|l]</span></code> interfaces:</p> |
| <blockquote> |
| <div><ul class="simple"> |
| <li><p><a class="reference internal" href="#c.vfork" title="vfork"><code class="xref c c-func docutils literal notranslate"><span class="pre">vfork()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.exec" title="exec"><code class="xref c c-func docutils literal notranslate"><span class="pre">exec()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.execv" title="execv"><code class="xref c c-func docutils literal notranslate"><span class="pre">execv()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.execl" title="execl"><code class="xref c c-func docutils literal notranslate"><span class="pre">execl()</span></code></a></p></li> |
| </ul> |
| </div></blockquote> |
| <p>Standard <code class="docutils literal notranslate"><span class="pre">posix_spawn</span></code> interfaces:</p> |
| <blockquote> |
| <div><ul class="simple"> |
| <li><p><a class="reference internal" href="#c.posix_spawn" title="posix_spawn"><code class="xref c c-func docutils literal notranslate"><span class="pre">posix_spawn()</span></code></a> and <a class="reference internal" href="#c.posix_spawnp" title="posix_spawnp"><code class="xref c c-func docutils literal notranslate"><span class="pre">posix_spawnp()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.posix_spawn_file_actions_init" title="posix_spawn_file_actions_init"><code class="xref c c-func docutils literal notranslate"><span class="pre">posix_spawn_file_actions_init()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.posix_spawn_file_actions_destroy" title="posix_spawn_file_actions_destroy"><code class="xref c c-func docutils literal notranslate"><span class="pre">posix_spawn_file_actions_destroy()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.posix_spawn_file_actions_addclose" title="posix_spawn_file_actions_addclose"><code class="xref c c-func docutils literal notranslate"><span class="pre">posix_spawn_file_actions_addclose()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.posix_spawn_file_actions_adddup2" title="posix_spawn_file_actions_adddup2"><code class="xref c c-func docutils literal notranslate"><span class="pre">posix_spawn_file_actions_adddup2()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.posix_spawn_file_actions_addopen" title="posix_spawn_file_actions_addopen"><code class="xref c c-func docutils literal notranslate"><span class="pre">posix_spawn_file_actions_addopen()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.posix_spawnattr_init" title="posix_spawnattr_init"><code class="xref c c-func docutils literal notranslate"><span class="pre">posix_spawnattr_init()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.posix_spawnattr_getflags" title="posix_spawnattr_getflags"><code class="xref c c-func docutils literal notranslate"><span class="pre">posix_spawnattr_getflags()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.posix_spawnattr_getschedparam" title="posix_spawnattr_getschedparam"><code class="xref c c-func docutils literal notranslate"><span class="pre">posix_spawnattr_getschedparam()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.posix_spawnattr_getschedpolicy" title="posix_spawnattr_getschedpolicy"><code class="xref c c-func docutils literal notranslate"><span class="pre">posix_spawnattr_getschedpolicy()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.posix_spawnattr_getsigmask" title="posix_spawnattr_getsigmask"><code class="xref c c-func docutils literal notranslate"><span class="pre">posix_spawnattr_getsigmask()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.posix_spawnattr_setflags" title="posix_spawnattr_setflags"><code class="xref c c-func docutils literal notranslate"><span class="pre">posix_spawnattr_setflags()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.posix_spawnattr_setschedparam" title="posix_spawnattr_setschedparam"><code class="xref c c-func docutils literal notranslate"><span class="pre">posix_spawnattr_setschedparam()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.posix_spawnattr_setschedpolicy" title="posix_spawnattr_setschedpolicy"><code class="xref c c-func docutils literal notranslate"><span class="pre">posix_spawnattr_setschedpolicy()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.posix_spawnattr_setsigmask" title="posix_spawnattr_setsigmask"><code class="xref c c-func docutils literal notranslate"><span class="pre">posix_spawnattr_setsigmask()</span></code></a></p></li> |
| </ul> |
| </div></blockquote> |
| <p>Non-standard task control interfaces inspired by <code class="docutils literal notranslate"><span class="pre">posix_spawn</span></code>:</p> |
| <blockquote> |
| <div><ul class="simple"> |
| <li><p><a class="reference internal" href="#c.task_spawn" title="task_spawn"><code class="xref c c-func docutils literal notranslate"><span class="pre">task_spawn()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.task_spawnattr_getstacksize" title="task_spawnattr_getstacksize"><code class="xref c c-func docutils literal notranslate"><span class="pre">task_spawnattr_getstacksize()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.task_spawnattr_setstacksize" title="task_spawnattr_setstacksize"><code class="xref c c-func docutils literal notranslate"><span class="pre">task_spawnattr_setstacksize()</span></code></a></p></li> |
| <li><p><a class="reference internal" href="#c.posix_spawn_file_actions_init" title="posix_spawn_file_actions_init"><code class="xref c c-func docutils literal notranslate"><span class="pre">posix_spawn_file_actions_init()</span></code></a></p></li> |
| </ul> |
| </div></blockquote> |
| <div class="section" id="functions"> |
| <h2>Functions<a class="headerlink" href="#functions" title="Permalink to this headline">¶</a></h2> |
| <dl class="c function"> |
| <dt id="c.task_create"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">task_create</span></code><span class="sig-paren">(</span><span class="pre">char</span> <span class="pre">*</span><em><span class="pre">name</span></em>, <span class="pre">int</span> <em><span class="pre">priority</span></em>, <span class="pre">int</span> <em><span class="pre">stack_size</span></em>, <a class="reference internal" href="structures.html#c.main_t" title="main_t"><span class="pre">main_t</span></a> <em><span class="pre">entry</span></em>, <span class="pre">char</span> <span class="pre">*</span><em class="property"><span class="pre">const</span></em> <em><span class="pre">argv</span></em><span class="pre">[</span><span class="pre">]</span><span class="sig-paren">)</span><a class="headerlink" href="#c.task_create" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>This function creates and activates a new task with a |
| specified priority and returns its system-assigned ID.</p> |
| <p>The entry address entry is the address of the “main” function of the |
| task. This function will be called once the C environment has been set |
| up. The specified function will be called with four arguments. Should |
| the specified routine return, a call to <a class="reference internal" href="#c.exit" title="exit"><code class="xref c c-func docutils literal notranslate"><span class="pre">exit()</span></code></a> will automatically be |
| made.</p> |
| <p>Note that an arbitrary number of arguments may be passed to the spawned |
| functions.</p> |
| <p>The arguments are copied (via <code class="docutils literal notranslate"><span class="pre">strdup</span></code>) so that the life of the passed |
| strings is not dependent on the life of the caller to <a class="reference internal" href="#c.task_create" title="task_create"><code class="xref c c-func docutils literal notranslate"><span class="pre">task_create()</span></code></a>.</p> |
| <p>The newly created task does not inherit scheduler characteristics from |
| the parent task: The new task is started at the default system priority |
| and with the <code class="docutils literal notranslate"><span class="pre">SCHED_FIFO</span></code> scheduling policy. These characteristics may be |
| modified after the new task has been started.</p> |
| <p>The newly created task does inherit the first three file descriptors |
| (corresponding to stdin, stdout, and stderr) and redirection of standard |
| I/O is supported.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>name</strong> – Name of the new task</p></li> |
| <li><p><strong>priority</strong> – Priority of the new task</p></li> |
| <li><p><strong>stack_size</strong> – size (in bytes) of the stack needed</p></li> |
| <li><p><strong>entry</strong> – Entry point of a new task</p></li> |
| <li><p><strong>argv</strong> – A pointer to an array of input parameters. The array should |
| be terminated with a NULL argv[] value. If no parameters are |
| required, argv may be NULL.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p>the non-zero task ID of the new task or ERROR if memory is |
| insufficient or the task cannot be created |
| (<code class="docutils literal notranslate"><span class="pre">`errno</span></code> <#ErrnoAccess>`__ is not set).</p> |
| </dd> |
| </dl> |
| <p><strong>Defined in:</strong> <code class="docutils literal notranslate"><span class="pre">sched.h</span></code></p> |
| <p><strong>POSIX Compatibility:</strong> This is a NON-POSIX interface. VxWorks provides |
| the following similar interface:</p> |
| <div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="kt">int</span> <span class="nf">taskSpawn</span><span class="p">(</span><span class="kt">char</span> <span class="o">*</span><span class="n">name</span><span class="p">,</span> <span class="kt">int</span> <span class="n">priority</span><span class="p">,</span> <span class="kt">int</span> <span class="n">options</span><span class="p">,</span> <span class="kt">int</span> <span class="n">stackSize</span><span class="p">,</span> <span class="n">FUNCPTR</span> <span class="n">entryPt</span><span class="p">,</span> |
| <span class="kt">int</span> <span class="n">arg1</span><span class="p">,</span> <span class="kt">int</span> <span class="n">arg2</span><span class="p">,</span> <span class="kt">int</span> <span class="n">arg3</span><span class="p">,</span> <span class="kt">int</span> <span class="n">arg4</span><span class="p">,</span> <span class="kt">int</span> <span class="n">arg5</span><span class="p">,</span> |
| <span class="kt">int</span> <span class="n">arg6</span><span class="p">,</span> <span class="kt">int</span> <span class="n">arg7</span><span class="p">,</span> <span class="kt">int</span> <span class="n">arg8</span><span class="p">,</span> <span class="kt">int</span> <span class="n">arg9</span><span class="p">,</span> <span class="kt">int</span> <span class="n">arg10</span><span class="p">);</span> |
| </pre></div> |
| </div> |
| <p>The NuttX <a class="reference internal" href="#c.task_create" title="task_create"><code class="xref c c-func docutils literal notranslate"><span class="pre">task_create()</span></code></a> differs from VxWorks’ <code class="xref c c-func docutils literal notranslate"><span class="pre">taskSpawn()</span></code> in the |
| following ways:</p> |
| <blockquote> |
| <div><ul class="simple"> |
| <li><p>Interface name</p></li> |
| <li><p>Various differences in types of arguments</p></li> |
| <li><p>There is no options argument.</p></li> |
| <li><p>A variable number of parameters can be passed to a task (VxWorks |
| supports ten).</p></li> |
| </ul> |
| </div></blockquote> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.task_delete"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">task_delete</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="sig-paren">)</span><a class="headerlink" href="#c.task_delete" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>This function causes a specified task to cease to |
| exist. Its stack and TCB will be deallocated. This function is the |
| companion to <code class="docutils literal notranslate"><span class="pre">task_create()</span></code>. This is the version of the function |
| exposed to the user; it is simply a wrapper around the internal, |
| <code class="docutils literal notranslate"><span class="pre">nxtask_terminate()</span></code> function.</p> |
| <p>The logic in this function only deletes non-running tasks. If the |
| <code class="docutils literal notranslate"><span class="pre">pid</span></code> parameter refers to the currently running task, then processing |
| is redirected to <code class="docutils literal notranslate"><span class="pre">exit()</span></code>. This can only happen if a task calls |
| <code class="docutils literal notranslate"><span class="pre">task_delete()</span></code> in order to delete itself.</p> |
| <p>This function obeys the semantics of pthread cancellation: task deletion |
| is deferred if cancellation is disabled or if deferred cancellation is |
| supported (with <a class="reference external" href="https://cwiki.apache.org/confluence/display/NUTTX/Cancellation+Points">Cancellation |
| Points</a> |
| enabled).</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 task ID of the task to delete. An ID of zero signifies |
| the calling task. Any attempt by the calling task will be |
| automatically re-directed to <code class="docutils literal notranslate"><span class="pre">exit()</span></code>.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">OK</span></code>, or <code class="docutils literal notranslate"><span class="pre">ERROR</span></code> if the task cannot be deleted. The |
| <code class="docutils literal notranslate"><span class="pre">`errno</span></code> <#ErrnoAccess>`__ is set to indicate the nature of the |
| failure. This function can fail, for example, if the provided pid |
| does not correspond to a currently executing task.</p> |
| </dd> |
| </dl> |
| <p><strong>Assumptions/Limitations:</strong></p> |
| <p><code class="docutils literal notranslate"><span class="pre">task_delete()</span></code> must be used with caution: If the task holds resources |
| (for example, allocated memory or semaphores needed by other tasks), |
| then <code class="docutils literal notranslate"><span class="pre">task_delete()</span></code> can strand those resources.</p> |
| <p><strong>POSIX Compatibility:</strong> This is a NON-POSIX interface. VxWorks provides |
| the following similar interface:</p> |
| <p>The NuttX task_delete() differs from VxWorks’ taskDelete() in the |
| following ways:</p> |
| <ul class="simple"> |
| <li><p>No support is provided for calling the tasks deletion routines |
| (because the VxWorks <code class="docutils literal notranslate"><span class="pre">taskDeleteHookAdd()</span></code> is not supported). |
| However, if <code class="docutils literal notranslate"><span class="pre">atexit()</span></code> or <code class="docutils literal notranslate"><span class="pre">on_exit</span></code> support is enabled, those |
| will be called when the task deleted.</p></li> |
| <li><p>Deletion of self is supported, but only because <code class="docutils literal notranslate"><span class="pre">task_delete()</span></code> |
| will re-direct processing to <code class="docutils literal notranslate"><span class="pre">exit()</span></code>.</p></li> |
| </ul> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.task_setcancelstate"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">task_setcancelstate</span></code><span class="sig-paren">(</span><span class="pre">int</span> <em><span class="pre">state</span></em>, <span class="pre">int</span> <span class="pre">*</span><em><span class="pre">oldstate</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.task_setcancelstate" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>This function atomically sets |
| both the calling task’s cancellability state to the indicated state and |
| returns the previous cancellability state at the location referenced by |
| oldstate. Legal values for state are TASK_CANCEL_ENABLE and |
| TASK_CANCEL_DISABLE.</p> |
| <p>Any pending thread cancellation may occur at the time that the |
| cancellation state is set to TASK_CANCEL_ENABLE.</p> |
| <p>The cancellability state and type of any newly created tasks are |
| TASK_CANCEL_ENABLE and TASK_CANCEL_DEFERRED respectively.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>state</strong> – New cancellation state. One of PTHREAD_CANCEL_ENABLE or |
| PTHREAD_CANCEL_DISABLE.</p></li> |
| <li><p><strong>oldstate</strong> – Location to return the previous cancellation state.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><p>Zero (<code class="docutils literal notranslate"><span class="pre">OK</span></code>) on success; <code class="docutils literal notranslate"><span class="pre">ERROR</span></code> is returned on any failure |
| with the <code class="docutils literal notranslate"><span class="pre">errno</span></code> value set appropriately:</p> |
| <blockquote> |
| <div><ul class="simple"> |
| <li><p><code class="docutils literal notranslate"><span class="pre">ESRCH</span></code>. No thread could be found corresponding to that specified |
| by the given thread ID.</p></li> |
| </ul> |
| </div></blockquote> |
| </p> |
| </dd> |
| </dl> |
| <p><strong>POSIX Compatibility:</strong> This is a non-standard interface. It extends |
| the functionality of <code class="docutils literal notranslate"><span class="pre">pthread_setcancelstate()</span></code> to tasks and supports |
| use of <code class="docutils literal notranslate"><span class="pre">task_delete()</span></code>.</p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.task_setcanceltype"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">task_setcanceltype</span></code><span class="sig-paren">(</span><span class="pre">int</span> <em><span class="pre">type</span></em>, <span class="pre">FAR</span> <span class="pre">int</span> <span class="pre">*</span><em><span class="pre">oldtype</span></em><span class="sig-paren">)</span><span class="pre">;</span><a class="headerlink" href="#c.task_setcanceltype" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>This function atomically both |
| sets the calling task’s cancellability type to the indicated type and |
| returns the previous cancellability type at the location referenced by |
| <code class="docutils literal notranslate"><span class="pre">oldtype</span></code>. Legal values for type are <code class="docutils literal notranslate"><span class="pre">TASK_CANCEL_DEFERRED</span></code> and |
| <code class="docutils literal notranslate"><span class="pre">TASK_CANCEL_ASYNCHRONOUS</span></code>.</p> |
| <p>The cancellability state and type of any newly created tasks are |
| <code class="docutils literal notranslate"><span class="pre">TASK_CANCEL_ENABLE</span></code> and <code class="docutils literal notranslate"><span class="pre">TASK_CANCEL_DEFERRED</span></code> respectively.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>type</strong> – New cancellation state. One of <code class="docutils literal notranslate"><span class="pre">PTHREAD_CANCEL_DEFERRED</span></code> |
| or <code class="docutils literal notranslate"><span class="pre">PTHREAD_CANCEL_ASYNCHRONOUS</span></code>.</p></li> |
| <li><p><strong>oldtype</strong> – Location to return the previous cancellation type.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><p>Zero (<code class="docutils literal notranslate"><span class="pre">OK</span></code>) on success; <code class="docutils literal notranslate"><span class="pre">ERROR</span></code> is returned on any failure with the |
| <code class="docutils literal notranslate"><span class="pre">errno</span></code> value set appropriately:</p> |
| <ul class="simple"> |
| <li><p><code class="docutils literal notranslate"><span class="pre">ESRCH</span></code>. No thread could be found corresponding to that specified |
| by the given thread ID.</p></li> |
| </ul> |
| </p> |
| </dd> |
| </dl> |
| <p><strong>POSIX Compatibility:</strong> This is a non-standard interface. It extends |
| the functionality of <code class="docutils literal notranslate"><span class="pre">pthread_setcanceltype()</span></code> to tasks and supports |
| use of <code class="docutils literal notranslate"><span class="pre">task_delete()</span></code>.</p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.task_testcancel"> |
| <span class="pre">void</span> <code class="sig-name descname"><span class="pre">task_testcancel</span></code><span class="sig-paren">(</span><span class="pre">void</span><span class="sig-paren">)</span><a class="headerlink" href="#c.task_testcancel" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Creates a <a class="reference external" href="https://cwiki.apache.org/confluence/display/NUTTX/Cancellation+Points">Cancellation |
| Point</a> |
| in the calling task. The <code class="docutils literal notranslate"><span class="pre">task_testcancel()</span></code> function has no effect if |
| cancellability is disabled.</p> |
| <p><strong>POSIX Compatibility:</strong> This is a non-standard interface. It extends |
| the functionality of <code class="docutils literal notranslate"><span class="pre">pthread_testcancel()</span></code> to tasks and supports use |
| of <code class="docutils literal notranslate"><span class="pre">task_delete()</span></code>.</p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.exit"> |
| <span class="pre">void</span> <code class="sig-name descname"><span class="pre">exit</span></code><span class="sig-paren">(</span><span class="pre">int</span> <em><span class="pre">code</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.exit" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c._exit"> |
| <span class="pre">void</span> <code class="sig-name descname"><span class="pre">_exit</span></code><span class="sig-paren">(</span><span class="pre">int</span> <em><span class="pre">code</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c._exit" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Causes the calling task to cease to exist |
| – its stack and TCB will be deallocated. exit differs from _exit in |
| that it flushes streams, closes file descriptors and will execute any |
| function registered with <code class="docutils literal notranslate"><span class="pre">atexit()</span></code> or <code class="docutils literal notranslate"><span class="pre">on_exit()</span></code>.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>code</strong> – (ignored)</p></li> |
| </ul> |
| </dd> |
| </dl> |
| <p><strong>POSIX Compatibility:</strong> This is equivalent to the ANSI interface:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>void exit(int code); |
| </pre></div> |
| </div> |
| <p>And the UNIX interface:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>void _exit(int code); |
| </pre></div> |
| </div> |
| <p>The NuttX exit() differs from ANSI exit() in the following ways:</p> |
| <blockquote> |
| <div><ul class="simple"> |
| <li><p>The <code class="docutils literal notranslate"><span class="pre">code</span></code> parameter is ignored.</p></li> |
| </ul> |
| </div></blockquote> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.getpid"> |
| <a class="reference internal" href="structures.html#c.pid_t" title="pid_t"><span class="pre">pid_t</span></a> <code class="sig-name descname"><span class="pre">getpid</span></code><span class="sig-paren">(</span><span class="pre">void</span><span class="sig-paren">)</span><a class="headerlink" href="#c.getpid" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.vfork"> |
| <a class="reference internal" href="structures.html#c.pid_t" title="pid_t"><span class="pre">pid_t</span></a> <code class="sig-name descname"><span class="pre">vfork</span></code><span class="sig-paren">(</span><span class="pre">void</span><span class="sig-paren">)</span><a class="headerlink" href="#c.vfork" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>The <code class="docutils literal notranslate"><span class="pre">vfork()</span></code> function has the same effect as |
| <code class="docutils literal notranslate"><span class="pre">fork()</span></code>, except that the behavior is undefined if the process created |
| by <code class="docutils literal notranslate"><span class="pre">vfork()</span></code> either modifies any data other than a variable of type |
| <code class="docutils literal notranslate"><span class="pre">pid_t</span></code> used to store the return value from <code class="docutils literal notranslate"><span class="pre">vfork()</span></code>, or returns |
| from the function in which <code class="docutils literal notranslate"><span class="pre">vfork()</span></code> was called, or calls any other |
| function before successfully calling <code class="docutils literal notranslate"><span class="pre">_exit()</span></code> or one of the <code class="docutils literal notranslate"><span class="pre">exec</span></code> |
| family of functions.</p> |
| <blockquote> |
| <div><p>NOTE: <code class="docutils literal notranslate"><span class="pre">vfork()</span></code> is not an independent NuttX feature, but is |
| implemented in architecture-specific logic (using only helper |
| functions from the NuttX core logic). As a result, <code class="docutils literal notranslate"><span class="pre">vfork()</span></code> may |
| not be available on all architectures.</p> |
| </div></blockquote> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Returns</dt> |
| <dd class="field-odd"><p>Upon successful completion, <code class="docutils literal notranslate"><span class="pre">vfork()</span></code> returns 0 to |
| the child process and returns the process ID of the child process to the |
| parent process. Otherwise, -1 is returned to the parent, no child |
| process is created, and <code class="docutils literal notranslate"><span class="pre">errno</span></code> is set to indicate the error.</p> |
| </dd> |
| </dl> |
| <p><strong>POSIX Compatibility:</strong> Compatible with the BSD/Linux interface of the |
| same name. POSIX marks this interface as Obsolete.</p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.exec"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">exec</span></code><span class="sig-paren">(</span><span class="pre">FAR</span> <em class="property"><span class="pre">const</span></em> <span class="pre">char</span> <span class="pre">*</span><em><span class="pre">filename</span></em>, <span class="pre">FAR</span> <span class="pre">char</span> <span class="pre">*</span><em class="property"><span class="pre">const</span></em> <span class="pre">*</span><em><span class="pre">argv</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> <span class="pre">symtab_s</span> <span class="pre">*</span><em><span class="pre">exports</span></em>, <span class="pre">int</span> <em><span class="pre">nexports</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.exec" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>This non-standard, NuttX function is similar to |
| <code class="docutils literal notranslate"><span class="pre">execv()</span></code> and <code class="docutils literal notranslate"><span class="pre">posix_spawn()</span></code> but differs in the following ways;</p> |
| <ul class="simple"> |
| <li><p>Unlike <code class="docutils literal notranslate"><span class="pre">execv()</span></code> and <code class="docutils literal notranslate"><span class="pre">posix_spawn()</span></code> this function accepts symbol |
| table information as input parameters. This means that the symbol |
| table used to link the application prior to execution is provided by |
| the caller, not by the system.</p></li> |
| <li><p>Unlike <code class="docutils literal notranslate"><span class="pre">execv()</span></code>, this function always returns.</p></li> |
| </ul> |
| <p>This non-standard interface is included as a official NuttX API only |
| because it is needed in certain build modes: <code class="docutils literal notranslate"><span class="pre">exec()</span></code> is probably the |
| only want to load programs in the PROTECTED mode. Other file execution |
| APIs rely on a symbol table provided by the OS. In the PROTECTED build |
| mode, the OS cannot provide any meaningful symbolic information for |
| execution of code in the user-space blob so that is the <code class="docutils literal notranslate"><span class="pre">exec()</span></code> |
| function is really needed in that build case</p> |
| <p>The interface is available in the FLAT build mode although it is not |
| really necessary in that case. It is currently used by some example code |
| under the <code class="docutils literal notranslate"><span class="pre">apps/</span></code> that that generate their own symbol tables for |
| linking test programs. So although it is not necessary, it can still be |
| useful.</p> |
| <p>The interface would be completely useless and will not be supported in |
| the KERNEL build mode where the contrary is true: An application process |
| cannot provide any meaning symbolic information for use in linking a |
| different process.</p> |
| <p><strong>NOTE</strong>: This function is flawed and useless without |
| <code class="docutils literal notranslate"><span class="pre">CONFIG_SCHED_ONEXIT</span></code> and <code class="docutils literal notranslate"><span class="pre">CONFIG_SCHED_HAVE_PARENT</span></code> because without |
| those features there is then no mechanism to unload the module once it |
| exits.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>filename</strong> – The path to the program to be executed. If |
| <code class="docutils literal notranslate"><span class="pre">CONFIG_LIBC_ENVPATH</span></code> is defined in the configuration, then this may |
| be a relative path from the current working directory. Otherwise, |
| <code class="docutils literal notranslate"><span class="pre">path</span></code> must be the absolute path to the program.</p></li> |
| <li><p><strong>argv</strong> – A pointer to an array of string arguments. The end of the |
| array is indicated with a NULL entry.</p></li> |
| <li><p><strong>exports</strong> – The address of the start of the caller-provided symbol |
| table. This symbol table contains the addresses of symbols exported |
| by the caller and made available for linking the module into the |
| system.</p></li> |
| <li><p><strong>nexports</strong> – The number of symbols in the <code class="docutils literal notranslate"><span class="pre">exports</span></code> table.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p>Zero (OK) is returned on success; On any failure, <code class="docutils literal notranslate"><span class="pre">exec()</span></code> |
| will return -1 (<code class="docutils literal notranslate"><span class="pre">ERROR</span></code>) and will set the <code class="docutils literal notranslate"><span class="pre">errno</span></code> value |
| appropriately.</p> |
| </dd> |
| </dl> |
| <p><strong>POSIX Compatibility:</strong> This is a non-standard interface unique to |
| NuttX. Motivation for inclusion of this non-standard interface in |
| certain build modes is discussed above.</p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.execv"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">execv</span></code><span class="sig-paren">(</span><span class="pre">FAR</span> <em class="property"><span class="pre">const</span></em> <span class="pre">char</span> <span class="pre">*</span><em><span class="pre">path</span></em>, <span class="pre">FAR</span> <span class="pre">char</span> <span class="pre">*</span><em class="property"><span class="pre">const</span></em> <em><span class="pre">argv</span></em><span class="pre">[</span><span class="pre">]</span><span class="sig-paren">)</span><a class="headerlink" href="#c.execv" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>The standard <code class="docutils literal notranslate"><span class="pre">exec</span></code> family of functions will replace |
| the current process image with a new process image. The new image will |
| be constructed from a regular, executable file called the new process |
| image file. There will be no return from a successful <code class="docutils literal notranslate"><span class="pre">exec</span></code>, because |
| the calling process image is overlaid by the new process image.</p> |
| <p>Simplified <code class="docutils literal notranslate"><span class="pre">execl()</span></code> and <code class="docutils literal notranslate"><span class="pre">execv()</span></code> functions are provided by NuttX |
| for compatibility. NuttX is a tiny embedded RTOS that does not support |
| processes and hence the concept of overlaying a tasks process image with |
| a new process image does not make any sense. In NuttX, these functions |
| are wrapper functions that:</p> |
| <blockquote> |
| <div><ol class="arabic simple"> |
| <li><p>Call the non-standard <code class="docutils literal notranslate"><span class="pre">binfmt</span></code> function <code class="docutils literal notranslate"><span class="pre">exec()</span></code>, and then</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">exit(0)</span></code>.</p></li> |
| </ol> |
| </div></blockquote> |
| <p>Note the inefficiency when <code class="docutils literal notranslate"><span class="pre">execv()</span></code> or <code class="docutils literal notranslate"><span class="pre">execl()</span></code> is called in the |
| normal, two-step process: (1) first call <code class="docutils literal notranslate"><span class="pre">vfork()</span></code> to create a new |
| thread, then (2) call <code class="docutils literal notranslate"><span class="pre">execv()</span></code> or <code class="docutils literal notranslate"><span class="pre">execl()</span></code> to replace the new |
| thread with a program from the file system. Since the new thread will be |
| terminated by the <code class="docutils literal notranslate"><span class="pre">execv()</span></code> or <code class="docutils literal notranslate"><span class="pre">execl()</span></code> call, it really served no |
| purpose other than to support POSIX compatibility.</p> |
| <p>The non-standard binfmt function <code class="docutils literal notranslate"><span class="pre">exec()</span></code> needs to have (1) a symbol |
| table that provides the list of symbols exported by the base code, and |
| (2) the number of symbols in that table. This information is currently |
| provided to <code class="docutils literal notranslate"><span class="pre">exec()</span></code> from <code class="docutils literal notranslate"><span class="pre">execv()</span></code> or <code class="docutils literal notranslate"><span class="pre">execl()</span></code> via NuttX |
| configuration settings:</p> |
| <blockquote> |
| <div><ul class="simple"> |
| <li><p><code class="docutils literal notranslate"><span class="pre">CONFIG_LIBC_EXECFUNCS</span></code>: Enable <code class="docutils literal notranslate"><span class="pre">execv()</span></code> and <code class="docutils literal notranslate"><span class="pre">execl()</span></code> support</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">CONFIG_EXECFUNCS_SYMTAB_ARRAY</span></code>: Name of the symbol table used by |
| <code class="docutils literal notranslate"><span class="pre">execv()</span></code> or <code class="docutils literal notranslate"><span class="pre">execl()</span></code>.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">CONFIG_EXECFUNCS_NSYMBOLS_VAR</span></code>: Name of the <code class="docutils literal notranslate"><span class="pre">int</span></code> variable |
| holding the number of symbols in the symbol table</p></li> |
| </ul> |
| </div></blockquote> |
| <p>As a result of the above, the current implementations of <code class="docutils literal notranslate"><span class="pre">execl()</span></code> and |
| <code class="docutils literal notranslate"><span class="pre">execv()</span></code> suffer from some incompatibilities that may or may not be |
| addressed in a future version of NuttX. Other than just being an |
| inefficient use of MCU resource, the most serious of these is that the |
| <code class="docutils literal notranslate"><span class="pre">exec</span></code>’ed task will not have the same task ID as the <code class="docutils literal notranslate"><span class="pre">vfork</span></code>’ed |
| function. So the parent function cannot know the ID of the <code class="docutils literal notranslate"><span class="pre">exec</span></code>’ed |
| task.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>path</strong> – The path to the program to be executed. If |
| <code class="docutils literal notranslate"><span class="pre">CONFIG_LIBC_ENVPATH</span></code> is defined in the configuration, then this may |
| be a relative path from the current working directory. Otherwise,</p></li> |
| <li><p><strong>path</strong> – must be the absolute path to the program.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p>This function does not return on success. On |
| failure, it will return -1 (<code class="docutils literal notranslate"><span class="pre">ERROR</span></code>) and will set the <code class="docutils literal notranslate"><span class="pre">errno</span></code> value |
| appropriately.</p> |
| </dd> |
| </dl> |
| <p><strong>POSIX Compatibility:</strong> Similar with the POSIX interface of the same |
| name. There are, however, several compatibility issues as detailed in |
| the description above.</p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.execl"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">execl</span></code><span class="sig-paren">(</span><span class="pre">FAR</span> <em class="property"><span class="pre">const</span></em> <span class="pre">char</span> <span class="pre">*</span><em><span class="pre">path</span></em>, <span class="pre">...</span><span class="sig-paren">)</span><a class="headerlink" href="#c.execl" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p><code class="docutils literal notranslate"><span class="pre">execl()</span></code> is functionally equivalent to |
| <a class="reference external" href="#execv">execv()</a>, differing only in the form of its input |
| parameters. See the description of <a class="reference external" href="#execv">execv()</a> for additional |
| information.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>path</strong> – The path to the program to be executed. If |
| <code class="docutils literal notranslate"><span class="pre">CONFIG_LIBC_ENVPATH</span></code> is defined in the configuration, then this may |
| be a relative path from the current working directory. Otherwise,</p></li> |
| <li><p><strong>path</strong> – must be the absolute path to the program.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p>This function does not return on success. On |
| failure, it will return -1 (<code class="docutils literal notranslate"><span class="pre">ERROR</span></code>) and will set the <code class="docutils literal notranslate"><span class="pre">errno</span></code> value |
| appropriately.</p> |
| </dd> |
| </dl> |
| <p><strong>POSIX Compatibility:</strong> Similar with the POSIX interface of the same |
| name. There are, however, several compatibility issues as detailed in |
| the description of <a class="reference external" href="#execv">execv()</a>.</p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.posix_spawn"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">posix_spawn</span></code><span class="sig-paren">(</span><span class="pre">FAR</span> <a class="reference internal" href="structures.html#c.pid_t" title="pid_t"><span class="pre">pid_t</span></a> <span class="pre">*</span><em><span class="pre">pid</span></em>, <span class="pre">FAR</span> <em class="property"><span class="pre">const</span></em> <span class="pre">char</span> <span class="pre">*</span><em><span class="pre">path</span></em>, <span class="pre">FAR</span> <em class="property"><span class="pre">const</span></em> <span class="pre">posix_spawn_file_actions_t</span> <span class="pre">*</span><em><span class="pre">file_actions</span></em>, <span class="pre">FAR</span> <em class="property"><span class="pre">const</span></em> <span class="pre">posix_spawnattr_t</span> <span class="pre">*</span><em><span class="pre">attr</span></em>, <span class="pre">FAR</span> <span class="pre">char</span> <span class="pre">*</span><em class="property"><span class="pre">const</span></em> <em><span class="pre">argv</span></em><span class="pre">[</span><span class="pre">]</span>, <span class="pre">FAR</span> <span class="pre">char</span> <span class="pre">*</span><em class="property"><span class="pre">const</span></em> <em><span class="pre">envp</span></em><span class="pre">[</span><span class="pre">]</span><span class="sig-paren">)</span><a class="headerlink" href="#c.posix_spawn" title="Permalink to this definition">¶</a><br /></dt> |
| <dd></dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.posix_spawnp"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">posix_spawnp</span></code><span class="sig-paren">(</span><span class="pre">FAR</span> <a class="reference internal" href="structures.html#c.pid_t" title="pid_t"><span class="pre">pid_t</span></a> <span class="pre">*</span><em><span class="pre">pid</span></em>, <span class="pre">FAR</span> <em class="property"><span class="pre">const</span></em> <span class="pre">char</span> <span class="pre">*</span><em><span class="pre">file</span></em>, <span class="pre">FAR</span> <em class="property"><span class="pre">const</span></em> <span class="pre">posix_spawn_file_actions_t</span> <span class="pre">*</span><em><span class="pre">file_actions</span></em>, <span class="pre">FAR</span> <em class="property"><span class="pre">const</span></em> <span class="pre">posix_spawnattr_t</span> <span class="pre">*</span><em><span class="pre">attr</span></em>, <span class="pre">FAR</span> <span class="pre">char</span> <span class="pre">*</span><em class="property"><span class="pre">const</span></em> <em><span class="pre">argv</span></em><span class="pre">[</span><span class="pre">]</span>, <span class="pre">FAR</span> <span class="pre">char</span> <span class="pre">*</span><em class="property"><span class="pre">const</span></em> <em><span class="pre">envp</span></em><span class="pre">[</span><span class="pre">]</span><span class="sig-paren">)</span><span class="pre">;</span><a class="headerlink" href="#c.posix_spawnp" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>The <code class="docutils literal notranslate"><span class="pre">posix_spawn()</span></code> and <code class="docutils literal notranslate"><span class="pre">posix_spawnp()</span></code> functions |
| will create a new, child task, constructed from a regular executable |
| file.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>pid</strong> – Upon successful completion, <code class="docutils literal notranslate"><span class="pre">posix_spawn()</span></code> and |
| <code class="docutils literal notranslate"><span class="pre">posix_spawnp()</span></code> will return the task ID of the child task to the |
| parent task, in the variable pointed to by a non-NULL <code class="docutils literal notranslate"><span class="pre">pid</span></code> |
| argument. If the <code class="docutils literal notranslate"><span class="pre">pid</span></code> argument is a null pointer, the process ID |
| of the child is not returned to the caller.</p></li> |
| <li><p><strong>path</strong> – <p>The <code class="docutils literal notranslate"><span class="pre">path</span></code> argument to <code class="docutils literal notranslate"><span class="pre">posix_spawn()</span></code> is |
| the absolute path that identifies the file to execute. The <code class="docutils literal notranslate"><span class="pre">file</span></code> |
| argument to <code class="docutils literal notranslate"><span class="pre">posix_spawnp()</span></code> may also be a relative path and will |
| be used to construct a pathname that identifies the file to execute. |
| In the case of a relative path, the path prefix for the file will be |
| obtained by a search of the directories passed as the environment |
| variable PATH.</p> |
| <p>NOTE: NuttX provides only one implementation: If |
| <code class="docutils literal notranslate"><span class="pre">CONFIG_LIBC_ENVPATH</span></code> is defined, then only <code class="docutils literal notranslate"><span class="pre">posix_spawnp()</span></code> |
| behavior is supported; otherwise, only <code class="docutils literal notranslate"><span class="pre">posix_spawn</span></code> behavior is |
| supported.</p> |
| </p></li> |
| <li><p><strong>file_actions</strong> – If <code class="docutils literal notranslate"><span class="pre">file_actions</span></code> is a null pointer, then file |
| descriptors open in the calling process will remain open in the child |
| process (unless <code class="docutils literal notranslate"><span class="pre">CONFIG_FDCLONE_STDIO</span></code> is defined). If |
| <code class="docutils literal notranslate"><span class="pre">file_actions</span></code> is not NULL, then the file descriptors open in the |
| child process will be those open in the calling process as modified |
| by the spawn file actions object pointed to by <code class="docutils literal notranslate"><span class="pre">file_actions</span></code>.</p></li> |
| <li><p><strong>attr</strong> – <p>If the value of the <code class="docutils literal notranslate"><span class="pre">attr</span></code> parameter is <code class="docutils literal notranslate"><span class="pre">NULL</span></code>, the all |
| default values for the POSIX spawn attributes will be used. |
| Otherwise, the attributes will be set according to the spawn flags. |
| The <code class="docutils literal notranslate"><span class="pre">posix_spawnattr_t</span></code> spawn attributes object type is defined in |
| <code class="docutils literal notranslate"><span class="pre">spawn.h</span></code>. It will contains these attributes, not all of which are |
| supported by NuttX:</p> |
| <ul> |
| <li><p><code class="docutils literal notranslate"><span class="pre">POSIX_SPAWN_SETPGROUP</span></code>: Setting of the new task’s process group |
| is not supported. NuttX does not support process groups.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">POSIX_SPAWN_SETSCHEDPARAM</span></code>: Set new tasks priority to the |
| <code class="docutils literal notranslate"><span class="pre">sched_param</span></code> value.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">POSIX_SPAWN_SETSCHEDULER</span></code>: Set the new task’s scheduler policy |
| to the <code class="docutils literal notranslate"><span class="pre">sched_policy</span></code> value.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">POSIX_SPAWN_RESETIDS</span></code> Resetting of the effective user ID of the |
| child process is not supported. NuttX does not support effective |
| user IDs.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">POSIX_SPAWN_SETSIGMASK</span></code>: Set the new task’s signal mask.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">POSIX_SPAWN_SETSIGDEF</span></code>: Resetting signal default actions is not |
| supported. NuttX does not support default signal actions.</p></li> |
| </ul> |
| </p></li> |
| <li><p><strong>argv</strong> – <code class="docutils literal notranslate"><span class="pre">argv[]</span></code> is the argument list for the new task. |
| <code class="docutils literal notranslate"><span class="pre">argv[]</span></code> is an array of pointers to null-terminated strings. The |
| list is terminated with a null pointer.</p></li> |
| <li><p><strong>envp</strong> – The <code class="docutils literal notranslate"><span class="pre">envp[]</span></code> argument is not used by NuttX and may be |
| <code class="docutils literal notranslate"><span class="pre">NULL</span></code>. In standard implementations, <code class="docutils literal notranslate"><span class="pre">envp[]</span></code> is an array of |
| character pointers to null-terminated strings that provide the |
| environment for the new process image. The environment array is |
| terminated by a null pointer. In NuttX, the <code class="docutils literal notranslate"><span class="pre">envp[]</span></code> argument is |
| ignored and the new task will inherit the environment of the parent |
| task unconditionally.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><p>Zero on success. Otherwise, an error number will be returned as the |
| function return value to indicate the error:</p> |
| <ul class="simple"> |
| <li><p><code class="docutils literal notranslate"><span class="pre">EINVAL</span></code>: The value specified by <code class="docutils literal notranslate"><span class="pre">file_actions</span></code> or <code class="docutils literal notranslate"><span class="pre">attr</span></code> is |
| invalid.</p></li> |
| <li><p>Any errors that might have been return if <code class="docutils literal notranslate"><span class="pre">vfork()</span></code> and |
| <code class="docutils literal notranslate"><span class="pre">exec[l|v]()</span></code> had been called.</p></li> |
| </ul> |
| </p> |
| </dd> |
| </dl> |
| <p><strong>Assumptions/Limitations:</strong></p> |
| <ul class="simple"> |
| <li><p>NuttX provides only <code class="docutils literal notranslate"><span class="pre">posix_spawn()</span></code> or <code class="docutils literal notranslate"><span class="pre">posix_spawnp()</span></code> behavior |
| depending upon the setting of <code class="docutils literal notranslate"><span class="pre">CONFIG_LIBC_ENVPATH</span></code>: If |
| <code class="docutils literal notranslate"><span class="pre">CONFIG_LIBC_ENVPATH</span></code> is defined, then only <code class="docutils literal notranslate"><span class="pre">posix_spawnp()</span></code> |
| behavior is supported; otherwise, only <code class="docutils literal notranslate"><span class="pre">posix_spawn()</span></code> behavior is |
| supported.</p></li> |
| <li><p>The <code class="docutils literal notranslate"><span class="pre">envp</span></code> argument is not used and the <code class="docutils literal notranslate"><span class="pre">environ</span></code> variable is not |
| altered (NuttX does not support the <code class="docutils literal notranslate"><span class="pre">environ</span></code> variable).</p></li> |
| <li><p>Process groups are not supported (See <code class="docutils literal notranslate"><span class="pre">POSIX_SPAWN_SETPGROUP</span></code> |
| above).</p></li> |
| <li><p>Effective user IDs are not supported (See <code class="docutils literal notranslate"><span class="pre">POSIX_SPAWN_RESETIDS</span></code> |
| above).</p></li> |
| <li><p>Signal default actions cannot be modified in the newly task executed |
| because NuttX does not support default signal actions (See |
| <code class="docutils literal notranslate"><span class="pre">POSIX_SPAWN_SETSIGDEF</span></code>).</p></li> |
| </ul> |
| <p><strong>POSIX Compatibility:</strong> The value of the <code class="docutils literal notranslate"><span class="pre">argv[0]</span></code> received by the |
| child task is assigned by NuttX. For the caller of <code class="docutils literal notranslate"><span class="pre">posix_spawn()</span></code>, |
| the provided argv[0] will correspond to <code class="docutils literal notranslate"><span class="pre">argv[1]</span></code> received by the new |
| task.</p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.posix_spawn_file_actions_init"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">posix_spawn_file_actions_init</span></code><span class="sig-paren">(</span><span class="pre">FAR</span> <span class="pre">posix_spawn_file_actions_t</span> <span class="pre">*</span><em><span class="pre">file_actions</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.posix_spawn_file_actions_init" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Initializes the object referenced by <code class="docutils literal notranslate"><span class="pre">file_actions</span></code> to an empty set of |
| file actions for subsequent use in a call to <code class="docutils literal notranslate"><span class="pre">posix_spawn()</span></code> or |
| <code class="docutils literal notranslate"><span class="pre">posix_spawnp()</span></code>.</p> |
| <p><strong>Input Parameters:</strong></p> |
| <ul class="simple"> |
| <li><p><code class="docutils literal notranslate"><span class="pre">file_actions</span></code>: The address of the <code class="docutils literal notranslate"><span class="pre">posix_spawn_file_actions_t</span></code> |
| to be initialized.</p></li> |
| </ul> |
| <p><strong>Returned Value:</strong> On success, this function returns 0; on failure it |
| will return an error number from <code class="docutils literal notranslate"><span class="pre"><errno.h></span></code>.</p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.posix_spawn_file_actions_destroy"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">posix_spawn_file_actions_destroy</span></code><span class="sig-paren">(</span><span class="pre">FAR</span> <span class="pre">posix_spawn_file_actions_t</span> <span class="pre">*</span><em><span class="pre">file_actions</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.posix_spawn_file_actions_destroy" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Destroys the object referenced by <code class="docutils literal notranslate"><span class="pre">file_actions</span></code> which was previously |
| initialized by <code class="docutils literal notranslate"><span class="pre">posix_spawn_file_actions_init()</span></code>, returning any |
| resources obtained at the time of initialization to the system for |
| subsequent reuse. A <code class="docutils literal notranslate"><span class="pre">posix_spawn_file_actions_t</span></code> may be reinitialized |
| after having been destroyed, but must not be reused after destruction, |
| unless it has been reinitialized.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>file_actions</strong> – The address of the <code class="docutils literal notranslate"><span class="pre">posix_spawn_file_actions_t</span></code> |
| to be destroyed.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p>On success, this function returns 0; on failure it |
| will return an error number from <code class="docutils literal notranslate"><span class="pre"><errno.h></span></code></p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.posix_spawn_file_actions_addclose"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">posix_spawn_file_actions_addclose</span></code><span class="sig-paren">(</span><span class="pre">FAR</span> <span class="pre">posix_spawn_file_actions_t</span> <span class="pre">*</span><em><span class="pre">file_actions</span></em>, <span class="pre">int</span> <em><span class="pre">fd</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.posix_spawn_file_actions_addclose" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Adds a <em>close</em> operation to the list of operations associated with the |
| object referenced by <code class="docutils literal notranslate"><span class="pre">file_actions</span></code>, for subsequent use in a call to |
| <code class="docutils literal notranslate"><span class="pre">posix_spawn()</span></code> or <code class="docutils literal notranslate"><span class="pre">posix_spawnp()</span></code>. The descriptor referred to by |
| <code class="docutils literal notranslate"><span class="pre">fd</span></code> is closed as if <code class="docutils literal notranslate"><span class="pre">close()</span></code> had been called on it prior to the |
| new child process starting execution.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>file_actions</strong> – The address of the <code class="docutils literal notranslate"><span class="pre">posix_spawn_file_actions_t</span></code> |
| object to which the <em>close</em> operation will be appended.</p></li> |
| <li><p><strong>fd</strong> – The file descriptor to be closed.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p>On success, this function returns 0; on failure it |
| will return an error number from <code class="docutils literal notranslate"><span class="pre"><errno.h></span></code></p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.posix_spawn_file_actions_adddup2"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">posix_spawn_file_actions_adddup2</span></code><span class="sig-paren">(</span><span class="pre">FAR</span> <span class="pre">posix_spawn_file_actions_t</span> <span class="pre">*</span><em><span class="pre">file_actions</span></em>, <span class="pre">int</span> <em><span class="pre">fd1</span></em>, <span class="pre">int</span> <em><span class="pre">fd2</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.posix_spawn_file_actions_adddup2" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Adds a <em>dup2</em> operation to the list of operations associated with the |
| object referenced by <code class="docutils literal notranslate"><span class="pre">file_actions</span></code>, for subsequent use in a call to |
| <code class="docutils literal notranslate"><span class="pre">posix_spawn()</span></code> or <code class="docutils literal notranslate"><span class="pre">posix_spawnp()</span></code>. The descriptor referred to by |
| <code class="docutils literal notranslate"><span class="pre">fd2</span></code> is created as if <code class="docutils literal notranslate"><span class="pre">dup2()</span></code> had been called on <code class="docutils literal notranslate"><span class="pre">fd1</span></code> prior to |
| the new child process starting execution.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>file_actions</strong> – The address of the <code class="docutils literal notranslate"><span class="pre">posix_spawn_file_actions_t</span></code> |
| object to which the <em>dup2</em> operation will be appended.</p></li> |
| <li><p><strong>fd1</strong> – The file descriptor to be be duplicated. The first file |
| descriptor to be argument to <code class="docutils literal notranslate"><span class="pre">dup2()</span></code>.</p></li> |
| <li><p><strong>fd2</strong> – The file descriptor to be be created. The second file |
| descriptor to be argument to <code class="docutils literal notranslate"><span class="pre">dup2()</span></code>.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p>On success, this function returns 0; on failure it |
| will return an error number from <code class="docutils literal notranslate"><span class="pre"><errno.h></span></code></p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.posix_spawn_file_actions_addopen"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">posix_spawn_file_actions_addopen</span></code><span class="sig-paren">(</span><span class="pre">FAR</span> <span class="pre">posix_spawn_file_actions_t</span> <span class="pre">*</span><em><span class="pre">file_actions</span></em>, <span class="pre">int</span> <em><span class="pre">fd</span></em>, <span class="pre">FAR</span> <em class="property"><span class="pre">const</span></em> <span class="pre">char</span> <span class="pre">*</span><em><span class="pre">path</span></em>, <span class="pre">int</span> <em><span class="pre">oflags</span></em>, <span class="pre">mode_t</span> <em><span class="pre">mode</span></em><span class="sig-paren">)</span><span class="pre">;</span><a class="headerlink" href="#c.posix_spawn_file_actions_addopen" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Adds an <em>open</em> operation to the list of operations associated with the |
| object referenced by <code class="docutils literal notranslate"><span class="pre">file_actions</span></code>, for subsequent use in a call to |
| <code class="docutils literal notranslate"><span class="pre">posix_spawn()</span></code> or <code class="docutils literal notranslate"><span class="pre">posix_spawnp()</span></code>. The descriptor referred to by |
| <code class="docutils literal notranslate"><span class="pre">fd</span></code> is opened using the <code class="docutils literal notranslate"><span class="pre">path</span></code>, <code class="docutils literal notranslate"><span class="pre">oflag</span></code>, and <code class="docutils literal notranslate"><span class="pre">mode</span></code> arguments |
| as if <code class="docutils literal notranslate"><span class="pre">open()</span></code> had been called on it prior to the new child process |
| starting execution. The string path is copied by the |
| <code class="docutils literal notranslate"><span class="pre">posix_spawn_file_actions_addopen()</span></code> function during this process, so |
| storage need not be persistent in the caller.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>file_actions</strong> – The address of the <code class="docutils literal notranslate"><span class="pre">posix_spawn_file_actions_t</span></code> |
| object to which the <em>open</em> operation will be appended.</p></li> |
| <li><p><strong>fd</strong> – The file descriptor to be opened.</p></li> |
| <li><p><strong>path</strong> – The path to be opened.</p></li> |
| <li><p><strong>oflags</strong> – Open flags.</p></li> |
| <li><p><strong>mode</strong> – File creation mode/</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p>On success, this function returns 0; on failure it |
| will return an error number from <code class="docutils literal notranslate"><span class="pre"><errno.h></span></code></p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.posix_spawnattr_init"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">posix_spawnattr_init</span></code><span class="sig-paren">(</span><span class="pre">FAR</span> <span class="pre">posix_spawnattr_t</span> <span class="pre">*</span><em><span class="pre">attr</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.posix_spawnattr_init" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>The <code class="docutils literal notranslate"><span class="pre">posix_spawnattr_init()</span></code> function initializes the |
| object referenced by <code class="docutils literal notranslate"><span class="pre">attr</span></code>, to an empty set of spawn attributes for |
| subsequent use in a call to <code class="docutils literal notranslate"><span class="pre">posix_spawn()</span></code> or <code class="docutils literal notranslate"><span class="pre">posix_spawnp()</span></code>.</p> |
| <p>Then the spawn attributes are no longer needed, they should be destroyed |
| by calling <code class="docutils literal notranslate"><span class="pre">posix_spawnattr_destroyed()</span></code>. In NuttX, however, |
| <code class="docutils literal notranslate"><span class="pre">posix_spawnattr_destroyed()</span></code> is just stub:</p> |
| <p>For portability, the convention of calling |
| <code class="docutils literal notranslate"><span class="pre">posix_spawnattr_destroyed()</span></code> when the attributes are not longer |
| needed should still be followed.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>attr</strong> – The address of the spawn attributes to be initialized.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p>On success, this function returns 0; on failure it |
| will return an error number from <code class="docutils literal notranslate"><span class="pre"><errno.h></span></code></p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.posix_spawnattr_getflags"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">posix_spawnattr_getflags</span></code><span class="sig-paren">(</span><span class="pre">FAR</span> <em class="property"><span class="pre">const</span></em> <span class="pre">posix_spawnattr_t</span> <span class="pre">*</span><em><span class="pre">attr</span></em>, <span class="pre">FAR</span> <span class="pre">short</span> <span class="pre">*</span><em><span class="pre">flags</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.posix_spawnattr_getflags" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>The <code class="docutils literal notranslate"><span class="pre">posix_spawnattr_getflags()</span></code> function will obtain |
| the value of the <em>spawn-flags</em> attribute from the attributes object |
| referenced by <code class="docutils literal notranslate"><span class="pre">attr</span></code>.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>attr</strong> – The address spawn attributes to be queried.</p></li> |
| <li><p><strong>flags</strong> – The location to return the spawn flags</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p>On success, this function returns 0; on failure it |
| will return an error number from <code class="docutils literal notranslate"><span class="pre"><errno.h></span></code></p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.posix_spawnattr_getschedparam"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">posix_spawnattr_getschedparam</span></code><span class="sig-paren">(</span><span class="pre">FAR</span> <em class="property"><span class="pre">const</span></em> <span class="pre">posix_spawnattr_t</span> <span class="pre">*</span><em><span class="pre">attr</span></em>, <span class="pre">FAR</span> <em class="property"><span class="pre">struct</span></em> <a class="reference internal" href="structures.html#c.sched_param" title="sched_param"><span class="pre">sched_param</span></a> <span class="pre">*</span><em><span class="pre">param</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.posix_spawnattr_getschedparam" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>The <code class="docutils literal notranslate"><span class="pre">posix_spawnattr_getschedparam()</span></code> function will |
| obtain the value of the <em>spawn-schedparam</em> attribute from the attributes |
| object referenced by <code class="docutils literal notranslate"><span class="pre">attr</span></code>.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>attr</strong> – The address spawn attributes to be queried.</p></li> |
| <li><p><strong>param</strong> – The location to return the <em>spawn-schedparam</em> value.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p>On success, this function returns 0; on failure it |
| will return an error number from <code class="docutils literal notranslate"><span class="pre"><errno.h></span></code></p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.posix_spawnattr_getschedpolicy"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">posix_spawnattr_getschedpolicy</span></code><span class="sig-paren">(</span><span class="pre">FAR</span> <em class="property"><span class="pre">const</span></em> <span class="pre">posix_spawnattr_t</span> <span class="pre">*</span><em><span class="pre">attr</span></em>, <span class="pre">FAR</span> <span class="pre">int</span> <span class="pre">*</span><em><span class="pre">policy</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.posix_spawnattr_getschedpolicy" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>The <code class="docutils literal notranslate"><span class="pre">posix_spawnattr_getschedpolicy()</span></code> function will |
| obtain the value of the <em>spawn-schedpolicy</em> attribute from the |
| attributes object referenced by <code class="docutils literal notranslate"><span class="pre">attr</span></code>.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>attr</strong> – The address spawn attributes to be queried.</p></li> |
| <li><p><strong>policy</strong> – The location to return the <em>spawn-schedpolicy</em> value.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p>On success, this function returns 0; on failure it |
| will return an error number from <code class="docutils literal notranslate"><span class="pre"><errno.h></span></code></p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.posix_spawnattr_getsigmask"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">posix_spawnattr_getsigmask</span></code><span class="sig-paren">(</span><span class="pre">FAR</span> <em class="property"><span class="pre">const</span></em> <span class="pre">posix_spawnattr_t</span> <span class="pre">*</span><em><span class="pre">attr</span></em>, <span class="pre">FAR</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">sigmask</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.posix_spawnattr_getsigmask" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p><code class="docutils literal notranslate"><span class="pre">posix_spawnattr_getsigdefault()</span></code> function will |
| obtain the value of the <em>spawn-sigmask</em> attribute from the attributes |
| object referenced by <code class="docutils literal notranslate"><span class="pre">attr</span></code>.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>attr</strong> – The address spawn attributes to be queried.</p></li> |
| <li><p><strong>sigmask</strong> – The location to return the <em>spawn-sigmask</em> value.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p>On success, this function returns 0; on failure it |
| will return an error number from <code class="docutils literal notranslate"><span class="pre"><errno.h></span></code></p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.posix_spawnattr_setflags"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">posix_spawnattr_setflags</span></code><span class="sig-paren">(</span><span class="pre">FAR</span> <span class="pre">posix_spawnattr_t</span> <span class="pre">*</span><em><span class="pre">attr</span></em>, <span class="pre">short</span> <em><span class="pre">flags</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.posix_spawnattr_setflags" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>The <code class="docutils literal notranslate"><span class="pre">posix_spawnattr_setflags()</span></code> function will set |
| the <em>spawn-flags</em> attribute in an initialized attributes object |
| referenced by <code class="docutils literal notranslate"><span class="pre">attr</span></code>.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>attr</strong> – The address spawn attributes to be used.</p></li> |
| <li><p><strong>flags</strong> – The new value of the <em>spawn-flags</em> attribute.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p>On success, this function returns 0; on failure it |
| will return an error number from <code class="docutils literal notranslate"><span class="pre"><errno.h></span></code></p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.posix_spawnattr_setschedparam"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">posix_spawnattr_setschedparam</span></code><span class="sig-paren">(</span><span class="pre">FAR</span> <span class="pre">posix_spawnattr_t</span> <span class="pre">*</span><em><span class="pre">attr</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.sched_param" title="sched_param"><span class="pre">sched_param</span></a> <span class="pre">*</span><em><span class="pre">param</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.posix_spawnattr_setschedparam" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>The <code class="docutils literal notranslate"><span class="pre">posix_spawnattr_setschedparam()</span></code> function will |
| set the <em>spawn-schedparam</em> attribute in an initialized attributes object |
| referenced by <code class="docutils literal notranslate"><span class="pre">attr</span></code>.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>attr</strong> – The address spawn attributes to be used.</p></li> |
| <li><p><strong>param</strong> – The new value of the <em>spawn-schedparam</em> attribute.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p>On success, this function returns 0; on failure it |
| will return an error number from <code class="docutils literal notranslate"><span class="pre"><errno.h></span></code></p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.posix_spawnattr_setschedpolicy"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">posix_spawnattr_setschedpolicy</span></code><span class="sig-paren">(</span><span class="pre">FAR</span> <span class="pre">posix_spawnattr_t</span> <span class="pre">*</span><em><span class="pre">attr</span></em>, <span class="pre">int</span> <em><span class="pre">policy</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.posix_spawnattr_setschedpolicy" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>The <code class="docutils literal notranslate"><span class="pre">posix_spawnattr_setschedpolicy()</span></code> function will |
| set the <em>spawn-schedpolicy</em> attribute in an initialized attributes |
| object referenced by <code class="docutils literal notranslate"><span class="pre">attr</span></code>.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>attr</strong> – The address spawn attributes to be used.</p></li> |
| <li><p><strong>policy</strong> – The new value of the <em>spawn-schedpolicy</em> attribute.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p>On success, this function returns 0; on failure it |
| will return an error number from <code class="docutils literal notranslate"><span class="pre"><errno.h></span></code></p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.posix_spawnattr_setsigmask"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">posix_spawnattr_setsigmask</span></code><span class="sig-paren">(</span><span class="pre">FAR</span> <span class="pre">posix_spawnattr_t</span> <span class="pre">*</span><em><span class="pre">attr</span></em>, <span class="pre">FAR</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">sigmask</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.posix_spawnattr_setsigmask" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>The <code class="docutils literal notranslate"><span class="pre">posix_spawnattr_setsigmask()</span></code> function will set |
| the <em>spawn-sigmask</em> attribute in an initialized attributes object |
| referenced by <code class="docutils literal notranslate"><span class="pre">attr</span></code>.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>attr</strong> – The address spawn attributes to be used.</p></li> |
| <li><p><strong>sigmask</strong> – The new value of the <em>spawn-sigmask</em> attribute.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p>On success, this function returns 0; on failure it |
| will return an error number from <code class="docutils literal notranslate"><span class="pre"><errno.h></span></code></p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.task_spawn"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">task_spawn</span></code><span class="sig-paren">(</span><span class="pre">FAR</span> <em class="property"><span class="pre">const</span></em> <span class="pre">char</span> <span class="pre">*</span><em><span class="pre">name</span></em>, <a class="reference internal" href="structures.html#c.main_t" title="main_t"><span class="pre">main_t</span></a> <em><span class="pre">entry</span></em>, <span class="pre">FAR</span> <em class="property"><span class="pre">const</span></em> <span class="pre">posix_spawn_file_actions_t</span> <span class="pre">*</span><em><span class="pre">file_actions</span></em>, <span class="pre">FAR</span> <em class="property"><span class="pre">const</span></em> <span class="pre">posix_spawnattr_t</span> <span class="pre">*</span><em><span class="pre">attr</span></em>, <span class="pre">FAR</span> <span class="pre">char</span> <span class="pre">*</span><em class="property"><span class="pre">const</span></em> <em><span class="pre">argv</span></em><span class="pre">[</span><span class="pre">]</span>, <span class="pre">FAR</span> <span class="pre">char</span> <span class="pre">*</span><em class="property"><span class="pre">const</span></em> <em><span class="pre">envp</span></em><span class="pre">[</span><span class="pre">]</span><span class="sig-paren">)</span><a class="headerlink" href="#c.task_spawn" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>The <code class="docutils literal notranslate"><span class="pre">task_spawn()</span></code> function will create a new, child |
| task, where the entry point to the task is an address in memory.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>name</strong> – The name to assign to the child task.</p></li> |
| <li><p><strong>entry</strong> – The child task’s entry point (an address in memory).</p></li> |
| <li><p><strong>file_actions</strong> – If <code class="docutils literal notranslate"><span class="pre">file_actions</span></code> is a null pointer, then file |
| descriptors open in the calling process will remain open in the child |
| process (unless <code class="docutils literal notranslate"><span class="pre">CONFIG_FDCLONE_STDIO</span></code> is defined). If |
| <code class="docutils literal notranslate"><span class="pre">file_actions</span></code> is not NULL, then the file descriptors open in the |
| child process will be those open in the calling process as modified |
| by the spawn file actions object pointed to by <code class="docutils literal notranslate"><span class="pre">file_actions</span></code>.</p></li> |
| <li><p><strong>attr</strong> – <p>If the value of the <code class="docutils literal notranslate"><span class="pre">attr</span></code> parameter is <code class="docutils literal notranslate"><span class="pre">NULL</span></code>, the all |
| default values for the POSIX spawn attributes will be used. |
| Otherwise, the attributes will be set according to the spawn flags. |
| The <code class="docutils literal notranslate"><span class="pre">posix_spawnattr_t</span></code> spawn attributes object type is defined in |
| <code class="docutils literal notranslate"><span class="pre">spawn.h</span></code>. It will contains these attributes, not all of which are |
| supported by NuttX:</p> |
| <ul> |
| <li><p><code class="docutils literal notranslate"><span class="pre">POSIX_SPAWN_SETPGROUP</span></code>: Setting of the new task’s process group |
| is not supported. NuttX does not support process groups.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">POSIX_SPAWN_SETSCHEDPARAM</span></code>: Set new tasks priority to the |
| <code class="docutils literal notranslate"><span class="pre">sched_param</span></code> value.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">POSIX_SPAWN_SETSCHEDULER</span></code>: Set the new task’s scheduler policy |
| to the <code class="docutils literal notranslate"><span class="pre">sched_policy</span></code> value.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">POSIX_SPAWN_RESETIDS</span></code> Resetting of the effective user ID of the |
| child process is not supported. NuttX does not support effective |
| user IDs.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">POSIX_SPAWN_SETSIGMASK</span></code>: Set the new task’s signal mask.</p></li> |
| <li><p><code class="docutils literal notranslate"><span class="pre">POSIX_SPAWN_SETSIGDEF</span></code>: Resetting signal default actions is not |
| supported. NuttX does not support default signal actions.</p></li> |
| </ul> |
| <p>And the non-standard:</p> |
| <ul> |
| <li><p><code class="docutils literal notranslate"><span class="pre">TASK_SPAWN_SETSTACKSIZE</span></code>: Set the stack size for the new task.</p></li> |
| </ul> |
| </p></li> |
| <li><p><strong>argv</strong> – <code class="docutils literal notranslate"><span class="pre">argv[]</span></code> is the argument list for the new task. |
| <code class="docutils literal notranslate"><span class="pre">argv[]</span></code> is an array of pointers to null-terminated strings. The |
| list is terminated with a null pointer.</p></li> |
| <li><p><strong>envp</strong> – The <code class="docutils literal notranslate"><span class="pre">envp[]</span></code> argument is not used by NuttX and may be |
| <code class="docutils literal notranslate"><span class="pre">NULL</span></code>.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">task_spawn()</span></code> will return process ID of new task on success. |
| Otherwise, a negative number will be returned as the function return |
| value to indicate the error:</p> |
| </dd> |
| </dl> |
| <p><strong>POSIX Compatibility:</strong> This is a non-standard interface inspired by |
| <code class="docutils literal notranslate"><span class="pre">posix_spawn()</span></code>.</p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.task_spawnattr_getstacksize"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">task_spawnattr_getstacksize</span></code><span class="sig-paren">(</span><span class="pre">FAR</span> <em class="property"><span class="pre">const</span></em> <span class="pre">posix_spawnattr_t</span> <span class="pre">*</span><em><span class="pre">attr</span></em>, <span class="pre">FAR</span> <a class="reference internal" href="structures.html#c.size_t" title="size_t"><span class="pre">size_t</span></a> <span class="pre">*</span><em><span class="pre">stacksize</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.task_spawnattr_getstacksize" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>The <code class="docutils literal notranslate"><span class="pre">task_spawnattr_getstacksize()</span></code> function will |
| obtain the value of the <em>spawn-stacksize</em> attribute from the attributes |
| object referenced by <code class="docutils literal notranslate"><span class="pre">attr</span></code>.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>attr</strong> – The address spawn attributes to be queried.</p></li> |
| <li><p><strong>policy</strong> – The location to return the <em>spawn-stacksize</em> value.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p>On success, this function returns 0; on failure it |
| will return an error number from <code class="docutils literal notranslate"><span class="pre"><errno.h></span></code></p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.task_spawnattr_setstacksize"> |
| <span class="pre">int</span> <code class="sig-name descname"><span class="pre">task_spawnattr_setstacksize</span></code><span class="sig-paren">(</span><span class="pre">FAR</span> <span class="pre">posix_spawnattr_t</span> <span class="pre">*</span><em><span class="pre">attr</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">stacksize</span></em><span class="sig-paren">)</span><a class="headerlink" href="#c.task_spawnattr_setstacksize" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>The <code class="docutils literal notranslate"><span class="pre">task_spawnattr_setstacksize()</span></code> function will set |
| the <em>spawn-stacksize</em> attribute in an initialized attributes object |
| referenced by <code class="docutils literal notranslate"><span class="pre">attr</span></code>.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>attr</strong> – The address spawn attributes to be used.</p></li> |
| <li><p><strong>policy</strong> – The new value of the <em>spawn-stacksize</em> attribute.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p>On success, this function returns 0; on failure it |
| will return an error number from <code class="docutils literal notranslate"><span class="pre"><errno.h></span></code></p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| </div> |
| </div> |
| |
| |
| </div> |
| |
| </div> |
| <footer> |
| <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> |
| <a href="02_task_scheduling.html" class="btn btn-neutral float-right" title="Task Scheduling Interfaces" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a> |
| <a href="index.html" class="btn btn-neutral float-left" title="Userspace API" 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> |