mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 14:53:47 +08:00
Reserver the name 'err' for other purposes
This commit is contained in:
+17
-18
@@ -86,7 +86,7 @@ int exec(FAR const char *filename, FAR char * const *argv,
|
||||
#if defined(CONFIG_SCHED_ONEXIT) && defined(CONFIG_SCHED_HAVE_PARENT)
|
||||
FAR struct binary_s *bin;
|
||||
int pid;
|
||||
int err;
|
||||
int errcode;
|
||||
int ret;
|
||||
|
||||
/* Allocate the load information */
|
||||
@@ -95,7 +95,7 @@ int exec(FAR const char *filename, FAR char * const *argv,
|
||||
if (!bin)
|
||||
{
|
||||
bdbg("ERROR: Failed to allocate binary_s\n");
|
||||
err = ENOMEM;
|
||||
errcode = ENOMEM;
|
||||
goto errout;
|
||||
}
|
||||
|
||||
@@ -110,8 +110,8 @@ int exec(FAR const char *filename, FAR char * const *argv,
|
||||
ret = binfmt_copyargv(bin, argv);
|
||||
if (ret < 0)
|
||||
{
|
||||
err = -ret;
|
||||
bdbg("ERROR: Failed to copy argv[]: %d\n", err);
|
||||
errcode = -ret;
|
||||
bdbg("ERROR: Failed to copy argv[]: %d\n", errcode);
|
||||
goto errout_with_bin;
|
||||
}
|
||||
|
||||
@@ -120,8 +120,8 @@ int exec(FAR const char *filename, FAR char * const *argv,
|
||||
ret = load_module(bin);
|
||||
if (ret < 0)
|
||||
{
|
||||
err = get_errno();
|
||||
bdbg("ERROR: Failed to load program '%s': %d\n", filename, err);
|
||||
errcode = get_errno();
|
||||
bdbg("ERROR: Failed to load program '%s': %d\n", filename, errcode);
|
||||
goto errout_with_argv;
|
||||
}
|
||||
|
||||
@@ -137,8 +137,8 @@ int exec(FAR const char *filename, FAR char * const *argv,
|
||||
pid = exec_module(bin);
|
||||
if (pid < 0)
|
||||
{
|
||||
err = get_errno();
|
||||
bdbg("ERROR: Failed to execute program '%s': %d\n", filename, err);
|
||||
errcode = get_errno();
|
||||
bdbg("ERROR: Failed to execute program '%s': %d\n", filename, errcode);
|
||||
goto errout_with_lock;
|
||||
}
|
||||
|
||||
@@ -149,8 +149,8 @@ int exec(FAR const char *filename, FAR char * const *argv,
|
||||
ret = schedule_unload(pid, bin);
|
||||
if (ret < 0)
|
||||
{
|
||||
err = get_errno();
|
||||
bdbg("ERROR: Failed to schedule unload '%s': %d\n", filename, err);
|
||||
errcode = get_errno();
|
||||
bdbg("ERROR: Failed to schedule unload '%s': %d\n", filename, errcode);
|
||||
}
|
||||
|
||||
sched_unlock();
|
||||
@@ -164,12 +164,12 @@ errout_with_argv:
|
||||
errout_with_bin:
|
||||
kmm_free(bin);
|
||||
errout:
|
||||
set_errno(err);
|
||||
set_errno(errcode);
|
||||
return ERROR;
|
||||
|
||||
#else
|
||||
struct binary_s bin;
|
||||
int err;
|
||||
int errcode;
|
||||
int ret;
|
||||
|
||||
/* Load the module into memory */
|
||||
@@ -182,8 +182,8 @@ errout:
|
||||
ret = load_module(&bin);
|
||||
if (ret < 0)
|
||||
{
|
||||
err = get_errno();
|
||||
bdbg("ERROR: Failed to load program '%s': %d\n", filename, err);
|
||||
errcode = get_errno();
|
||||
bdbg("ERROR: Failed to load program '%s': %d\n", filename, errcode);
|
||||
goto errout;
|
||||
}
|
||||
|
||||
@@ -192,8 +192,8 @@ errout:
|
||||
ret = exec_module(&bin);
|
||||
if (ret < 0)
|
||||
{
|
||||
err = get_errno();
|
||||
bdbg("ERROR: Failed to execute program '%s': %d\n", filename, err);
|
||||
errcode = get_errno();
|
||||
bdbg("ERROR: Failed to execute program '%s': %d\n", filename, errcode);
|
||||
goto errout_with_module;
|
||||
}
|
||||
|
||||
@@ -204,10 +204,9 @@ errout:
|
||||
errout_with_module:
|
||||
unload_module(&bin);
|
||||
errout:
|
||||
set_errno(err);
|
||||
set_errno(errcode);
|
||||
return ERROR;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* !CONFIG_BINFMT_DISABLE */
|
||||
|
||||
|
||||
+15
-15
@@ -142,7 +142,7 @@ int exec_module(FAR const struct binary_s *binp)
|
||||
#endif
|
||||
FAR uint32_t *stack;
|
||||
pid_t pid;
|
||||
int err;
|
||||
int errcode;
|
||||
int ret;
|
||||
|
||||
/* Sanity checking */
|
||||
@@ -150,7 +150,7 @@ int exec_module(FAR const struct binary_s *binp)
|
||||
#ifdef CONFIG_DEBUG_FEATURES
|
||||
if (!binp || !binp->entrypt || binp->stacksize <= 0)
|
||||
{
|
||||
err = EINVAL;
|
||||
errcode = EINVAL;
|
||||
goto errout;
|
||||
}
|
||||
#endif
|
||||
@@ -162,7 +162,7 @@ int exec_module(FAR const struct binary_s *binp)
|
||||
tcb = (FAR struct task_tcb_s *)kmm_zalloc(sizeof(struct task_tcb_s));
|
||||
if (!tcb)
|
||||
{
|
||||
err = ENOMEM;
|
||||
errcode = ENOMEM;
|
||||
goto errout;
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ int exec_module(FAR const struct binary_s *binp)
|
||||
if (ret < 0)
|
||||
{
|
||||
bdbg("ERROR: up_addrenv_select() failed: %d\n", ret);
|
||||
err = -ret;
|
||||
errcode = -ret;
|
||||
goto errout_with_tcb;
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ int exec_module(FAR const struct binary_s *binp)
|
||||
stack = (FAR uint32_t *)kumm_malloc(binp->stacksize);
|
||||
if (!stack)
|
||||
{
|
||||
err = ENOMEM;
|
||||
errcode = ENOMEM;
|
||||
goto errout_with_addrenv;
|
||||
}
|
||||
|
||||
@@ -202,8 +202,8 @@ int exec_module(FAR const struct binary_s *binp)
|
||||
stack, binp->stacksize, binp->entrypt, binp->argv);
|
||||
if (ret < 0)
|
||||
{
|
||||
err = get_errno();
|
||||
bdbg("task_init() failed: %d\n", err);
|
||||
errcode = get_errno();
|
||||
bdbg("task_init() failed: %d\n", errcode);
|
||||
goto errout_with_addrenv;
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ int exec_module(FAR const struct binary_s *binp)
|
||||
if (ret < 0)
|
||||
{
|
||||
bdbg("ERROR: up_addrenv_select() failed: %d\n", ret);
|
||||
err = -ret;
|
||||
errcode = -ret;
|
||||
goto errout_with_tcbinit;
|
||||
}
|
||||
#endif
|
||||
@@ -237,7 +237,7 @@ int exec_module(FAR const struct binary_s *binp)
|
||||
if (ret < 0)
|
||||
{
|
||||
bdbg("ERROR: shm_group_initialize() failed: %d\n", ret);
|
||||
err = -ret;
|
||||
errcode = -ret;
|
||||
goto errout_with_tcbinit;
|
||||
}
|
||||
#endif
|
||||
@@ -260,7 +260,7 @@ int exec_module(FAR const struct binary_s *binp)
|
||||
ret = up_addrenv_clone(&binp->addrenv, &tcb->cmn.group->tg_addrenv);
|
||||
if (ret < 0)
|
||||
{
|
||||
err = -ret;
|
||||
errcode = -ret;
|
||||
bdbg("ERROR: up_addrenv_clone() failed: %d\n", ret);
|
||||
goto errout_with_tcbinit;
|
||||
}
|
||||
@@ -288,8 +288,8 @@ int exec_module(FAR const struct binary_s *binp)
|
||||
ret = task_activate((FAR struct tcb_s *)tcb);
|
||||
if (ret < 0)
|
||||
{
|
||||
err = get_errno();
|
||||
bdbg("task_activate() failed: %d\n", err);
|
||||
errcode = get_errno();
|
||||
bdbg("task_activate() failed: %d\n", errcode);
|
||||
goto errout_with_tcbinit;
|
||||
}
|
||||
|
||||
@@ -300,7 +300,7 @@ int exec_module(FAR const struct binary_s *binp)
|
||||
if (ret < 0)
|
||||
{
|
||||
bdbg("ERROR: up_addrenv_select() failed: %d\n", ret);
|
||||
err = -ret;
|
||||
errcode = -ret;
|
||||
goto errout_with_tcbinit;
|
||||
}
|
||||
#endif
|
||||
@@ -322,8 +322,8 @@ errout_with_tcb:
|
||||
kmm_free(tcb);
|
||||
|
||||
errout:
|
||||
set_errno(err);
|
||||
bdbg("returning errno: %d\n", err);
|
||||
set_errno(errcode);
|
||||
bdbg("returning errno: %d\n", errcode);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user