aboutsummaryrefslogtreecommitdiff
path: root/nuttx/sched
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/sched')
-rw-r--r--nuttx/sched/Kconfig35
-rw-r--r--nuttx/sched/Makefile16
-rw-r--r--nuttx/sched/atexit.c16
-rw-r--r--nuttx/sched/clock_time2ticks.c2
-rw-r--r--nuttx/sched/env_clearenv.c2
-rw-r--r--nuttx/sched/env_internal.h2
-rw-r--r--nuttx/sched/env_release.c4
-rw-r--r--nuttx/sched/mq_open.c3
-rw-r--r--nuttx/sched/on_exit.c5
-rw-r--r--nuttx/sched/os_bringup.c19
-rw-r--r--nuttx/sched/os_start.c4
-rw-r--r--nuttx/sched/pause.c110
-rw-r--r--nuttx/sched/prctl.c6
-rw-r--r--nuttx/sched/pthread_create.c63
-rw-r--r--nuttx/sched/sched_getscheduler.c1
-rw-r--r--nuttx/sched/sched_releasetcb.c6
-rw-r--r--nuttx/sched/sem_open.c3
-rw-r--r--nuttx/sched/sleep.c2
-rw-r--r--nuttx/sched/task_exithook.c5
-rw-r--r--nuttx/sched/usleep.c2
-rw-r--r--nuttx/sched/work_thread.c6
21 files changed, 242 insertions, 70 deletions
diff --git a/nuttx/sched/Kconfig b/nuttx/sched/Kconfig
index 4f7149595..bfaec3b5d 100644
--- a/nuttx/sched/Kconfig
+++ b/nuttx/sched/Kconfig
@@ -22,7 +22,13 @@ config SCHED_INSTRUMENTATION
bool "Monitor system performance"
default n
---help---
- enables instrumentation in scheduler to monitor system performance.
+ Enables instrumentation in scheduler to monitor system performance.
+ If enabled, then the board-specific logic must provide the following
+ functions (see include/sched.h):
+
+ void sched_note_start(FAR _TCB *tcb);
+ void sched_note_stop(FAR _TCB *tcb);
+ void sched_note_switch(FAR _TCB *pFromTcb, FAR _TCB *pToTcb);
config TASK_NAME_SIZE
int "Maximum task name size"
@@ -40,7 +46,7 @@ config JULIAN_TIME
config START_YEAR
int "start year"
- default 2010
+ default 2013
config START_MONTH
int "start month"
@@ -57,12 +63,6 @@ config DEV_CONSOLE
Set if architecture-specific logic provides /dev/console. Enables
stdout, stderr, stdin.
-config DEV_LOWCONSOLE
- bool "enable low-level serial console"
- default n
- ---help---
- Use the simple, low-level, write-only serial console driver (minimul support)
-
config MUTEX_TYPES:
bool "Enable mutex types"
default n
@@ -214,12 +214,17 @@ config SCHED_ATEXIT
config SCHED_ATEXIT_MAX
int "Max number of atexit() functions"
default 1
- depends on SCHED_ATEXIT
+ depends on SCHED_ATEXIT && !SCHED_ONEXIT
---help---
By default if SCHED_ATEXIT is selected, only a single atexit() function
is supported. That number can be increased by defined this setting to
the number that you require.
+ If both SCHED_ONEXIT and SCHED_ATEXIT are selected, then atexit() is built
+ on top of the on_exit() implementation. In that case, SCHED_ONEXIT_MAX
+ determines the size of the combined number of atexit(0) and on_exit calls
+ and SCHED_ATEXIT_MAX is not used.
+
config SCHED_ONEXIT
bool "Enable on_exit() API"
default n
@@ -235,6 +240,10 @@ config SCHED_ONEXIT_MAX
is supported. That number can be increased by defined this setting to the
number that you require.
+ If both SCHED_ONEXIT and SCHED_ATEXIT are selected, then atexit() is built
+ on top of the on_exit() implementation. In that case, SCHED_ONEXIT_MAX
+ determines the size of the combined number of atexit(0) and on_exit calls.
+
config USER_ENTRYPOINT
string "Application entry point"
default "user_start"
@@ -381,14 +390,6 @@ config PREALLOC_TIMERS
comment "Stack and heap information"
-config CUSTOM_STACK
- bool "Enable custom stack"
- default n
- ---help---
- The up_ implementation will handle all stack operations outside of the
- nuttx model. This is necessary for certain architectures that have
- have hardware stacks (such as the 8051 family).
-
config IDLETHREAD_STACKSIZE
int "Idle thread stack size"
default 1024
diff --git a/nuttx/sched/Makefile b/nuttx/sched/Makefile
index 1e0a55aea..82f74fc3c 100644
--- a/nuttx/sched/Makefile
+++ b/nuttx/sched/Makefile
@@ -94,7 +94,7 @@ SIGNAL_SRCS = sig_initialize.c \
sig_findaction.c sig_allocatependingsigaction.c \
sig_releasependingsigaction.c sig_unmaskpendingsignal.c \
sig_removependingsignal.c sig_releasependingsignal.c sig_lowest.c \
- sig_mqnotempty.c sig_cleanup.c sig_received.c sig_deliver.c
+ sig_mqnotempty.c sig_cleanup.c sig_received.c sig_deliver.c pause.c
MQUEUE_SRCS = mq_open.c mq_close.c mq_unlink.c mq_send.c mq_timedsend.c\
mq_sndinternal.c mq_receive.c mq_timedreceive.c mq_rcvinternal.c \
@@ -188,6 +188,7 @@ OBJS = $(AOBJS) $(COBJS)
BIN = libsched$(LIBEXT)
all: $(BIN)
+.PHONY: context depend clean distclean
$(AOBJS): %$(OBJEXT): %.S
$(call ASSEMBLE, $<, $@)
@@ -196,21 +197,20 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
$(BIN): $(OBJS)
- @( for obj in $(OBJS) ; do \
- $(call ARCHIVE, $@, $${obj}); \
- done ; )
+ $(call ARCHIVE, $@, $(OBJS))
.depend: Makefile $(SRCS)
- @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
- @touch $@
+ $(Q) $(MKDEP) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
+ $(Q) touch $@
depend: .depend
clean:
- @rm -f $(BIN) *~ .*.swp
+ $(call DELFILE, $(BIN))
$(call CLEAN)
distclean: clean
- @rm -f Make.dep .depend
+ $(call DELFILE, Make.dep)
+ $(call DELFILE, .depend)
-include Make.dep
diff --git a/nuttx/sched/atexit.c b/nuttx/sched/atexit.c
index f7d81bec2..b0559b01b 100644
--- a/nuttx/sched/atexit.c
+++ b/nuttx/sched/atexit.c
@@ -96,8 +96,13 @@
* CONFIG_SCHED_ATEXIT_MAX defines a larger number.
* 2. atexit functions are not inherited when a new task is
* created.
+ * 3. If both SCHED_ONEXIT and SCHED_ATEXIT are selected, then atexit()
+ * is built on top of the on_exit() implementation. In that case,
+ * CONFIG_SCHED_ONEXIT_MAX determines the size of the combined
+ * number of atexit(0) and on_exit calls and SCHED_ATEXIT_MAX is
+ * not used.
*
- * Parameters:
+ * Input Parameters:
* func - A pointer to the function to be called when the task exits.
*
* Return Value:
@@ -107,7 +112,14 @@
int atexit(void (*func)(void))
{
-#if defined(CONFIG_SCHED_ATEXIT_MAX) && CONFIG_SCHED_ATEXIT_MAX > 1
+#if defined(CONFIG_SCHED_ONEXIT)
+ /* atexit is equivalent to on_exit() with no argument (Assuming that the ABI
+ * can handle a callback function that recieves more parameters than it expects).
+ */
+
+ return on_exit(onexitfunc_t func, NULL);
+
+#elif defined(CONFIG_SCHED_ATEXIT_MAX) && CONFIG_SCHED_ATEXIT_MAX > 1
_TCB *tcb = (_TCB*)g_readytorun.head;
int index;
int ret = ERROR;
diff --git a/nuttx/sched/clock_time2ticks.c b/nuttx/sched/clock_time2ticks.c
index 383264d51..9265872bb 100644
--- a/nuttx/sched/clock_time2ticks.c
+++ b/nuttx/sched/clock_time2ticks.c
@@ -97,6 +97,6 @@ int clock_time2ticks(FAR const struct timespec *reltime, FAR int *ticks)
/* Convert microseconds to clock ticks */
- *ticks = relusec / USEC_PER_TICK;
+ *ticks = (relusec + USEC_PER_TICK - 1) / USEC_PER_TICK;
return OK;
}
diff --git a/nuttx/sched/env_clearenv.c b/nuttx/sched/env_clearenv.c
index 7fe97a911..75890f3bc 100644
--- a/nuttx/sched/env_clearenv.c
+++ b/nuttx/sched/env_clearenv.c
@@ -79,5 +79,3 @@ int clearenv(void)
#endif /* CONFIG_DISABLE_ENVIRON */
-
-
diff --git a/nuttx/sched/env_internal.h b/nuttx/sched/env_internal.h
index a6205d658..5370da059 100644
--- a/nuttx/sched/env_internal.h
+++ b/nuttx/sched/env_internal.h
@@ -80,7 +80,7 @@ EXTERN int env_dup(FAR _TCB *ptcb);
EXTERN int env_share(FAR _TCB *ptcb);
EXTERN int env_release(FAR _TCB *ptcb);
-/* functions used internally the environment handling logic */
+/* functions used internally by the environment handling logic */
EXTERN FAR char *env_findvar(environ_t *envp, const char *pname);
EXTERN int env_removevar(environ_t *envp, char *pvar);
diff --git a/nuttx/sched/env_release.c b/nuttx/sched/env_release.c
index 83e65dbb5..8bc8d2205 100644
--- a/nuttx/sched/env_release.c
+++ b/nuttx/sched/env_release.c
@@ -94,11 +94,11 @@ int env_release(FAR _TCB *ptcb)
{
/* Check the reference count on the environment structure */
- if ( envp->ev_crefs <= 1)
+ if (envp->ev_crefs <= 1)
{
/* Decrementing the reference count will destroy the environment */
- sched_free( envp ); /* plain free() should be fine here */
+ sched_free(envp);
}
else
{
diff --git a/nuttx/sched/mq_open.c b/nuttx/sched/mq_open.c
index 5e1b9b137..89d80f072 100644
--- a/nuttx/sched/mq_open.c
+++ b/nuttx/sched/mq_open.c
@@ -113,7 +113,6 @@ mqd_t mq_open(const char *mq_name, int oflags, ...)
FAR msgq_t *msgq;
mqd_t mqdes = NULL;
va_list arg; /* Points to each un-named argument */
- mode_t mode; /* MQ creation mode parameter (ignored) */
struct mq_attr *attr; /* MQ creation attributes */
int namelen; /* Length of MQ name */
@@ -170,7 +169,7 @@ mqd_t mq_open(const char *mq_name, int oflags, ...)
*/
va_start(arg, oflags);
- mode = va_arg(arg, mode_t);
+ (void)va_arg(arg, mode_t); /* MQ creation mode parameter (ignored) */
attr = va_arg(arg, struct mq_attr*);
/* Initialize the new named message queue */
diff --git a/nuttx/sched/on_exit.c b/nuttx/sched/on_exit.c
index 5b8be5cd1..19a4f9196 100644
--- a/nuttx/sched/on_exit.c
+++ b/nuttx/sched/on_exit.c
@@ -117,7 +117,7 @@ int on_exit(CODE void (*func)(int, FAR void *), FAR void *arg)
#if defined(CONFIG_SCHED_ONEXIT_MAX) && CONFIG_SCHED_ONEXIT_MAX > 1
_TCB *tcb = (_TCB*)g_readytorun.head;
int index;
- int ret = ERROR;
+ int ret = ENOSPC;
/* The following must be atomic */
@@ -131,7 +131,6 @@ int on_exit(CODE void (*func)(int, FAR void *), FAR void *arg)
* indices.
*/
- available = -1;
for (index = 0; index < CONFIG_SCHED_ONEXIT_MAX; index++)
{
if (!tcb->onexitfunc[index])
@@ -149,7 +148,7 @@ int on_exit(CODE void (*func)(int, FAR void *), FAR void *arg)
return ret;
#else
_TCB *tcb = (_TCB*)g_readytorun.head;
- int ret = ERROR;
+ int ret = ENOSPC;
/* The following must be atomic */
diff --git a/nuttx/sched/os_bringup.c b/nuttx/sched/os_bringup.c
index ec6152891..e0a236bbe 100644
--- a/nuttx/sched/os_bringup.c
+++ b/nuttx/sched/os_bringup.c
@@ -44,6 +44,7 @@
#include <nuttx/config.h>
#include <sched.h>
+#include <stdlib.h>
#include <debug.h>
#include <nuttx/init.h>
@@ -129,6 +130,17 @@ int os_bringup(void)
#endif
int init_taskid;
+ /* Setup up the initial environment for the idle task. At present, this
+ * may consist of only the initial PATH variable. The PATH variable is
+ * (probably) not used by the IDLE task. However, the environment
+ * containing the PATH variable will be inherited by all of the threads
+ * created by the IDLE task.
+ */
+
+#if !defined(CONFIG_DISABLE_ENVIRON) && defined(CONFIG_PATH_INITIAL)
+ (void)setenv("PATH", CONFIG_PATH_INITIAL, 1);
+#endif
+
/* Start the page fill worker kernel thread that will resolve page faults.
* This should always be the first thread started because it may have to
* resolve page faults in other threads
@@ -190,5 +202,12 @@ int os_bringup(void)
(main_t)CONFIG_USER_ENTRYPOINT, (const char **)NULL);
#endif
ASSERT(init_taskid != ERROR);
+
+ /* We an save a few bytes by discarding the IDLE thread's environment. */
+
+#if !defined(CONFIG_DISABLE_ENVIRON) && defined(CONFIG_PATH_INITIAL)
+ (void)clearenv();
+#endif
+
return OK;
}
diff --git a/nuttx/sched/os_start.c b/nuttx/sched/os_start.c
index c0b16236d..a53ac2aa8 100644
--- a/nuttx/sched/os_start.c
+++ b/nuttx/sched/os_start.c
@@ -426,7 +426,9 @@ void os_start(void)
lib_initialize();
}
- /* Create stdout, stderr, stdin */
+ /* Create stdout, stderr, stdin on the IDLE task. These will be
+ * inherited by all of the threads created by the IDLE task.
+ */
(void)sched_setupidlefiles(&g_idletcb);
diff --git a/nuttx/sched/pause.c b/nuttx/sched/pause.c
new file mode 100644
index 000000000..607c4c775
--- /dev/null
+++ b/nuttx/sched/pause.c
@@ -0,0 +1,110 @@
+/****************************************************************************
+ * sched/pause.c
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <unistd.h>
+#include <signal.h>
+
+/****************************************************************************
+ * Preprocessor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Type Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Global Variables
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Variables
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: pause
+ *
+ * Description:
+ * The pause() function will suspend the calling thread until delivery of a
+ * non-blocked signal.
+ *
+ * Input Parameters:
+ * None
+ *
+ * Returned Value:
+ * Since pause() suspends thread execution indefinitely unless interrupted
+ * a signal, there is no successful completion return value. A value of -1
+ * will always be returned and errno set to indicate the error (EINTR).
+ *
+ * POSIX compatibility:
+ * In the POSIX description of this function is the pause() function will
+ * suspend the calling thread until delivery of a signal whose action is
+ * either to execute a signal-catching function or to terminate the
+ * process. This implementation only waits for any non-blocked signal
+ * to be received.
+ *
+ ****************************************************************************/
+
+int pause(void)
+{
+ sigset_t set;
+ struct siginfo value;
+
+ /* Set up for the sleep. Using the empty set means that we are not
+ * waiting for any particular signal. However, any unmasked signal
+ * can still awaken sigtimedwait().
+ */
+
+ (void)sigemptyset(&set);
+
+ /* sigtwaitinfo() cannot succeed. It should always return error EINTR
+ * meaning that some unblocked signal was caught.
+ */
+
+ return sigwaitinfo(&set, &value);
+}
diff --git a/nuttx/sched/prctl.c b/nuttx/sched/prctl.c
index d71a0e174..3db83d3d7 100644
--- a/nuttx/sched/prctl.c
+++ b/nuttx/sched/prctl.c
@@ -157,8 +157,14 @@ int prctl(int option, ...)
goto errout;
}
+ /* Not reachable unless CONFIG_TASK_NAME_SIZE is > 0. NOTE: This might
+ * change if additional commands are supported.
+ */
+
+#if CONFIG_TASK_NAME_SIZE > 0
va_end(ap);
return OK;
+#endif
errout:
va_end(ap);
diff --git a/nuttx/sched/pthread_create.c b/nuttx/sched/pthread_create.c
index 5fdf3b88d..dc2db2916 100644
--- a/nuttx/sched/pthread_create.c
+++ b/nuttx/sched/pthread_create.c
@@ -246,7 +246,7 @@ int pthread_create(FAR pthread_t *thread, FAR pthread_attr_t *attr,
{
FAR _TCB *ptcb;
FAR join_t *pjoin;
- int status;
+ int ret;
int priority;
#if CONFIG_RR_INTERVAL > 0
int policy;
@@ -268,13 +268,27 @@ int pthread_create(FAR pthread_t *thread, FAR pthread_attr_t *attr,
return ENOMEM;
}
+ /* Share the address environment of the parent task. NOTE: Only tasks
+ * created throught the nuttx/binfmt loaders may have an address
+ * environment.
+ */
+
+#ifdef CONFIG_ADDRENV
+ ret = up_addrenv_share((FAR const _TCB *)g_readytorun.head, ptcb);
+ if (ret < 0)
+ {
+ sched_releasetcb(ptcb);
+ return -ret;
+ }
+#endif
+
/* Associate file descriptors with the new task */
- status = sched_setuppthreadfiles(ptcb);
- if (status != OK)
+ ret = sched_setuppthreadfiles(ptcb);
+ if (ret != OK)
{
sched_releasetcb(ptcb);
- return status;
+ return ret;
}
/* Share the parent's envionment */
@@ -292,8 +306,8 @@ int pthread_create(FAR pthread_t *thread, FAR pthread_attr_t *attr,
/* Allocate the stack for the TCB */
- status = up_create_stack(ptcb, attr->stacksize);
- if (status != OK)
+ ret = up_create_stack(ptcb, attr->stacksize);
+ if (ret != OK)
{
sched_releasetcb(ptcb);
sched_free(pjoin);
@@ -310,8 +324,8 @@ int pthread_create(FAR pthread_t *thread, FAR pthread_attr_t *attr,
/* Get the priority for this thread. */
struct sched_param param;
- status = sched_getparam(0, &param);
- if (status == OK)
+ ret = sched_getparam(0, &param);
+ if (ret == OK)
{
priority = param.sched_priority;
}
@@ -348,11 +362,9 @@ int pthread_create(FAR pthread_t *thread, FAR pthread_attr_t *attr,
/* Initialize the task control block */
- status = task_schedsetup(ptcb, priority, pthread_start,
- (main_t)start_routine);
- if (status != OK)
+ ret = task_schedsetup(ptcb, priority, pthread_start, (main_t)start_routine);
+ if (ret != OK)
{
-
sched_releasetcb(ptcb);
sched_free(pjoin);
return EBUSY;
@@ -390,21 +402,21 @@ int pthread_create(FAR pthread_t *thread, FAR pthread_attr_t *attr,
/* Initialize the semaphores in the join structure to zero. */
- status = sem_init(&pjoin->data_sem, 0, 0);
- if (status == OK)
+ ret = sem_init(&pjoin->data_sem, 0, 0);
+ if (ret == OK)
{
- status = sem_init(&pjoin->exit_sem, 0, 0);
+ ret = sem_init(&pjoin->exit_sem, 0, 0);
}
/* Activate the task */
sched_lock();
- if (status == OK)
+ if (ret == OK)
{
- status = task_activate(ptcb);
+ ret = task_activate(ptcb);
}
- if (status == OK)
+ if (ret == OK)
{
/* Wait for the task to actually get running and to register
* its join_t
@@ -414,8 +426,15 @@ int pthread_create(FAR pthread_t *thread, FAR pthread_attr_t *attr,
/* Return the thread information to the caller */
- if (thread) *thread = (pthread_t)pid;
- if (!pjoin->started) status = ERROR;
+ if (thread)
+ {
+ *thread = (pthread_t)pid;
+ }
+
+ if (!pjoin->started)
+ {
+ ret = EINVAL;
+ }
sched_unlock();
(void)sem_destroy(&pjoin->data_sem);
@@ -428,8 +447,8 @@ int pthread_create(FAR pthread_t *thread, FAR pthread_attr_t *attr,
(void)sem_destroy(&pjoin->exit_sem);
sched_releasetcb(ptcb);
sched_free(pjoin);
- return EIO;
+ ret = EIO;
}
- return OK;
+ return ret;
}
diff --git a/nuttx/sched/sched_getscheduler.c b/nuttx/sched/sched_getscheduler.c
index 5771e86ff..0d996ca27 100644
--- a/nuttx/sched/sched_getscheduler.c
+++ b/nuttx/sched/sched_getscheduler.c
@@ -129,3 +129,4 @@ int sched_getscheduler(pid_t pid)
return SCHED_FIFO;
}
}
+
diff --git a/nuttx/sched/sched_releasetcb.c b/nuttx/sched/sched_releasetcb.c
index 21837262d..0557c829b 100644
--- a/nuttx/sched/sched_releasetcb.c
+++ b/nuttx/sched/sched_releasetcb.c
@@ -171,6 +171,12 @@ int sched_releasetcb(FAR _TCB *tcb)
(void)env_release(tcb);
+ /* Release this thread's reference to the address environment */
+
+#ifdef CONFIG_ADDRENV
+ ret = up_addrenv_release(tcb);
+#endif
+
/* And, finally, release the TCB itself */
sched_free(tcb);
diff --git a/nuttx/sched/sem_open.c b/nuttx/sched/sem_open.c
index 817c36b49..b2b76fe38 100644
--- a/nuttx/sched/sem_open.c
+++ b/nuttx/sched/sem_open.c
@@ -120,7 +120,6 @@ FAR sem_t *sem_open (FAR const char *name, int oflag, ...)
FAR nsem_t *psem;
FAR sem_t *sem = (FAR sem_t*)ERROR;
va_list arg; /* Points to each un-named argument */
- mode_t mode; /* Creation mode parameter (ignored) */
unsigned int value; /* Semaphore value parameter */
/* Make sure that a non-NULL name is supplied */
@@ -165,7 +164,7 @@ FAR sem_t *sem_open (FAR const char *name, int oflag, ...)
*/
va_start(arg, oflag);
- mode = va_arg(arg, mode_t);
+ (void)va_arg(arg, mode_t); /* Creation mode parameter (ignored) */
value = va_arg(arg, unsigned int);
/* Verify that a legal initial value was selected. */
diff --git a/nuttx/sched/sleep.c b/nuttx/sched/sleep.c
index 03884a5b6..9b3b6d57f 100644
--- a/nuttx/sched/sleep.c
+++ b/nuttx/sched/sleep.c
@@ -141,7 +141,7 @@ unsigned int sleep(unsigned int seconds)
if (seconds)
{
/* Set up for the sleep. Using the empty set means that we are not
- * waiting for any particualar signal. However, any unmasked signal
+ * waiting for any particular signal. However, any unmasked signal
* can still awaken sigtimedwait().
*/
diff --git a/nuttx/sched/task_exithook.c b/nuttx/sched/task_exithook.c
index e94476f2a..3bde8fb7a 100644
--- a/nuttx/sched/task_exithook.c
+++ b/nuttx/sched/task_exithook.c
@@ -81,8 +81,8 @@
* Call any registerd atexit function(s)
*
****************************************************************************/
-
-#ifdef CONFIG_SCHED_ATEXIT
+
+#if defined(CONFIG_SCHED_ATEXIT) && !defined(CONFIG_SCHED_ONEXIT)
static inline void task_atexit(FAR _TCB *tcb)
{
#if defined(CONFIG_SCHED_ATEXIT_MAX) && CONFIG_SCHED_ATEXIT_MAX > 1
@@ -126,6 +126,7 @@ static inline void task_atexit(FAR _TCB *tcb)
tcb->atexitfunc = NULL;
}
#endif
+}
#else
# define task_atexit(tcb)
#endif
diff --git a/nuttx/sched/usleep.c b/nuttx/sched/usleep.c
index 21996d788..893a420f4 100644
--- a/nuttx/sched/usleep.c
+++ b/nuttx/sched/usleep.c
@@ -137,7 +137,7 @@ int usleep(useconds_t usec)
if (usec)
{
/* Set up for the sleep. Using the empty set means that we are not
- * waiting for any particualar signal. However, any unmasked signal
+ * waiting for any particular signal. However, any unmasked signal
* can still awaken sigtimedwait().
*/
diff --git a/nuttx/sched/work_thread.c b/nuttx/sched/work_thread.c
index abd86f771..5646b06a1 100644
--- a/nuttx/sched/work_thread.c
+++ b/nuttx/sched/work_thread.c
@@ -208,10 +208,10 @@ int work_hpthread(int argc, char *argv[])
* that were queued because they could not be freed in that execution
* context (for example, if the memory was freed from an interrupt handler).
* NOTE: If the work thread is disabled, this clean-up is performed by
- * the IDLE thread (at a very, very lower priority).
+ * the IDLE thread (at a very, very low priority).
*/
-#ifdef CONFIG_SCHED_LPWORK
+#ifndef CONFIG_SCHED_LPWORK
sched_garbagecollection();
#endif
@@ -236,7 +236,7 @@ int work_lpthread(int argc, char *argv[])
* that were queued because they could not be freed in that execution
* context (for example, if the memory was freed from an interrupt handler).
* NOTE: If the work thread is disabled, this clean-up is performed by
- * the IDLE thread (at a very, very lower priority).
+ * the IDLE thread (at a very, very low priority).
*/
sched_garbagecollection();