Squashed commit of the following:

binfmt: Fix some compilation issues introduced in previous changes.  Verfied with the STM32F4-Discovery ELF configuration.

    binfmt:  schedule_unload() is an internal OS function and must not alter the errno variable.

    binfmt:  unload_module() is an internal OS function and must not alter the errno variable.

    binfmt:  load_module() is an internal OS function and must not alter the errno variable.

    binfmt:  exec_module() is an internal OS function and must not alter the errno variable.
This commit is contained in:
Gregory Nutt
2017-10-02 15:30:55 -06:00
parent 3688ea2f90
commit bc2cded397
10 changed files with 67 additions and 116 deletions
+5 -9
View File
@@ -8,7 +8,7 @@
<tr align="center" bgcolor="#e4e4e4"> <tr align="center" bgcolor="#e4e4e4">
<td> <td>
<h1><big><font color="#3c34ec"><i>NuttX Binary Loader</i></font></big></h1> <h1><big><font color="#3c34ec"><i>NuttX Binary Loader</i></font></big></h1>
<p>Last Updated: August 22, 2014</p> <p>Last Updated: October 1, 2017</p>
</td> </td>
</tr> </tr>
</table> </table>
@@ -280,9 +280,7 @@ int load_module(FAR struct binary_s *bin);
</ul> </ul>
<p><b>Returned Value:</b></p> <p><b>Returned Value:</b></p>
<ul> <ul>
This is an end-user function, so it follows the normal convention: This is a NuttX internal function so it follows the convention that 0 (<code>OK</code>) is returned on success and a negated <code>errno</code> is returned on failure.
Returns 0 (<code>OK</code>) on success.
On failure, it returns -1 (<code>ERROR</code>) with <code>errno</code> set appropriately.
</ul> </ul>
<h3>2.3.4 <a name="unload_module"><code>unload_module()</code></a></h3> <h3>2.3.4 <a name="unload_module"><code>unload_module()</code></a></h3>
@@ -304,7 +302,7 @@ int unload_module(FAR struct binary_s *bin);
</ul> </ul>
<p><b>Returned Value:</b></p> <p><b>Returned Value:</b></p>
<ul> <ul>
This is a NuttX internal function so it follows the convention that 0 (<code>OK</code>) is returned on success and a negated <code>errno</code> is returned on failure. This is a NuttX internal function so it follows the convention that 0 (<code>OK</code>) is returned on success and a negated <code>errno</code> is returned on failure.
</ul> </ul>
<h3>2.3.5 <a name="exec_module"><code>exec_module()</code></a></h3> <h3>2.3.5 <a name="exec_module"><code>exec_module()</code></a></h3>
@@ -315,13 +313,11 @@ int exec_module(FAR const struct binary_s *bin);
</pre></ul> </pre></ul>
<p><b>Description:</b></p> <p><b>Description:</b></p>
<ul> <ul>
Execute a module that has been loaded into memory by <code>load_module()</code>. Execute a module that has been loaded into memory by <code>load_module()</code>.
</ul> </ul>
<p><b>Returned Value:</b></p> <p><b>Returned Value:</b></p>
<ul> <ul>
This is an end-user function, so it follows the normal convention: This is a NuttX internal function so it follows the convention that 0 (<code>OK</code>) is returned on success and a negated <code>errno</code> is returned on failure.
Returns 0 (<code>OK</code>) on success.
On failure, it returns -1 (<code>ERROR</code>) with <code>errno</code> set appropriately.
</ul> </ul>
<h3>2.3.7 <a name="exec"><code>exec()</code></a></h3> <h3>2.3.7 <a name="exec"><code>exec()</code></a></h3>
+4 -10
View File
@@ -9,7 +9,7 @@
<tr align="center" bgcolor="#e4e4e4"> <tr align="center" bgcolor="#e4e4e4">
<td> <td>
<h1><big><font color="#3c34ec"><i>NXFLAT</i></font></big></h1> <h1><big><font color="#3c34ec"><i>NXFLAT</i></font></big></h1>
<p>Last Updated: September 1, 2012</p> <p>Last Updated: October 1, 2017</p>
</td> </td>
</tr> </tr>
</table> </table>
@@ -652,9 +652,7 @@ cat ../syscall/syscall.csv ../libc/libc.csv | sort >tmp.csv
prep the module for execution. prep the module for execution.
</p> </p>
<p><b>Returned Value:</b> <p><b>Returned Value:</b>
This is an end-user function, so it follows the normal convention: This is a NuttX internal function so it follows the convention that 0 (<code>OK</code>) is returned on success and a negated <code>errno</code> is returned on failure.
Returns 0 (<code>OK</code>) on success. On failure, it returns -1 (<code>ERROR</code>) with
errno set appropriately.
</p> </p>
</ul> </ul>
@@ -665,9 +663,7 @@ cat ../syscall/syscall.csv ../libc/libc.csv | sort >tmp.csv
been started (via <code>exec_module()</code>), calling this will be fatal. been started (via <code>exec_module()</code>), calling this will be fatal.
</p> </p>
<p><b>Returned Value:</b> <p><b>Returned Value:</b>
This is a NuttX internal function so it follows the convention that This is a NuttX internal function so it follows the convention that 0 (<code>OK</code>) is returned on success and a negated <code>errno</code> is returned on failure.
0 (<code>OK</code>) is returned on success and a negated errno is returned on
failure.
</p> </p>
</ul> </ul>
@@ -677,9 +673,7 @@ cat ../syscall/syscall.csv ../libc/libc.csv | sort >tmp.csv
Execute a module that has been loaded into memory by load_module(). Execute a module that has been loaded into memory by load_module().
</p> </p>
<p><b>Returned Value:</b> <p><b>Returned Value:</b>
This is an end-user function, so it follows the normal convention: This is a NuttX internal function so it follows the convention that 0 (<code>OK</code>) is returned on success and a negated <code>errno</code> is returned on failure.
Returns the PID of the exec'ed module. On failure, it.returns
-1 (<code>ERROR</code>) and sets errno appropriately.
</p> </p>
</ul> </ul>
</ul> </ul>
+1 -1
View File
@@ -12,7 +12,7 @@
<h1><big><font color="#3c34ec"> <h1><big><font color="#3c34ec">
<i>NuttX RTOS Porting Guide</i> <i>NuttX RTOS Porting Guide</i>
</font></big></h1> </font></big></h1>
<p>Last Updated: August 30, 2017</p> <p>Last Updated: October 1, 2017</p>
</td> </td>
</tr> </tr>
</table> </table>
+8 -9
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* binfmt/binfmt_exec.c * binfmt/binfmt_exec.c
* *
* Copyright (C) 2009, 2013-2014 Gregory Nutt. All rights reserved. * Copyright (C) 2009, 2013-2014, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -120,7 +120,7 @@ int exec(FAR const char *filename, FAR char * const *argv,
ret = load_module(bin); ret = load_module(bin);
if (ret < 0) if (ret < 0)
{ {
errcode = get_errno(); errcode = -ret;
berr("ERROR: Failed to load program '%s': %d\n", filename, errcode); berr("ERROR: Failed to load program '%s': %d\n", filename, errcode);
goto errout_with_argv; goto errout_with_argv;
} }
@@ -137,7 +137,7 @@ int exec(FAR const char *filename, FAR char * const *argv,
pid = exec_module(bin); pid = exec_module(bin);
if (pid < 0) if (pid < 0)
{ {
errcode = get_errno(); errcode = -pid;
berr("ERROR: Failed to execute program '%s': %d\n", filename, errcode); berr("ERROR: Failed to execute program '%s': %d\n", filename, errcode);
goto errout_with_lock; goto errout_with_lock;
} }
@@ -149,8 +149,7 @@ int exec(FAR const char *filename, FAR char * const *argv,
ret = schedule_unload(pid, bin); ret = schedule_unload(pid, bin);
if (ret < 0) if (ret < 0)
{ {
errcode = get_errno(); berr("ERROR: Failed to schedule unload '%s': %d\n", filename, ret);
berr("ERROR: Failed to schedule unload '%s': %d\n", filename, errcode);
} }
sched_unlock(); sched_unlock();
@@ -158,7 +157,7 @@ int exec(FAR const char *filename, FAR char * const *argv,
errout_with_lock: errout_with_lock:
sched_unlock(); sched_unlock();
unload_module(bin); (void)unload_module(bin);
errout_with_argv: errout_with_argv:
binfmt_freeargv(bin); binfmt_freeargv(bin);
errout_with_bin: errout_with_bin:
@@ -182,7 +181,7 @@ errout:
ret = load_module(&bin); ret = load_module(&bin);
if (ret < 0) if (ret < 0)
{ {
errcode = get_errno(); errcode = -ret;
berr("ERROR: Failed to load program '%s': %d\n", filename, errcode); berr("ERROR: Failed to load program '%s': %d\n", filename, errcode);
goto errout; goto errout;
} }
@@ -192,7 +191,7 @@ errout:
ret = exec_module(&bin); ret = exec_module(&bin);
if (ret < 0) if (ret < 0)
{ {
errcode = get_errno(); errcode = -ret;
berr("ERROR: Failed to execute program '%s': %d\n", filename, errcode); berr("ERROR: Failed to execute program '%s': %d\n", filename, errcode);
goto errout_with_module; goto errout_with_module;
} }
@@ -202,7 +201,7 @@ errout:
return ret; return ret;
errout_with_module: errout_with_module:
unload_module(&bin); (void)unload_module(&bin);
errout: errout:
set_errno(errcode); set_errno(errcode);
return ERROR; return ERROR;
+13 -33
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* binfmt/binfmt_execmodule.c * binfmt/binfmt_execmodule.c
* *
* Copyright (C) 2009, 2013-2014 Gregory Nutt. All rights reserved. * Copyright (C) 2009, 2013-2014, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -69,14 +69,6 @@
# errror "CONFIG_SCHED_STARTHOOK must be defined to use constructors" # errror "CONFIG_SCHED_STARTHOOK must be defined to use constructors"
#endif #endif
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Private Functions * Private Functions
****************************************************************************/ ****************************************************************************/
@@ -128,9 +120,9 @@ static void exec_ctors(FAR void *arg)
* Execute a module that has been loaded into memory by load_module(). * Execute a module that has been loaded into memory by load_module().
* *
* Returned Value: * Returned Value:
* This is an end-user function, so it follows the normal convention: * This is a NuttX internal function so it follows the convention that
* Returns the PID of the exec'ed module. On failure, it returns * 0 (OK) is returned on success and a negated errno is returned on
* -1 (ERROR) and sets errno appropriately. * failure.
* *
****************************************************************************/ ****************************************************************************/
@@ -142,7 +134,6 @@ int exec_module(FAR const struct binary_s *binp)
#endif #endif
FAR uint32_t *stack; FAR uint32_t *stack;
pid_t pid; pid_t pid;
int errcode;
int ret; int ret;
/* Sanity checking */ /* Sanity checking */
@@ -150,8 +141,7 @@ int exec_module(FAR const struct binary_s *binp)
#ifdef CONFIG_DEBUG_FEATURES #ifdef CONFIG_DEBUG_FEATURES
if (!binp || !binp->entrypt || binp->stacksize <= 0) if (!binp || !binp->entrypt || binp->stacksize <= 0)
{ {
errcode = EINVAL; return -EINVAL;
goto errout;
} }
#endif #endif
@@ -162,8 +152,7 @@ int exec_module(FAR const struct binary_s *binp)
tcb = (FAR struct task_tcb_s *)kmm_zalloc(sizeof(struct task_tcb_s)); tcb = (FAR struct task_tcb_s *)kmm_zalloc(sizeof(struct task_tcb_s));
if (!tcb) if (!tcb)
{ {
errcode = ENOMEM; return -ENOMEM;
goto errout;
} }
#if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_BUILD_KERNEL) #if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_BUILD_KERNEL)
@@ -173,7 +162,6 @@ int exec_module(FAR const struct binary_s *binp)
if (ret < 0) if (ret < 0)
{ {
berr("ERROR: up_addrenv_select() failed: %d\n", ret); berr("ERROR: up_addrenv_select() failed: %d\n", ret);
errcode = -ret;
goto errout_with_tcb; goto errout_with_tcb;
} }
@@ -192,7 +180,7 @@ int exec_module(FAR const struct binary_s *binp)
stack = (FAR uint32_t *)kumm_malloc(binp->stacksize); stack = (FAR uint32_t *)kumm_malloc(binp->stacksize);
if (!stack) if (!stack)
{ {
errcode = ENOMEM; ret = -ENOMEM;
goto errout_with_addrenv; goto errout_with_addrenv;
} }
@@ -202,8 +190,8 @@ int exec_module(FAR const struct binary_s *binp)
stack, binp->stacksize, binp->entrypt, binp->argv); stack, binp->stacksize, binp->entrypt, binp->argv);
if (ret < 0) if (ret < 0)
{ {
errcode = get_errno(); ret = -get_errno();
berr("task_init() failed: %d\n", errcode); berr("task_init() failed: %d\n", ret);
goto errout_with_addrenv; goto errout_with_addrenv;
} }
@@ -225,7 +213,6 @@ int exec_module(FAR const struct binary_s *binp)
if (ret < 0) if (ret < 0)
{ {
berr("ERROR: up_addrenv_select() failed: %d\n", ret); berr("ERROR: up_addrenv_select() failed: %d\n", ret);
errcode = -ret;
goto errout_with_tcbinit; goto errout_with_tcbinit;
} }
#endif #endif
@@ -237,7 +224,6 @@ int exec_module(FAR const struct binary_s *binp)
if (ret < 0) if (ret < 0)
{ {
berr("ERROR: shm_group_initialize() failed: %d\n", ret); berr("ERROR: shm_group_initialize() failed: %d\n", ret);
errcode = -ret;
goto errout_with_tcbinit; goto errout_with_tcbinit;
} }
#endif #endif
@@ -260,7 +246,6 @@ int exec_module(FAR const struct binary_s *binp)
ret = up_addrenv_clone(&binp->addrenv, &tcb->cmn.group->tg_addrenv); ret = up_addrenv_clone(&binp->addrenv, &tcb->cmn.group->tg_addrenv);
if (ret < 0) if (ret < 0)
{ {
errcode = -ret;
berr("ERROR: up_addrenv_clone() failed: %d\n", ret); berr("ERROR: up_addrenv_clone() failed: %d\n", ret);
goto errout_with_tcbinit; goto errout_with_tcbinit;
} }
@@ -291,8 +276,8 @@ int exec_module(FAR const struct binary_s *binp)
ret = task_activate((FAR struct tcb_s *)tcb); ret = task_activate((FAR struct tcb_s *)tcb);
if (ret < 0) if (ret < 0)
{ {
errcode = get_errno(); ret = -get_errno();
berr("task_activate() failed: %d\n", errcode); berr("task_activate() failed: %d\n", ret);
goto errout_with_tcbinit; goto errout_with_tcbinit;
} }
@@ -303,7 +288,6 @@ int exec_module(FAR const struct binary_s *binp)
if (ret < 0) if (ret < 0)
{ {
berr("ERROR: up_addrenv_select() failed: %d\n", ret); berr("ERROR: up_addrenv_select() failed: %d\n", ret);
errcode = -ret;
goto errout_with_tcbinit; goto errout_with_tcbinit;
} }
#endif #endif
@@ -314,7 +298,7 @@ errout_with_tcbinit:
tcb->cmn.stack_alloc_ptr = NULL; tcb->cmn.stack_alloc_ptr = NULL;
sched_releasetcb(&tcb->cmn, TCB_FLAG_TTYPE_TASK); sched_releasetcb(&tcb->cmn, TCB_FLAG_TTYPE_TASK);
kumm_free(stack); kumm_free(stack);
goto errout; return ret;
errout_with_addrenv: errout_with_addrenv:
#if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_BUILD_KERNEL) #if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_BUILD_KERNEL)
@@ -323,11 +307,7 @@ errout_with_addrenv:
errout_with_tcb: errout_with_tcb:
#endif #endif
kmm_free(tcb); kmm_free(tcb);
return ret;
errout:
set_errno(errcode);
berr("returning errno: %d\n", errcode);
return ERROR;
} }
#endif /* CONFIG_BINFMT_DISABLE */ #endif /* CONFIG_BINFMT_DISABLE */
+11 -21
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* binfmt/binfmt_loadmodule.c * binfmt/binfmt_loadmodule.c
* *
* Copyright (C) 2009, 2014 Gregory Nutt. All rights reserved. * Copyright (C) 2009, 2014, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -76,8 +76,8 @@
* between calls to load_module() and exec_module(). * between calls to load_module() and exec_module().
* *
* Returned Value: * Returned Value:
* Zero (OK) is returned on success; Otherwise, -1 (ERROR) is returned and * Zero (OK) is returned on success; Otherwise a negated errno value is
* the errno variable is set appropriately. * returned.
* *
****************************************************************************/ ****************************************************************************/
@@ -91,8 +91,9 @@ static int load_default_priority(FAR struct binary_s *bin)
ret = sched_getparam(0, &param); ret = sched_getparam(0, &param);
if (ret < 0) if (ret < 0)
{ {
berr("ERROR: sched_getparam failed: %d\n", get_errno()); ret = -get_errno();
return ERROR; berr("ERROR: sched_getparam failed: %d\n", ret);
return ret;
} }
/* Save that as the priority of child thread */ /* Save that as the priority of child thread */
@@ -168,9 +169,9 @@ static int load_absmodule(FAR struct binary_s *bin)
* prep the module for execution. * prep the module for execution.
* *
* Returned Value: * Returned Value:
* This is an end-user function, so it follows the normal convention: * This is a NuttX internal function so it follows the convention that
* Returns 0 (OK) on success. On failure, it returns -1 (ERROR) with * 0 (OK) is returned on success and a negated errno is returned on
* errno set appropriately. * failure.
* *
****************************************************************************/ ****************************************************************************/
@@ -189,9 +190,7 @@ int load_module(FAR struct binary_s *bin)
ret = load_default_priority(bin); ret = load_default_priority(bin);
if (ret < 0) if (ret < 0)
{ {
/* The errno is already set in this case */ return ret;
return ERROR;
} }
/* Were we given a relative path? Or an absolute path to the file to /* Were we given a relative path? Or an absolute path to the file to
@@ -258,16 +257,7 @@ int load_module(FAR struct binary_s *bin)
} }
} }
/* This is an end-user function. Return failures via errno */ return ret;
if (ret < 0)
{
berr("ERROR: Returning errno %d\n", -ret);
set_errno(-ret);
return ERROR;
}
return OK;
} }
#endif /* CONFIG_BINFMT_DISABLE */ #endif /* CONFIG_BINFMT_DISABLE */
+9 -15
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* binfmt/binfmt_schedunload.c * binfmt/binfmt_schedunload.c
* *
* Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved. * Copyright (C) 2013, 2016-2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -227,7 +227,7 @@ static void unload_callback(int signo, siginfo_t *info, void *ucontext)
ret = unload_module(bin); ret = unload_module(bin);
if (ret < 0) if (ret < 0)
{ {
berr("ERROR: unload_module failed: %d\n", get_errno()); berr("ERROR: unload_module() failed: %d\n", ret);
} }
/* Free the load structure */ /* Free the load structure */
@@ -256,9 +256,9 @@ static void unload_callback(int signo, siginfo_t *info, void *ucontext)
* persist until the task unloads * persist until the task unloads
* *
* Returned Value: * Returned Value:
* This is an end-user function, so it follows the normal convention: * This is a NuttX internal function so it follows the convention that
* It returns 0 (OK) if the callback was successfully scheduled. On * 0 (OK) is returned on success and a negated errno is returned on
* failure, it returns -1 (ERROR) and sets errno appropriately. * failure.
* *
* On failures, the 'bin' structure will not be deallocated and the * On failures, the 'bin' structure will not be deallocated and the
* module not not be unloaded. * module not not be unloaded.
@@ -271,7 +271,6 @@ int schedule_unload(pid_t pid, FAR struct binary_s *bin)
struct sigaction oact; struct sigaction oact;
sigset_t set; sigset_t set;
irqstate_t flags; irqstate_t flags;
int errorcode;
int ret; int ret;
/* Make sure that SIGCHLD is unmasked */ /* Make sure that SIGCHLD is unmasked */
@@ -283,9 +282,9 @@ int schedule_unload(pid_t pid, FAR struct binary_s *bin)
{ {
/* The errno value will get trashed by the following debug output */ /* The errno value will get trashed by the following debug output */
errorcode = get_errno(); ret = -get_errno();
berr("ERROR: sigprocmask failed: %d\n", ret); berr("ERROR: sigprocmask failed: %d\n", ret);
goto errout; return ret;
} }
/* Add the structure to the list. We want to do this *before* connecting /* Add the structure to the list. We want to do this *before* connecting
@@ -309,7 +308,7 @@ int schedule_unload(pid_t pid, FAR struct binary_s *bin)
{ {
/* The errno value will get trashed by the following debug output */ /* The errno value will get trashed by the following debug output */
errorcode = get_errno(); ret = -get_errno();
berr("ERROR: sigaction failed: %d\n" , ret); berr("ERROR: sigaction failed: %d\n" , ret);
/* Emergency removal from the list */ /* Emergency removal from the list */
@@ -321,14 +320,9 @@ int schedule_unload(pid_t pid, FAR struct binary_s *bin)
} }
leave_critical_section(flags); leave_critical_section(flags);
goto errout;
} }
return OK; return ret;
errout:
set_errno(errorcode);
return ERROR;
} }
#endif /* !CONFIG_BINFMT_DISABLE && CONFIG_SCHED_HAVE_PARENT */ #endif /* !CONFIG_BINFMT_DISABLE && CONFIG_SCHED_HAVE_PARENT */
+3 -5
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* binfmt/binfmt_loadmodule.c * binfmt/binfmt_loadmodule.c
* *
* Copyright (C) 2009, 2012-2013 Gregory Nutt. All rights reserved. * Copyright (C) 2009, 2012-2013, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -162,8 +162,7 @@ int unload_module(FAR struct binary_s *binp)
if (ret < 0) if (ret < 0)
{ {
berr("binp->unload() failed: %d\n", ret); berr("binp->unload() failed: %d\n", ret);
set_errno(-ret); return ret;
return ERROR;
} }
} }
@@ -174,8 +173,7 @@ int unload_module(FAR struct binary_s *binp)
if (ret < 0) if (ret < 0)
{ {
berr("exec_ctors() failed: %d\n", ret); berr("exec_ctors() failed: %d\n", ret);
set_errno(-ret); return ret;
return ERROR;
} }
#endif #endif
+1 -1
View File
@@ -300,7 +300,7 @@ static void pcode_onexit(int exitcode, FAR void *arg)
/* And unload the module */ /* And unload the module */
unload_module(binp); (void)unload_module(binp);
} }
#endif #endif
+12 -12
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* include/nuttx/binfmt/binfmt.h * include/nuttx/binfmt/binfmt.h
* *
* Copyright (C) 2009, 2012, 2014 Gregory Nutt. All rights reserved. * Copyright (C) 2009, 2012, 2014, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -215,9 +215,9 @@ int unregister_binfmt(FAR struct binfmt_s *binfmt);
* prep the module for execution. * prep the module for execution.
* *
* Returned Value: * Returned Value:
* This is an end-user function, so it follows the normal convention: * This is a NuttX internal function so it follows the convention that
* Returns 0 (OK) on success. On failure, it returns -1 (ERROR) with * 0 (OK) is returned on success and a negated errno is returned on
* errno set appropriately. * failure.
* *
****************************************************************************/ ****************************************************************************/
@@ -251,9 +251,9 @@ int unload_module(FAR struct binary_s *bin);
* Execute a module that has been loaded into memory by load_module(). * Execute a module that has been loaded into memory by load_module().
* *
* Returned Value: * Returned Value:
* This is an end-user function, so it follows the normal convention: * This is a NuttX internal function so it follows the convention that
* Returns the PID of the exec'ed module. On failure, it returns * 0 (OK) is returned on success and a negated errno is returned on
* -1 (ERROR) and sets errno appropriately. * failure.
* *
****************************************************************************/ ****************************************************************************/
@@ -267,8 +267,8 @@ int exec_module(FAR const struct binary_s *bin);
* the parent of the newly created task to automatically unload the * the parent of the newly created task to automatically unload the
* module when the task exits. This assumes that (1) the caller is the * module when the task exits. This assumes that (1) the caller is the
* parent of the created task, (2) that bin was allocated with kmm_malloc() * parent of the created task, (2) that bin was allocated with kmm_malloc()
* or friends. It will also automatically free the structure with kmm_free() * or friends. It will also automatically free the structure with
* after unloading the module. * kmm_free() after unloading the module.
* *
* Input Parameter: * Input Parameter:
* pid - The task ID of the child task * pid - The task ID of the child task
@@ -276,9 +276,9 @@ int exec_module(FAR const struct binary_s *bin);
* persist until the task unloads * persist until the task unloads
* *
* Returned Value: * Returned Value:
* This is an end-user function, so it follows the normal convention: * This is a NuttX internal function so it follows the convention that
* It returns 0 (OK) if the callback was successfully scheduled. On * 0 (OK) is returned on success and a negated errno is returned on
* failure, it returns -1 (ERROR) and sets errno appropriately. * failure.
* *
****************************************************************************/ ****************************************************************************/