diff options
Diffstat (limited to 'nuttx/sched')
-rw-r--r-- | nuttx/sched/Kconfig | 11 | ||||
-rw-r--r-- | nuttx/sched/Makefile | 16 | ||||
-rw-r--r-- | nuttx/sched/atexit.c | 16 | ||||
-rw-r--r-- | nuttx/sched/mq_open.c | 3 | ||||
-rw-r--r-- | nuttx/sched/on_exit.c | 5 | ||||
-rw-r--r-- | nuttx/sched/pause.c | 110 | ||||
-rw-r--r-- | nuttx/sched/sched_getscheduler.c | 1 | ||||
-rw-r--r-- | nuttx/sched/sem_holder.c | 2 | ||||
-rw-r--r-- | nuttx/sched/sem_open.c | 3 | ||||
-rw-r--r-- | nuttx/sched/sleep.c | 2 | ||||
-rw-r--r-- | nuttx/sched/task_exithook.c | 4 | ||||
-rw-r--r-- | nuttx/sched/usleep.c | 2 |
12 files changed, 23 insertions, 152 deletions
diff --git a/nuttx/sched/Kconfig b/nuttx/sched/Kconfig index bfaec3b5d..3438ccf2c 100644 --- a/nuttx/sched/Kconfig +++ b/nuttx/sched/Kconfig @@ -214,17 +214,12 @@ config SCHED_ATEXIT config SCHED_ATEXIT_MAX int "Max number of atexit() functions" default 1 - depends on SCHED_ATEXIT && !SCHED_ONEXIT + depends on SCHED_ATEXIT ---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 @@ -240,10 +235,6 @@ 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" diff --git a/nuttx/sched/Makefile b/nuttx/sched/Makefile index 82f74fc3c..1e0a55aea 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 pause.c + sig_mqnotempty.c sig_cleanup.c sig_received.c sig_deliver.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,7 +188,6 @@ OBJS = $(AOBJS) $(COBJS) BIN = libsched$(LIBEXT) all: $(BIN) -.PHONY: context depend clean distclean $(AOBJS): %$(OBJEXT): %.S $(call ASSEMBLE, $<, $@) @@ -197,20 +196,21 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) $(BIN): $(OBJS) - $(call ARCHIVE, $@, $(OBJS)) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $@, $${obj}); \ + done ; ) .depend: Makefile $(SRCS) - $(Q) $(MKDEP) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - $(Q) touch $@ + @$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ depend: .depend clean: - $(call DELFILE, $(BIN)) + @rm -f $(BIN) *~ .*.swp $(call CLEAN) distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) + @rm -f Make.dep .depend -include Make.dep diff --git a/nuttx/sched/atexit.c b/nuttx/sched/atexit.c index b0559b01b..f7d81bec2 100644 --- a/nuttx/sched/atexit.c +++ b/nuttx/sched/atexit.c @@ -96,13 +96,8 @@ * 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. * - * Input Parameters: + * Parameters: * func - A pointer to the function to be called when the task exits. * * Return Value: @@ -112,14 +107,7 @@ int atexit(void (*func)(void)) { -#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 +#if 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/mq_open.c b/nuttx/sched/mq_open.c index 89d80f072..5e1b9b137 100644 --- a/nuttx/sched/mq_open.c +++ b/nuttx/sched/mq_open.c @@ -113,6 +113,7 @@ 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 */ @@ -169,7 +170,7 @@ mqd_t mq_open(const char *mq_name, int oflags, ...) */ va_start(arg, oflags); - (void)va_arg(arg, mode_t); /* MQ creation mode parameter (ignored) */ + mode = va_arg(arg, mode_t); 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 19a4f9196..5b8be5cd1 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 = ENOSPC; + int ret = ERROR; /* The following must be atomic */ @@ -131,6 +131,7 @@ 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]) @@ -148,7 +149,7 @@ int on_exit(CODE void (*func)(int, FAR void *), FAR void *arg) return ret; #else _TCB *tcb = (_TCB*)g_readytorun.head; - int ret = ENOSPC; + int ret = ERROR; /* The following must be atomic */ diff --git a/nuttx/sched/pause.c b/nuttx/sched/pause.c deleted file mode 100644 index 607c4c775..000000000 --- a/nuttx/sched/pause.c +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************************** - * 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/sched_getscheduler.c b/nuttx/sched/sched_getscheduler.c index 0d996ca27..5771e86ff 100644 --- a/nuttx/sched/sched_getscheduler.c +++ b/nuttx/sched/sched_getscheduler.c @@ -129,4 +129,3 @@ int sched_getscheduler(pid_t pid) return SCHED_FIFO; } } - diff --git a/nuttx/sched/sem_holder.c b/nuttx/sched/sem_holder.c index c850a3b5a..1bae37746 100644 --- a/nuttx/sched/sem_holder.c +++ b/nuttx/sched/sem_holder.c @@ -450,7 +450,7 @@ static int sem_restoreholderprio(FAR struct semholder_s *pholder, FAR sem_t *sem * priorities back to the base priority. */ - DEBUGASSERT(htcb->sched_priority == stcb->sched_priority && htcb->npend_reprio == 0); + //DEBUGASSERT(htcb->sched_priority == stcb->sched_priority && htcb->npend_reprio == 0); sched_reprioritize(htcb, htcb->base_priority); } diff --git a/nuttx/sched/sem_open.c b/nuttx/sched/sem_open.c index b2b76fe38..817c36b49 100644 --- a/nuttx/sched/sem_open.c +++ b/nuttx/sched/sem_open.c @@ -120,6 +120,7 @@ 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 */ @@ -164,7 +165,7 @@ FAR sem_t *sem_open (FAR const char *name, int oflag, ...) */ va_start(arg, oflag); - (void)va_arg(arg, mode_t); /* Creation mode parameter (ignored) */ + mode = va_arg(arg, mode_t); 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 9b3b6d57f..03884a5b6 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 particular signal. However, any unmasked signal + * waiting for any particualar signal. However, any unmasked signal * can still awaken sigtimedwait(). */ diff --git a/nuttx/sched/task_exithook.c b/nuttx/sched/task_exithook.c index 3bde8fb7a..004d09e20 100644 --- a/nuttx/sched/task_exithook.c +++ b/nuttx/sched/task_exithook.c @@ -81,8 +81,8 @@ * Call any registerd atexit function(s) * ****************************************************************************/ - -#if defined(CONFIG_SCHED_ATEXIT) && !defined(CONFIG_SCHED_ONEXIT) + +#ifdef CONFIG_SCHED_ATEXIT static inline void task_atexit(FAR _TCB *tcb) { #if defined(CONFIG_SCHED_ATEXIT_MAX) && CONFIG_SCHED_ATEXIT_MAX > 1 diff --git a/nuttx/sched/usleep.c b/nuttx/sched/usleep.c index 893a420f4..21996d788 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 particular signal. However, any unmasked signal + * waiting for any particualar signal. However, any unmasked signal * can still awaken sigtimedwait(). */ |