summaryrefslogtreecommitdiff
path: root/nuttx/binfmt
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-08-28 17:00:43 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-08-28 17:00:43 -0600
commit0c8c1a071f909e0adee75bc75194898585d94a3f (patch)
treebf0dc1487b4b0af2763be974e9a7193c990f7c13 /nuttx/binfmt
parentb0c533ed376fe69068ab63396eca17de3bbbeab7 (diff)
downloadnuttx-0c8c1a071f909e0adee75bc75194898585d94a3f.tar.gz
nuttx-0c8c1a071f909e0adee75bc75194898585d94a3f.tar.bz2
nuttx-0c8c1a071f909e0adee75bc75194898585d94a3f.zip
nuttx/sched: Remove explicit references to errno. That is a problem from within the kernel for certain configurations
Diffstat (limited to 'nuttx/binfmt')
-rw-r--r--nuttx/binfmt/binfmt_execmodule.c6
-rw-r--r--nuttx/binfmt/binfmt_loadmodule.c4
-rw-r--r--nuttx/binfmt/builtin.c6
-rw-r--r--nuttx/binfmt/pcode.c14
4 files changed, 15 insertions, 15 deletions
diff --git a/nuttx/binfmt/binfmt_execmodule.c b/nuttx/binfmt/binfmt_execmodule.c
index 07c507233..00637d45c 100644
--- a/nuttx/binfmt/binfmt_execmodule.c
+++ b/nuttx/binfmt/binfmt_execmodule.c
@@ -185,7 +185,7 @@ int exec_module(FAR const struct binary_s *binp)
#endif
if (ret < 0)
{
- err = errno;
+ err = get_errno();
bdbg("task_init() failed: %d\n", err);
goto errout_with_stack;
}
@@ -239,7 +239,7 @@ int exec_module(FAR const struct binary_s *binp)
ret = task_activate((FAR struct tcb_s *)tcb);
if (ret < 0)
{
- err = errno;
+ err = get_errno();
bdbg("task_activate() failed: %d\n", err);
goto errout_with_stack;
}
@@ -259,7 +259,7 @@ errout_with_stack:
errout_with_tcb:
kfree(tcb);
errout:
- errno = err;
+ set_errno(err);
bdbg("returning errno: %d\n", err);
return ERROR;
}
diff --git a/nuttx/binfmt/binfmt_loadmodule.c b/nuttx/binfmt/binfmt_loadmodule.c
index 00e199b8e..5ff7f7535 100644
--- a/nuttx/binfmt/binfmt_loadmodule.c
+++ b/nuttx/binfmt/binfmt_loadmodule.c
@@ -91,7 +91,7 @@ static int load_default_priority(FAR struct binary_s *bin)
ret = sched_getparam(0, &param);
if (ret < 0)
{
- bdbg("ERROR: sched_getparam failed: %d\n", errno);
+ bdbg("ERROR: sched_getparam failed: %d\n", get_errno());
return ERROR;
}
@@ -263,7 +263,7 @@ int load_module(FAR struct binary_s *bin)
if (ret < 0)
{
bdbg("Returning errno %d\n", -ret);
- errno = -ret;
+ set_errno(-ret);
return ERROR;
}
diff --git a/nuttx/binfmt/builtin.c b/nuttx/binfmt/builtin.c
index 4731d8815..4e6b18c9c 100644
--- a/nuttx/binfmt/builtin.c
+++ b/nuttx/binfmt/builtin.c
@@ -102,7 +102,7 @@ static int builtin_loadbinary(struct binary_s *binp)
fd = open(binp->filename, O_RDONLY);
if (fd < 0)
{
- int errval = errno;
+ int errval = get_errno();
bdbg("ERROR: Failed to open binary %s: %d\n", binp->filename, errval);
return -errval;
}
@@ -114,7 +114,7 @@ static int builtin_loadbinary(struct binary_s *binp)
ret = ioctl(fd, FIOC_FILENAME, (unsigned long)((uintptr_t)&filename));
if (ret < 0)
{
- int errval = errno;
+ int errval = get_errno();
bdbg("ERROR: FIOC_FILENAME ioctl failed: %d\n", errval);
return -errval;
}
@@ -126,7 +126,7 @@ static int builtin_loadbinary(struct binary_s *binp)
index = builtin_isavail(filename);
if (index < 0)
{
- int errval = errno;
+ int errval = get_errno();
bdbg("ERROR: %s is not a builtin application\n", filename);
return -errval;
diff --git a/nuttx/binfmt/pcode.c b/nuttx/binfmt/pcode.c
index bd476b4f2..ce244a269 100644
--- a/nuttx/binfmt/pcode.c
+++ b/nuttx/binfmt/pcode.c
@@ -187,7 +187,7 @@ static int pcode_mount_testfs(void)
"romfs", MS_RDONLY, NULL);
if (ret < 0)
{
- int errval = errno;
+ int errval = get_errno();
DEBUGASSERT(errval > 0);
bdbg("ERROR: mount(%s,%s,romfs) failed: %d\n",
@@ -265,7 +265,7 @@ static int pcode_proxy(int argc, char **argv)
ret = on_exit(pcode_onexit, binp);
if (ret < 0)
{
- bdbg("ERROR: on_exit failed: %d\n", errno);
+ bdbg("ERROR: on_exit failed: %d\n", get_errno());
kfree(fullpath);
return EXIT_FAILURE;
}
@@ -316,7 +316,7 @@ static int pcode_load(struct binary_s *binp)
fd = open(binp->filename, O_RDONLY);
if (fd < 0)
{
- int errval = errno;
+ int errval = get_errno();
bdbg("ERROR: Failed to open binary %s: %d\n", binp->filename, errval);
return -errval;
}
@@ -335,7 +335,7 @@ static int pcode_load(struct binary_s *binp)
* simply interrupted by a signal.
*/
- int errval = errno;
+ int errval = get_errno();
DEBUGASSERT(errval > 0);
if (errval != EINTR)
@@ -383,7 +383,7 @@ static int pcode_load(struct binary_s *binp)
do
{
ret = sem_wait(&g_pcode_handoff.exclsem);
- DEBUGASSERT(ret == OK || errno == EINTR);
+ DEBUGASSERT(ret == OK || get_errno() == EINTR);
}
while (ret < 0);
@@ -508,7 +508,7 @@ void pcode_uninitialize(void)
ret = unregister_binfmt(&g_pcode_binfmt);
if (ret < 0)
{
- int errval = errno;
+ int errval = get_errno();
DEBUGASSERT(errval > 0);
bdbg("ERROR: unregister_binfmt() failed: %d\n", errval);
@@ -519,7 +519,7 @@ void pcode_uninitialize(void)
ret = umount(CONFIG_PCODE_TEST_MOUNTPOINT);
if (ret < 0)
{
- int errval = errno;
+ int errval = get_errno();
DEBUGASSERT(errval > 0);
bdbg("ERROR: umount(%s) failed: %d\n", CONFIG_PCODE_TEST_MOUNTPOINT, errval);