mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 06:32:32 +08:00
nuttx/sched: Remove explicit references to errno. That is a problem from within the kernel for certain configurations
This commit is contained in:
@@ -93,7 +93,7 @@ int gettimeofday(struct timeval *tp, void *tzp)
|
|||||||
#ifdef CONFIG_DEBUG
|
#ifdef CONFIG_DEBUG
|
||||||
if (!tp)
|
if (!tp)
|
||||||
{
|
{
|
||||||
errno = EINVAL;
|
set_errno(EINVAL);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ int putenv(FAR const char *string)
|
|||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
errout:
|
errout:
|
||||||
errno = ret;
|
set_errno(ret);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ int setenv(FAR const char *name, FAR const char *value, int overwrite)
|
|||||||
errout_with_lock:
|
errout_with_lock:
|
||||||
sched_unlock();
|
sched_unlock();
|
||||||
errout:
|
errout:
|
||||||
errno = ret;
|
set_errno(ret);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
ERRNO_SRCS = errno_getptr.c
|
ERRNO_SRCS = errno_getptr.c
|
||||||
|
|
||||||
ifeq ($(CONFIG_NUTTX_KERNEL),y)
|
ifeq ($(CONFIG_LIB_SYSCALL),y)
|
||||||
ERRNO_SRCS += errno_get.c errno_set.c
|
ERRNO_SRCS += errno_get.c errno_set.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ int pthread_setschedprio(pthread_t thread, int prio)
|
|||||||
|
|
||||||
/* Set the errno to some non-zero value (failsafe) */
|
/* Set the errno to some non-zero value (failsafe) */
|
||||||
|
|
||||||
errno = EINVAL;
|
set_errno(EINVAL);
|
||||||
|
|
||||||
/* Call sched_setparam() to change the priority */
|
/* 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 */
|
/* If sched_setparam() fails, return the errno */
|
||||||
|
|
||||||
ret = errno;
|
ret = get_errno();
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ int sched_setparam(pid_t pid, const struct sched_param *param)
|
|||||||
|
|
||||||
if (!param)
|
if (!param)
|
||||||
{
|
{
|
||||||
errno = EINVAL;
|
set_errno(EINVAL);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,7 +142,7 @@ int sched_setparam(pid_t pid, const struct sched_param *param)
|
|||||||
{
|
{
|
||||||
/* No task with this pid was found */
|
/* No task with this pid was found */
|
||||||
|
|
||||||
errno = ESRCH;
|
set_errno(ESRCH);
|
||||||
sched_unlock();
|
sched_unlock();
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ int sched_setpriority(FAR struct tcb_s *tcb, int sched_priority)
|
|||||||
if (sched_priority < SCHED_PRIORITY_MIN ||
|
if (sched_priority < SCHED_PRIORITY_MIN ||
|
||||||
sched_priority > SCHED_PRIORITY_MAX)
|
sched_priority > SCHED_PRIORITY_MAX)
|
||||||
{
|
{
|
||||||
errno = EINVAL;
|
set_errno(EINVAL);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ int sched_setscheduler(pid_t pid, int policy,
|
|||||||
if (policy != SCHED_FIFO)
|
if (policy != SCHED_FIFO)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
errno = EINVAL;
|
set_errno(EINVAL);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,7 +138,7 @@ int sched_setscheduler(pid_t pid, int policy,
|
|||||||
tcb = sched_gettcb(pid);
|
tcb = sched_gettcb(pid);
|
||||||
if (!tcb)
|
if (!tcb)
|
||||||
{
|
{
|
||||||
errno = ESRCH;
|
set_errno(ESRCH);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ int sem_destroy (FAR sem_t *sem)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
errno = -EINVAL;
|
set_errno(EINVAL);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
pid = exec(path, (FAR char * const *)argv, symtab, nsymbols);
|
||||||
if (pid < 0)
|
if (pid < 0)
|
||||||
{
|
{
|
||||||
ret = errno;
|
ret = get_errno();
|
||||||
sdbg("ERROR: exec failed: %d\n", ret);
|
sdbg("ERROR: exec failed: %d\n", ret);
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
@@ -403,7 +403,7 @@ int posix_spawn(FAR pid_t *pid, FAR const char *path,
|
|||||||
ret = sched_getparam(0, ¶m);
|
ret = sched_getparam(0, ¶m);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
int errcode = errno;
|
int errcode = get_errno();
|
||||||
|
|
||||||
sdbg("ERROR: sched_getparam failed: %d\n", errcode);
|
sdbg("ERROR: sched_getparam failed: %d\n", errcode);
|
||||||
spawn_semgive(&g_spawn_parmsem);
|
spawn_semgive(&g_spawn_parmsem);
|
||||||
|
|||||||
@@ -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);
|
pid = TASK_CREATE(name, priority, stacksize, entry, argv);
|
||||||
if (pid < 0)
|
if (pid < 0)
|
||||||
{
|
{
|
||||||
ret = errno;
|
ret = get_errno();
|
||||||
sdbg("ERROR: TASK_CREATE failed: %d\n", ret);
|
sdbg("ERROR: TASK_CREATE failed: %d\n", ret);
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
@@ -395,7 +395,7 @@ int task_spawn(FAR pid_t *pid, FAR const char *name, main_t entry,
|
|||||||
ret = sched_getparam(0, ¶m);
|
ret = sched_getparam(0, ¶m);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
int errcode = errno;
|
int errcode = get_errno();
|
||||||
|
|
||||||
sdbg("ERROR: sched_getparam failed: %d\n", errcode);
|
sdbg("ERROR: sched_getparam failed: %d\n", errcode);
|
||||||
spawn_semgive(&g_spawn_parmsem);
|
spawn_semgive(&g_spawn_parmsem);
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ static inline int spawn_dup2(FAR struct spawn_dup2_file_action_s *action)
|
|||||||
ret = dup2(action->fd1, action->fd2);
|
ret = dup2(action->fd1, action->fd2);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
int errcode = errno;
|
int errcode = get_errno();
|
||||||
|
|
||||||
sdbg("ERROR: dup2 failed: %d\n", errcode);
|
sdbg("ERROR: dup2 failed: %d\n", errcode);
|
||||||
return 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);
|
fd = open(action->path, action->oflags, action->mode);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
{
|
{
|
||||||
ret = errno;
|
ret = get_errno();
|
||||||
sdbg("ERROR: open failed: %d\n", ret);
|
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);
|
ret = dup2(fd, action->fd);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
ret = errno;
|
ret = get_errno();
|
||||||
sdbg("ERROR: dup2 failed: %d\n", ret);
|
sdbg("ERROR: dup2 failed: %d\n", ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,7 +184,7 @@ void spawn_semtake(FAR sem_t *sem)
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
ret = sem_wait(sem);
|
ret = sem_wait(sem);
|
||||||
ASSERT(ret == 0 || errno == EINTR);
|
ASSERT(ret == 0 || get_errno() == EINTR);
|
||||||
}
|
}
|
||||||
while (ret != 0);
|
while (ret != 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ int timer_create(clockid_t clockid, FAR struct sigevent *evp, FAR timer_t *timer
|
|||||||
|
|
||||||
if (!timerid || clockid != CLOCK_REALTIME)
|
if (!timerid || clockid != CLOCK_REALTIME)
|
||||||
{
|
{
|
||||||
errno = EINVAL;
|
set_errno(EINVAL);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,7 +193,7 @@ int timer_create(clockid_t clockid, FAR struct sigevent *evp, FAR timer_t *timer
|
|||||||
wdog = wd_create();
|
wdog = wd_create();
|
||||||
if (!wdog)
|
if (!wdog)
|
||||||
{
|
{
|
||||||
errno = EAGAIN;
|
set_errno(EAGAIN);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,7 +202,7 @@ int timer_create(clockid_t clockid, FAR struct sigevent *evp, FAR timer_t *timer
|
|||||||
ret = timer_allocate();
|
ret = timer_allocate();
|
||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
errno = EAGAIN;
|
set_errno(EAGAIN);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,7 @@
|
|||||||
|
|
||||||
int timer_getoverrun(timer_t timerid)
|
int timer_getoverrun(timer_t timerid)
|
||||||
{
|
{
|
||||||
errno = ENOSYS;
|
set_errno(ENOSYS);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -304,7 +304,7 @@ int timer_settime(timer_t timerid, int flags, FAR const struct itimerspec *value
|
|||||||
|
|
||||||
if (!timer || !value)
|
if (!timer || !value)
|
||||||
{
|
{
|
||||||
errno = EINVAL;
|
set_errno(EINVAL);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user