nuttx/sched: Remove explicit references to errno. That is a problem from within the kernel for certain configurations

This commit is contained in:
Gregory Nutt 2014-08-28 17:00:24 -06:00
parent 9ab67dce75
commit 0ab1b0de25
15 changed files with 26 additions and 25 deletions

View File

@ -93,7 +93,7 @@ int gettimeofday(struct timeval *tp, void *tzp)
#ifdef CONFIG_DEBUG
if (!tp)
{
errno = EINVAL;
set_errno(EINVAL);
return ERROR;
}
#endif

View File

@ -113,7 +113,7 @@ int putenv(FAR const char *string)
return ret;
errout:
errno = ret;
set_errno(ret);
return ERROR;
}

View File

@ -197,7 +197,7 @@ int setenv(FAR const char *name, FAR const char *value, int overwrite)
errout_with_lock:
sched_unlock();
errout:
errno = ret;
set_errno(ret);
return ERROR;
}

View File

@ -35,7 +35,7 @@
ERRNO_SRCS = errno_getptr.c
ifeq ($(CONFIG_NUTTX_KERNEL),y)
ifeq ($(CONFIG_LIB_SYSCALL),y)
ERRNO_SRCS += errno_get.c errno_set.c
endif

View File

@ -104,7 +104,7 @@ int pthread_setschedprio(pthread_t thread, int prio)
/* Set the errno to some non-zero value (failsafe) */
errno = EINVAL;
set_errno(EINVAL);
/* Call sched_setparam() to change the priority */
@ -114,7 +114,8 @@ int pthread_setschedprio(pthread_t thread, int prio)
{
/* If sched_setparam() fails, return the errno */
ret = errno;
ret = get_errno();
}
return ret;
}

View File

@ -115,7 +115,7 @@ int sched_setparam(pid_t pid, const struct sched_param *param)
if (!param)
{
errno = EINVAL;
set_errno(EINVAL);
return ERROR;
}
@ -142,7 +142,7 @@ int sched_setparam(pid_t pid, const struct sched_param *param)
{
/* No task with this pid was found */
errno = ESRCH;
set_errno(ESRCH);
sched_unlock();
return ERROR;
}

View File

@ -112,7 +112,7 @@ int sched_setpriority(FAR struct tcb_s *tcb, int sched_priority)
if (sched_priority < SCHED_PRIORITY_MIN ||
sched_priority > SCHED_PRIORITY_MAX)
{
errno = EINVAL;
set_errno(EINVAL);
return ERROR;
}

View File

@ -122,7 +122,7 @@ int sched_setscheduler(pid_t pid, int policy,
if (policy != SCHED_FIFO)
#endif
{
errno = EINVAL;
set_errno(EINVAL);
return ERROR;
}
@ -138,7 +138,7 @@ int sched_setscheduler(pid_t pid, int policy,
tcb = sched_gettcb(pid);
if (!tcb)
{
errno = ESRCH;
set_errno(ESRCH);
return ERROR;
}

View File

@ -120,7 +120,7 @@ int sem_destroy (FAR sem_t *sem)
}
else
{
errno = -EINVAL;
set_errno(EINVAL);
return ERROR;
}
}

View File

@ -132,7 +132,7 @@ static int posix_spawn_exec(FAR pid_t *pidp, FAR const char *path,
pid = exec(path, (FAR char * const *)argv, symtab, nsymbols);
if (pid < 0)
{
ret = errno;
ret = get_errno();
sdbg("ERROR: exec failed: %d\n", ret);
goto errout;
}
@ -403,7 +403,7 @@ int posix_spawn(FAR pid_t *pid, FAR const char *path,
ret = sched_getparam(0, &param);
if (ret < 0)
{
int errcode = errno;
int errcode = get_errno();
sdbg("ERROR: sched_getparam failed: %d\n", errcode);
spawn_semgive(&g_spawn_parmsem);

View File

@ -152,7 +152,7 @@ static int task_spawn_exec(FAR pid_t *pidp, FAR const char *name,
pid = TASK_CREATE(name, priority, stacksize, entry, argv);
if (pid < 0)
{
ret = errno;
ret = get_errno();
sdbg("ERROR: TASK_CREATE failed: %d\n", ret);
goto errout;
}
@ -395,7 +395,7 @@ int task_spawn(FAR pid_t *pid, FAR const char *name, main_t entry,
ret = sched_getparam(0, &param);
if (ret < 0)
{
int errcode = errno;
int errcode = get_errno();
sdbg("ERROR: sched_getparam failed: %d\n", errcode);
spawn_semgive(&g_spawn_parmsem);

View File

@ -108,7 +108,7 @@ static inline int spawn_dup2(FAR struct spawn_dup2_file_action_s *action)
ret = dup2(action->fd1, action->fd2);
if (ret < 0)
{
int errcode = errno;
int errcode = get_errno();
sdbg("ERROR: dup2 failed: %d\n", errcode);
return errcode;
@ -130,7 +130,7 @@ static inline int spawn_open(FAR struct spawn_open_file_action_s *action)
fd = open(action->path, action->oflags, action->mode);
if (fd < 0)
{
ret = errno;
ret = get_errno();
sdbg("ERROR: open failed: %d\n", ret);
}
@ -147,7 +147,7 @@ static inline int spawn_open(FAR struct spawn_open_file_action_s *action)
ret = dup2(fd, action->fd);
if (ret < 0)
{
ret = errno;
ret = get_errno();
sdbg("ERROR: dup2 failed: %d\n", ret);
}
@ -184,7 +184,7 @@ void spawn_semtake(FAR sem_t *sem)
do
{
ret = sem_wait(sem);
ASSERT(ret == 0 || errno == EINTR);
ASSERT(ret == 0 || get_errno() == EINTR);
}
while (ret != 0);
}

View File

@ -184,7 +184,7 @@ int timer_create(clockid_t clockid, FAR struct sigevent *evp, FAR timer_t *timer
if (!timerid || clockid != CLOCK_REALTIME)
{
errno = EINVAL;
set_errno(EINVAL);
return ERROR;
}
@ -193,7 +193,7 @@ int timer_create(clockid_t clockid, FAR struct sigevent *evp, FAR timer_t *timer
wdog = wd_create();
if (!wdog)
{
errno = EAGAIN;
set_errno(EAGAIN);
return ERROR;
}
@ -202,7 +202,7 @@ int timer_create(clockid_t clockid, FAR struct sigevent *evp, FAR timer_t *timer
ret = timer_allocate();
if (!ret)
{
errno = EAGAIN;
set_errno(EAGAIN);
return ERROR;
}

View File

@ -104,7 +104,7 @@
int timer_getoverrun(timer_t timerid)
{
errno = ENOSYS;
set_errno(ENOSYS);
return ERROR;
}

View File

@ -304,7 +304,7 @@ int timer_settime(timer_t timerid, int flags, FAR const struct itimerspec *value
if (!timer || !value)
{
errno = EINVAL;
set_errno(EINVAL);
return ERROR;
}