summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nuttx/arch/z16/src/common/up_registerdump.c2
-rw-r--r--nuttx/arch/z16/src/common/up_schedulesigaction.c4
-rw-r--r--nuttx/arch/z16/src/common/up_sigdeliver.c4
-rw-r--r--nuttx/configs/z16f2800100zcog/ostest/defconfig8
-rw-r--r--nuttx/examples/ostest/roundrobin.c8
-rw-r--r--nuttx/include/nuttx/compiler.h2
-rw-r--r--nuttx/include/nuttx/sched.h12
-rw-r--r--nuttx/include/semaphore.h47
-rw-r--r--nuttx/include/signal.h24
-rw-r--r--nuttx/include/unistd.h30
-rw-r--r--nuttx/include/wdog.h39
-rw-r--r--nuttx/sched/mq_receive.c2
-rw-r--r--nuttx/sched/mq_timedreceive.c10
-rw-r--r--nuttx/sched/mq_timedsend.c10
-rw-r--r--nuttx/sched/pthread_condtimedwait.c2
-rw-r--r--nuttx/sched/sem_close.c68
-rw-r--r--nuttx/sched/sem_destroy.c65
-rw-r--r--nuttx/sched/sem_getvalue.c69
-rw-r--r--nuttx/sched/sem_init.c64
-rw-r--r--nuttx/sched/sem_open.c89
-rw-r--r--nuttx/sched/sem_post.c70
-rw-r--r--nuttx/sched/sem_trywait.c52
-rw-r--r--nuttx/sched/sem_unlink.c63
-rw-r--r--nuttx/sched/sem_wait.c65
-rw-r--r--nuttx/sched/sig_action.c111
-rw-r--r--nuttx/sched/sig_addset.c54
-rw-r--r--nuttx/sched/sig_delset.c54
-rw-r--r--nuttx/sched/sig_emptyset.c51
-rw-r--r--nuttx/sched/sig_fillset.c51
-rw-r--r--nuttx/sched/sig_ismember.c49
-rw-r--r--nuttx/sched/sig_pending.c57
-rw-r--r--nuttx/sched/sig_procmask.c79
-rw-r--r--nuttx/sched/sig_suspend.c70
-rw-r--r--nuttx/sched/sig_timedwait.c103
-rw-r--r--nuttx/sched/sig_waitinfo.c52
-rw-r--r--nuttx/sched/timer_settime.c12
-rw-r--r--nuttx/sched/wd_create.c54
-rw-r--r--nuttx/sched/wd_start.c88
38 files changed, 822 insertions, 872 deletions
diff --git a/nuttx/arch/z16/src/common/up_registerdump.c b/nuttx/arch/z16/src/common/up_registerdump.c
index 5164dd0a6..b854f4882 100644
--- a/nuttx/arch/z16/src/common/up_registerdump.c
+++ b/nuttx/arch/z16/src/common/up_registerdump.c
@@ -76,7 +76,7 @@
#ifdef CONFIG_ARCH_STACKDUMP
static void up_registerdump(void)
{
- uint32 *regs32 = (uint32*)current_regs;
+ FAR uint32 *regs32 = (FAR uint32*)current_regs;
lldbg("R0 :%08x R1 :%08x R2 :%08x R3 :%08x "
"R4 :%08x R5 :%08x R6 :%08x R7 :%08x\n"
regs32[REG_R0/2], regs32[REG_R1/2], regs32[REG_R2/2], regs32[REG_R3/2],
diff --git a/nuttx/arch/z16/src/common/up_schedulesigaction.c b/nuttx/arch/z16/src/common/up_schedulesigaction.c
index 3284fd1bf..f085b2e95 100644
--- a/nuttx/arch/z16/src/common/up_schedulesigaction.c
+++ b/nuttx/arch/z16/src/common/up_schedulesigaction.c
@@ -104,7 +104,7 @@ void up_schedule_sigaction(FAR _TCB *tcb, sig_deliver_t sigdeliver)
{
/* Refuse to handle nested signal actions */
- dbg("tcb=0x%p sigdeliver=0x%04x\n", tcb, (chipreg_t)sigdeliver);
+ dbg("tcb=0x%p sigdeliver=0x%06x\n", tcb, (uint32)sigdeliver);
if (!tcb->xcp.sigdeliver)
{
@@ -141,7 +141,7 @@ void up_schedule_sigaction(FAR _TCB *tcb, sig_deliver_t sigdeliver)
else
{
- uint32 *current_pc = (uint32*)&current_regs[REG_PC];
+ FAR uint32 *current_pc = (FAR uint32*)&current_regs[REG_PC];
/* Save the return address and interrupt state.
* These will be restored by the signal trampoline after
diff --git a/nuttx/arch/z16/src/common/up_sigdeliver.c b/nuttx/arch/z16/src/common/up_sigdeliver.c
index ce94d1a40..09bcd14ac 100644
--- a/nuttx/arch/z16/src/common/up_sigdeliver.c
+++ b/nuttx/arch/z16/src/common/up_sigdeliver.c
@@ -82,9 +82,9 @@
void up_sigdeliver(void)
{
#ifndef CONFIG_DISABLE_SIGNALS
- _TCB *rtcb = (_TCB*)g_readytorun.head;
+ FAR _TCB *rtcb = (_TCB*)g_readytorun.head;
chipreg_t regs[XCPTCONTEXT_REGS];
- uint32 *regs32 = (uint32*)regs;
+ FAR uint32 *regs32 = (FAR uint32*)regs;
sig_deliver_t sigdeliver;
/* Save the errno. This must be preserved throughout the signal handling
diff --git a/nuttx/configs/z16f2800100zcog/ostest/defconfig b/nuttx/configs/z16f2800100zcog/ostest/defconfig
index 4e95b886a..2c9815678 100644
--- a/nuttx/configs/z16f2800100zcog/ostest/defconfig
+++ b/nuttx/configs/z16f2800100zcog/ostest/defconfig
@@ -144,7 +144,7 @@ CONFIG_DEBUG_VERBOSE=n
CONFIG_MM_REGIONS=1
CONFIG_ARCH_LOWPUTC=n
CONFIG_ARCH_LOWGETC=n
-CONFIG_RR_INTERVAL=0
+CONFIG_RR_INTERVAL=200
CONFIG_SCHED_INSTRUMENTATION=n
CONFIG_TASK_NAME_SIZE=0
CONFIG_START_YEAR=2008
@@ -172,7 +172,7 @@ CONFIG_DEV_LOWCONSOLE=y
CONFIG_DISABLE_CLOCK=n
CONFIG_DISABLE_POSIX_TIMERS=n
CONFIG_DISABLE_PTHREAD=n
-CONFIG_DISABLE_SIGNALS=y
+CONFIG_DISABLE_SIGNALS=n
CONFIG_DISABLE_MQUEUE=n
CONFIG_DISABLE_MOUNTPOINT=n
CONFIG_DISABLE_ENVIRON=n
@@ -331,8 +331,8 @@ CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0)
#
CONFIG_BOOT_FROM_FLASH=n
CONFIG_CUSTOM_STACK=n
-CONFIG_PROC_STACK_SIZE=1024
+CONFIG_PROC_STACK_SIZE=4096
CONFIG_PTHREAD_STACK_MIN=256
-CONFIG_PTHREAD_STACK_DEFAULT=1024
+CONFIG_PTHREAD_STACK_DEFAULT=4096
CONFIG_HEAP_SIZE=
CONFIG_HEAP_BASE=
diff --git a/nuttx/examples/ostest/roundrobin.c b/nuttx/examples/ostest/roundrobin.c
index 88b169323..003c6cf6b 100644
--- a/nuttx/examples/ostest/roundrobin.c
+++ b/nuttx/examples/ostest/roundrobin.c
@@ -1,7 +1,7 @@
/********************************************************************************
- * roundrobin.c
+ * examples/ostest/roundrobin.c
*
- * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * 3. Neither the name Gregory NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -134,6 +134,7 @@ static void *sieve1(void *parameter)
printf("sieve1 finished\n");
pthread_exit(NULL);
+ return NULL; /* To keep some compilers happy */
}
/********************************************************************************
@@ -154,6 +155,7 @@ static void *sieve2(void *parameter)
printf("sieve2 finished\n");
pthread_exit(NULL);
+ return NULL; /* To keep some compilers happy */
}
/********************************************************************************
diff --git a/nuttx/include/nuttx/compiler.h b/nuttx/include/nuttx/compiler.h
index 91f7c4d0b..10f0c1802 100644
--- a/nuttx/include/nuttx/compiler.h
+++ b/nuttx/include/nuttx/compiler.h
@@ -263,7 +263,7 @@
# define FAR _Far
# define NEAR _Near
# define DSEG _Far
-# define CODE _Near
+# define CODE _Far
/* Select the large, 32-bit addressing model */
diff --git a/nuttx/include/nuttx/sched.h b/nuttx/include/nuttx/sched.h
index 4548b3365..c3cc5d809 100644
--- a/nuttx/include/nuttx/sched.h
+++ b/nuttx/include/nuttx/sched.h
@@ -75,16 +75,14 @@
/* General Task Management Types ************************************************/
-/* This is the type of the task_state field of the TCB.
- * NOTE: the order and content of this enumeration is
- * critical since there are some OS tables indexed by these
- * values.
+/* This is the type of the task_state field of the TCB. NOTE: the order and
+ * content of this enumeration is critical since there are some OS tables indexed
+ * by these values. The range of values is assumed to fit into a ubyte in _TCB.
*/
enum tstate_e
{
- TSTATE_TASK_INVALID = 0, /* INVALID - The TCB is is not in a valid state
- * (Uninitialized or between context switches) */
+ TSTATE_TASK_INVALID = 0, /* INVALID - The TCB is uninitialized */
TSTATE_TASK_PENDING = 1, /* READY_TO_RUN - Pending preemption unlock */
TSTATE_TASK_READYTORUN = 2, /* READY-TO-RUN - But not running */
TSTATE_TASK_RUNNING = 3, /* READY_TO_RUN - And running */
@@ -179,7 +177,7 @@ struct _TCB
entry_t entry; /* Entry Point into the thread */
exitfunc_t exitfunc; /* Called if exit is called. */
ubyte sched_priority; /* Current priority of the thread */
- tstate_t task_state; /* Current state of the thread */
+ ubyte task_state; /* Current state of the thread */
uint16 flags; /* Misc. general status flags */
sint16 lockcount; /* 0=preemptable (not-locked) */
#ifndef CONFIG_DISABLE_PTHREAD
diff --git a/nuttx/include/semaphore.h b/nuttx/include/semaphore.h
index 565acaf31..bd2a24db1 100644
--- a/nuttx/include/semaphore.h
+++ b/nuttx/include/semaphore.h
@@ -1,7 +1,7 @@
-/************************************************************
- * semaphore.h
+/****************************************************************************
+ * include/semaphore.h
*
- * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * 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.
*
@@ -31,14 +31,14 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- ************************************************************/
+ ****************************************************************************/
#ifndef __SEMAPHORE_H
#define __SEMAPHORE_H
-/************************************************************
+/****************************************************************************
* Included Files
- ************************************************************/
+ ****************************************************************************/
#include <sys/types.h>
#include <limits.h>
@@ -50,13 +50,13 @@ extern "C" {
#define EXTERN extern
#endif
-/************************************************************
+/****************************************************************************
* Definitions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Public Type Declarations
- ************************************************************/
+ ****************************************************************************/
/* This is the generic semaphore structure. */
@@ -67,25 +67,25 @@ struct sem_s
};
typedef struct sem_s sem_t;
-/************************************************************
+/****************************************************************************
* Public Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Public Function Prototypes
- ************************************************************/
+ ****************************************************************************/
/* Counting Semaphore Interfaces (based on POSIX APIs) */
-EXTERN int sem_init(sem_t *sem, int pshared, unsigned int value);
-EXTERN int sem_destroy(sem_t *sem);
-EXTERN FAR sem_t *sem_open(const char *name, int oflag, ...);
+EXTERN int sem_init(FAR sem_t *sem, int pshared, unsigned int value);
+EXTERN int sem_destroy(FAR sem_t *sem);
+EXTERN FAR sem_t *sem_open(FAR const char *name, int oflag, ...);
EXTERN int sem_close(FAR sem_t *sem);
-EXTERN int sem_unlink(const char *name);
-EXTERN int sem_wait(sem_t *sem);
-EXTERN int sem_trywait(sem_t *sem);
-EXTERN int sem_post(sem_t *sem);
-EXTERN int sem_getvalue(sem_t *sem, int *sval);
+EXTERN int sem_unlink(FAR const char *name);
+EXTERN int sem_wait(FAR sem_t *sem);
+EXTERN int sem_trywait(FAR sem_t *sem);
+EXTERN int sem_post(FAR sem_t *sem);
+EXTERN int sem_getvalue(FAR sem_t *sem, FAR int *sval);
#undef EXTERN
#ifdef __cplusplus
@@ -93,4 +93,3 @@ EXTERN int sem_getvalue(sem_t *sem, int *sval);
#endif
#endif /* __SEMAPHORE_H */
-
diff --git a/nuttx/include/signal.h b/nuttx/include/signal.h
index 76963784f..ee3e7d6de 100644
--- a/nuttx/include/signal.h
+++ b/nuttx/include/signal.h
@@ -177,18 +177,18 @@ extern "C" {
#endif
EXTERN int kill(pid_t, int);
-EXTERN int sigemptyset(sigset_t *set);
-EXTERN int sigfillset(sigset_t *set);
-EXTERN int sigaddset(sigset_t *set, int signo);
-EXTERN int sigdelset(sigset_t *set, int signo);
-EXTERN int sigismember(const sigset_t *set, int signo);
-EXTERN int sigaction(int sig, const struct sigaction *act, struct sigaction *oact);
-EXTERN int sigprocmask(int how, const sigset_t *set, sigset_t *oset);
-EXTERN int sigpending(sigset_t *set);
-EXTERN int sigsuspend(const sigset_t *sigmask);
-EXTERN int sigwaitinfo(const sigset_t *set, struct siginfo *value);
-EXTERN int sigtimedwait(const sigset_t *set, struct siginfo *value,
- const struct timespec *timeout);
+EXTERN int sigemptyset(FAR sigset_t *set);
+EXTERN int sigfillset(FAR sigset_t *set);
+EXTERN int sigaddset(FAR sigset_t *set, int signo);
+EXTERN int sigdelset(FAR sigset_t *set, int signo);
+EXTERN int sigismember(FAR const sigset_t *set, int signo);
+EXTERN int sigaction(int sig, FAR const struct sigaction *act, FAR struct sigaction *oact);
+EXTERN int sigprocmask(int how, FAR const sigset_t *set, FAR sigset_t *oset);
+EXTERN int sigpending(FAR sigset_t *set);
+EXTERN int sigsuspend(FAR const sigset_t *sigmask);
+EXTERN int sigwaitinfo(FAR const sigset_t *set, FAR struct siginfo *value);
+EXTERN int sigtimedwait(FAR const sigset_t *set, FAR struct siginfo *value,
+ FAR const struct timespec *timeout);
#ifdef CONFIG_CAN_PASS_STRUCTS
EXTERN int sigqueue(int pid, int signo, union sigval value);
#else
diff --git a/nuttx/include/unistd.h b/nuttx/include/unistd.h
index ef5bc26b2..8351b8c45 100644
--- a/nuttx/include/unistd.h
+++ b/nuttx/include/unistd.h
@@ -1,7 +1,7 @@
-/************************************************************
+/****************************************************************************
* unistd.h
*
- * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * 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.
*
@@ -31,21 +31,21 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- ************************************************************/
+ ****************************************************************************/
#ifndef __UNISTD_H
#define __UNISTD_H
-/************************************************************
+/****************************************************************************
* Included Files
- ************************************************************/
+ ****************************************************************************/
#include <sys/types.h>
#include <nuttx/compiler.h>
-/************************************************************
+/****************************************************************************
* Definitions
- ************************************************************/
+ ****************************************************************************/
/* The number of functions that may be registerd to be called
* at program exit.
@@ -96,9 +96,9 @@
#define fdatasync(f) fsync(f)
-/************************************************************
+/****************************************************************************
* Global Variables
- ************************************************************/
+ ****************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
@@ -110,13 +110,13 @@ extern "C" {
/* Used by getopt (obviously NOT thread safe!) */
-EXTERN char *optarg; /* Optional argument following option */
-EXTERN int optind; /* Index into argv */
-EXTERN int optopt; /* unrecognized option character */
+EXTERN FAR char *optarg; /* Optional argument following option */
+EXTERN int optind; /* Index into argv */
+EXTERN int optopt; /* unrecognized option character */
-/************************************************************
+/****************************************************************************
* Global Function Prototypes
- ************************************************************/
+ ****************************************************************************/
/* Task Control Interfaces */
diff --git a/nuttx/include/wdog.h b/nuttx/include/wdog.h
index d54c66fed..5056ab4cf 100644
--- a/nuttx/include/wdog.h
+++ b/nuttx/include/wdog.h
@@ -1,7 +1,7 @@
-/************************************************************
+/****************************************************************************
* wdog.h
*
- * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * 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.
*
@@ -31,29 +31,29 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- ************************************************************/
+ ****************************************************************************/
#ifndef __WDOG_H
#define __WDOG_H
-/************************************************************
+/****************************************************************************
* Included Files
- ************************************************************/
+ ****************************************************************************/
#include <nuttx/config.h>
#include <sched.h>
-/************************************************************
+/****************************************************************************
* Compilations Switches
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Definitions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Global Type Declarations
- ************************************************************/
+ ****************************************************************************/
/* The arguments are passed as uint32 values. For systems
* where the sizeof(pointer) < sizeof(uint32), the following
@@ -67,8 +67,8 @@
union wdparm_u
{
- void *pvarg;
- uint32 *dwarg;
+ FAR void *pvarg;
+ FAR uint32 *dwarg;
};
typedef union wdparm_u wdparm_t;
@@ -76,19 +76,19 @@ typedef union wdparm_u wdparm_t;
* watchdog function expires. Up to four parameters may be passed.
*/
-typedef void (*wdentry_t)(int argc, uint32 arg1, ...);
+typedef CODE void (*wdentry_t)(int argc, uint32 arg1, ...);
/* Watchdog 'handle' */
typedef FAR struct wdog_s *WDOG_ID;
-/************************************************************
+/****************************************************************************
* Global Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Global Function Prototypes
- ************************************************************/
+ ****************************************************************************/
#ifdef __cplusplus
#define EXTERN extern "C"
@@ -110,4 +110,3 @@ EXTERN int wd_gettime(WDOG_ID wdog);
#endif
#endif /* _WDOG_H_ */
-
diff --git a/nuttx/sched/mq_receive.c b/nuttx/sched/mq_receive.c
index b19567058..5182b4069 100644
--- a/nuttx/sched/mq_receive.c
+++ b/nuttx/sched/mq_receive.c
@@ -119,7 +119,7 @@ ssize_t mq_receive(mqd_t mqdes, void *msg, size_t msglen, int *prio)
irqstate_t saved_state;
ssize_t ret = ERROR;
- DEBUGASSERT(!up_interrupt_context());
+ DEBUGASSERT(up_interrupt_context() == FALSE);
/* Verify the input parameters and, in case of an error, set
* errno appropriately.
diff --git a/nuttx/sched/mq_timedreceive.c b/nuttx/sched/mq_timedreceive.c
index 45aa6a813..6f0d93d2b 100644
--- a/nuttx/sched/mq_timedreceive.c
+++ b/nuttx/sched/mq_timedreceive.c
@@ -1,7 +1,7 @@
/****************************************************************************
- * mq_timedreceive.c
+ * sched/mq_timedreceive.c
*
- * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * 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.
*
@@ -86,7 +86,7 @@
*
****************************************************************************/
-static void mq_rcvtimeout(int argc, uint32 pid, ...)
+static void mq_rcvtimeout(int argc, uint32 pid)
{
FAR _TCB *wtcb;
irqstate_t saved_state;
@@ -192,7 +192,7 @@ ssize_t mq_timedreceive(mqd_t mqdes, void *msg, size_t msglen,
irqstate_t saved_state;
int ret = ERROR;
- DEBUGASSERT(!up_interrupt_context());
+ DEBUGASSERT(up_interrupt_context() == FALSE);
/* Verify the input parameters and, in case of an error, set
* errno appropriately.
diff --git a/nuttx/sched/mq_timedsend.c b/nuttx/sched/mq_timedsend.c
index 05b7ea5d2..76e3fda5d 100644
--- a/nuttx/sched/mq_timedsend.c
+++ b/nuttx/sched/mq_timedsend.c
@@ -1,7 +1,7 @@
/****************************************************************************
- * mq_timedsend.c
+ * sched/mq_timedsend.c
*
- * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * 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.
*
@@ -87,7 +87,7 @@
*
****************************************************************************/
-static void mq_sndtimeout(int argc, uint32 pid, ...)
+static void mq_sndtimeout(int argc, uint32 pid)
{
FAR _TCB *wtcb;
irqstate_t saved_state;
@@ -189,7 +189,7 @@ int mq_timedsend(mqd_t mqdes, const char *msg, size_t msglen, int prio,
irqstate_t saved_state;
int ret = ERROR;
- DEBUGASSERT(!up_interrupt_context());
+ DEBUGASSERT(up_interrupt_context() == FALSE);
/* Verify the input parameters -- setting errno appropriately
* on any failures to verify.
diff --git a/nuttx/sched/pthread_condtimedwait.c b/nuttx/sched/pthread_condtimedwait.c
index 32a3d550b..78110c624 100644
--- a/nuttx/sched/pthread_condtimedwait.c
+++ b/nuttx/sched/pthread_condtimedwait.c
@@ -89,7 +89,7 @@
*
****************************************************************************/
-static void pthread_condtimedout(int argc, uint32 pid, uint32 signo, ...)
+static void pthread_condtimedout(int argc, uint32 pid, uint32 signo)
{
#ifdef CONFIG_CAN_PASS_STRUCTS
union sigval value;
diff --git a/nuttx/sched/sem_close.c b/nuttx/sched/sem_close.c
index 9c278fb58..4589695b6 100644
--- a/nuttx/sched/sem_close.c
+++ b/nuttx/sched/sem_close.c
@@ -1,7 +1,7 @@
-/************************************************************
- * sem_close.c
+/****************************************************************************
+ * sched/sem_close.c
*
- * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * 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.
*
@@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Included Files
- ************************************************************/
+ ****************************************************************************/
#include <sys/types.h>
#include <errno.h>
@@ -44,48 +44,46 @@
#include "os_internal.h"
#include "sem_internal.h"
-/************************************************************
+/****************************************************************************
* Compilation Switches
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Definitions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Type Declarations
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Global Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Functions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Public Functions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Function: sem_close
*
* Description:
- * This function is called to indicate that the calling\
- * task is finished with the specified named semaphore,
- * sem. The sem_close() deallocates any system resources
- * allocated by the system for this named semaphore.
+ * This function is called to indicate that the calling task is finished
+ * with the specified named semaphore, 'sem'. The sem_close() deallocates
+ * any system resources allocated by the system for this named semaphore.
*
- * If the semaphore has not been removed with a call to
- * sem_unlink(), then sem_close() has no effect on the
- * named semaphore. However, when the named semaphore has
- * been fully unlinked, the semaphore will vanish when the
- * last task closes it.
+ * If the semaphore has not been removed with a call to sem_unlink(), then
+ * sem_close() has no effect on the named semaphore. However, when the
+ * named semaphore has been fully unlinked, the semaphore will vanish when
+ * the last task closes it.
*
* Parameters:
* sem - semaphore descriptor
@@ -94,12 +92,11 @@
* 0 (OK), or -1 (ERROR) if unsuccessful.
*
* Assumptions:
- * - Care must be taken to avoid risking the deletion of
- * a semaphore that another calling task has already
- * locked.
+ * - Care must be taken to avoid risking the deletion of a semaphore that
+ * another calling task has already locked.
* - sem_close must not be called for an un-named semaphore
*
- ************************************************************/
+ ****************************************************************************/
int sem_close(FAR sem_t *sem)
{
@@ -142,4 +139,3 @@ int sem_close(FAR sem_t *sem)
return ret;
}
-
diff --git a/nuttx/sched/sem_destroy.c b/nuttx/sched/sem_destroy.c
index 1d88563ff..6dd60bc28 100644
--- a/nuttx/sched/sem_destroy.c
+++ b/nuttx/sched/sem_destroy.c
@@ -1,7 +1,7 @@
-/************************************************************
- * sem_destroy.c
+/****************************************************************************
+ * sched/sem_destroy.c
*
- * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * 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.
*
@@ -31,58 +31,57 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Included Files
- ************************************************************/
+ ****************************************************************************/
#include <sys/types.h>
#include <semaphore.h>
#include "sem_internal.h"
-/************************************************************
+/****************************************************************************
* Compilation Switches
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Definitions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Type Declarations
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Global Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Functions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Public Functions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Function: sem_destroy
*
* Description:
- * This function is used to destroy the un-named semaphore
- * indicated by sem. Only a semaphore that was created
- * using sem_init() may be destroyed using sem_destroy();
- * the effect of calling sem_destroy() with a name semaphore
- * is undefined. The effect of subsequent use of the
- * semaphore sem is undefined until sem is re-initialized
- * by another call to sem_init().
+ * This function is used to destroy the un-named semaphore indicated by
+ * 'sem'. Only a semaphore that was created using sem_init() may be
+ * destroyed using sem_destroy(); the effect of calling sem_destroy() with
+ * a named semaphore is undefined. The effect of subsequent use of the
+ * semaphore sem is undefined until sem is re-initialized by another call
+ * to sem_init().
*
- * The effect of destroying a semaphore upon which other
- * processes are currently blocked is undefined.
+ * The effect of destroying a semaphore upon which other processes are
+ * currently blocked is undefined.
*
* Parameters:
* sem - Semaphore to be destroyed.
@@ -92,9 +91,9 @@
*
* Assumptions:
*
- ************************************************************/
+ ****************************************************************************/
-int sem_destroy (sem_t *sem)
+int sem_destroy (FAR sem_t *sem)
{
int ret = ERROR;
diff --git a/nuttx/sched/sem_getvalue.c b/nuttx/sched/sem_getvalue.c
index b7dd201c7..f320f92c0 100644
--- a/nuttx/sched/sem_getvalue.c
+++ b/nuttx/sched/sem_getvalue.c
@@ -1,7 +1,7 @@
-/************************************************************
- * sem_getvalue.c
+/****************************************************************************
+ * sched/sem_getvalue.c
*
- * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * 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.
*
@@ -31,60 +31,58 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Included Files
- ************************************************************/
+ ****************************************************************************/
#include <sys/types.h>
#include <semaphore.h>
#include "sem_internal.h"
-/************************************************************
+/****************************************************************************
* Compilation Switches
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Definitions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Type Declarations
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Global Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Functions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Public Functions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Function: sem_getvalue
*
* Description:
- * This function updates the location referenced by sval
- * argument to have the value of the semaphore referenced
- * by sem without effecting the state of the semaphore.
- * The updated value represents the actual semaphore value
- * that occurred at some unspecified time during the call,
- * but may not reflect the actual value of the semaphore
- * when it is returned to the calling task.
+ * This function updates the location referenced by 'sval' argument to
+ * have the value of the semaphore referenced by 'sem' without effecting
+ * the state of the semaphore. The updated value represents the actual
+ * semaphore value that occurred at some unspecified time during the call,
+ * but may not reflect the actual value of the semaphore when it is
+ * returned to the calling task.
*
- * If sem is locked, the value return by sem_getvalue()
- * will either be zero or a negative number whose absolute
- * value represents the number of tasks waiting for the
- * semaphore.
+ * If 'sem' is locked, the value return by sem_getvalue() will either be
+ * zero or a negative number whose absolute value represents the number
+ * of tasks waiting for the semaphore.
*
* Parameters:
* sem - Semaphore descriptor
@@ -95,9 +93,9 @@
*
* Assumptions:
*
- ************************************************************/
+ ****************************************************************************/
-int sem_getvalue(sem_t *sem, int *sval)
+int sem_getvalue(FAR sem_t *sem, FAR int *sval)
{
int ret = ERROR;
@@ -109,4 +107,3 @@ int sem_getvalue(sem_t *sem, int *sval)
return ret;
}
-
diff --git a/nuttx/sched/sem_init.c b/nuttx/sched/sem_init.c
index 861d62056..b9280d22e 100644
--- a/nuttx/sched/sem_init.c
+++ b/nuttx/sched/sem_init.c
@@ -1,7 +1,7 @@
-/************************************************************
- * sem_init.c
+/****************************************************************************
+ * sched/sem_init.c
*
- * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * 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.
*
@@ -31,59 +31,57 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Included Files
- ************************************************************/
+ ****************************************************************************/
#include <sys/types.h>
#include <limits.h>
#include <semaphore.h>
#include "sem_internal.h"
-/************************************************************
+/****************************************************************************
* Compilation Switches
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Definitions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Type Declarations
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Global Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Functions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Public Functions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Function: sem_init
*
* Description:
- * This function initializes the UNAMED semaphore sem.
- * Following a successful call to sem_init(), the
- * semaophore may be used in subsequent calls to
- * sem_wait(), sem_post(), and sem_trywait(). The
- * semaphore remains usable until it is destroyed.
+ * This function initializes the UNAMED semaphore sem. Following a
+ * successful call to sem_init(), the semaophore may be used in subsequent
+ * calls to sem_wait(), sem_post(), and sem_trywait(). The semaphore
+ * remains usable until it is destroyed.
*
- * Only sem itself may be used for performing
- * synchronization. The result of referring to copies of
- * sem in calls to sem_wait(), sem_trywait(), sem_post(),
- * and sem_destroy() is undefined.
+ * Only sem itself may be used for performing synchronization. The result
+ * of referring to copies of sem in calls to sem_wait(), sem_trywait(),
+ * sem_post(), and sem_destroy() is undefined.
*
* Parameters:
* sem - Semaphore to be initialized
@@ -95,9 +93,9 @@
*
* Assumptions:
*
- ************************************************************/
+ ****************************************************************************/
-int sem_init (sem_t *sem, int pshared, unsigned int value)
+int sem_init (FAR sem_t *sem, int pshared, unsigned int value)
{
int ret = ERROR;
diff --git a/nuttx/sched/sem_open.c b/nuttx/sched/sem_open.c
index dbfa98fd5..384261c24 100644
--- a/nuttx/sched/sem_open.c
+++ b/nuttx/sched/sem_open.c
@@ -1,7 +1,7 @@
-/************************************************************
- * sem_open.c
+/****************************************************************************
+ * sched/sem_open.c
*
- * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * 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.
*
@@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Included Files
- ************************************************************/
+ ****************************************************************************/
#include <sys/types.h>
#include <stdarg.h>
@@ -47,76 +47,73 @@
#include <nuttx/kmalloc.h>
#include "sem_internal.h"
-/************************************************************
+/****************************************************************************
* Compilation Switches
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Definitions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Type Declarations
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Global Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Functions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Public Functions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Function: sem_open
*
* Description:
- * This function establishes a connection between named
- * semaphores and a task. Following a call to sem_open()
- * with the semaphore name, the task may reference the
- * semaphore associated with name using the address
- * returned by this call. The semaphore may be used in
- * subsequent calls to sem_wait(), sem_trywait(), and
- * sem_post(). The semaphore remains usable until the
- * semaphore is closed by a successful call to sem_close().
+ * This function establishes a connection between named semaphores and a
+ * task. Following a call to sem_open() with the semaphore name, the task
+ * may reference the semaphore associated with name using the address
+ * returned by this call. The semaphore may be used in subsequent calls
+ * to sem_wait(), sem_trywait(), and sem_post(). The semaphore remains
+ * usable until the semaphore is closed by a successful call to sem_close().
*
- * If a task makes multiple calls to sem_open() with the
- * same name, then the same semaphore address is returned
- * (provided there have been no calls to sem_unlink()).
+ * If a task makes multiple calls to sem_open() with the same name, then
+ * the same semaphore address is returned (provided there have been no
+ * calls to sem_unlink()).
*
* Parameters:
* name - Semaphore name
- * oflag - Semaphore creation options. This may either
- * or both of the following bit settings.
- * oflag = 0: Connect to the semaphore only if it
- * already exists.
- * oflag = O_CREAT: Connect to the semaphore if it
- * exists, otherwise create the semaphore.
+ * oflag - Semaphore creation options. This may either or both of the
+ * following bit settings.
+ * oflag = 0: Connect to the semaphore only if it already exists.
+ * oflag = O_CREAT: Connect to the semaphore if it exists, otherwise
+ * create the semaphore.
* oflag = O_CREAT|O_EXCL: Create a new semaphore
* unless one of this name already exists.
- * Optional parameters. When the O_CREAT flag is specified,
- * two optional parameters are expected:
+ * Optional parameters. When the O_CREAT flag is specified, two optional
+ * parameters are expected:
* 1. mode_t mode (ignored), and
- * 2. unsigned int value. This initial value of the semaphore.
- * valid initial values of the semaphore must be less than
- * or equal to SEM_VALUE_MAX.
+ * 2. unsigned int value. This initial value of the semaphore. Valid
+ * initial values of the semaphore must be less than or equal to
+ * SEM_VALUE_MAX.
*
* Return Value:
* A pointer to sem_t or -1 (ERROR) if unsuccessful.
*
* Assumptions:
*
- ************************************************************/
+ ****************************************************************************/
-FAR sem_t *sem_open (const char *name, int oflag, ...)
+FAR sem_t *sem_open (FAR const char *name, int oflag, ...)
{
int namelen;
FAR nsem_t *psem;
diff --git a/nuttx/sched/sem_post.c b/nuttx/sched/sem_post.c
index 2a6af5e21..186c3b87e 100644
--- a/nuttx/sched/sem_post.c
+++ b/nuttx/sched/sem_post.c
@@ -1,7 +1,7 @@
-/************************************************************
- * sem_post.c
+/****************************************************************************
+ * sched/sem_post.c
*
- * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * 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.
*
@@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Included Files
- ************************************************************/
+ ****************************************************************************/
#include <sys/types.h>
#include <limits.h>
@@ -45,52 +45,49 @@
#include "os_internal.h"
#include "sem_internal.h"
-/************************************************************
+/****************************************************************************
* Compilation Switches
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Definitions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Type Declarations
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Global Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Functions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Public Functions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Function: sem_post
*
* Description:
- * When a task has finished with a semaphore, it will call
- * sem_post(). This function unlocks the semaphore
- * referenced by sem by performing the semaphore unlock
- * operation on that semaphore.
+ * When a task has finished with a semaphore, it will call sem_post().
+ * This function unlocks the semaphore referenced by sem by performing the
+ * semaphore unlock operation on that semaphore.
*
- * If the semaphore value resulting from this operation
- * is positive, then no tasks were blocked waiting for the
- * semaphore to become unlocked; the semaphore is simply
- * incremented.
+ * If the semaphore value resulting from this operation is positive, then
+ * no tasks were blocked waiting for the semaphore to become unlocked; the
+ * semaphore is simply incremented.
*
- * If the value of the semaphore resulting from this
- * operation is zero, then one of the tasks blocked
- * waiting for the semaphore shall be allowed to return
- * successfully from its call to sem_wait().
+ * If the value of the semaphore resulting from this operation is zero,
+ * then one of the tasks blocked waiting for the semaphore shall be
+ * allowed to return successfully from its call to sem_wait().
*
* Parameters:
* sem - Semaphore descriptor
@@ -103,9 +100,9 @@
* It assumes the currently executing task is the one that
* is performing the unlock.
*
- ************************************************************/
+ ****************************************************************************/
-int sem_post(sem_t *sem)
+int sem_post(FAR sem_t *sem)
{
FAR _TCB *stcb;
STATUS ret = ERROR;
@@ -163,4 +160,3 @@ int sem_post(sem_t *sem)
return ret;
}
-
diff --git a/nuttx/sched/sem_trywait.c b/nuttx/sched/sem_trywait.c
index e634e1781..70b23cc4e 100644
--- a/nuttx/sched/sem_trywait.c
+++ b/nuttx/sched/sem_trywait.c
@@ -1,7 +1,7 @@
-/************************************************************
- * sem_trywait.c
+/****************************************************************************
+ * sched/sem_trywait.c
*
- * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * 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.
*
@@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Included Files
- ************************************************************/
+ ****************************************************************************/
#include <sys/types.h>
#include <semaphore.h>
@@ -45,35 +45,35 @@
#include "os_internal.h"
#include "sem_internal.h"
-/************************************************************
+/****************************************************************************
* Compilation Switches
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Definitions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Type Declarations
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Global Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Functions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Public Functions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Function: sem_trywait
*
* Description:
@@ -94,17 +94,17 @@
*
* Assumptions:
*
- ************************************************************/
+ ****************************************************************************/
-int sem_trywait(sem_t *sem)
+int sem_trywait(FAR sem_t *sem)
{
- _TCB *rtcb = (_TCB*)g_readytorun.head;
+ FAR _TCB *rtcb = (FAR _TCB*)g_readytorun.head;
irqstate_t saved_state;
int ret = ERROR;
/* This API should not be called from interrupt handlers */
- DEBUGASSERT(!up_interrupt_context())
+ DEBUGASSERT(up_interrupt_context() == FALSE)
/* Assume any errors reported are due to invalid arguments. */
diff --git a/nuttx/sched/sem_unlink.c b/nuttx/sched/sem_unlink.c
index cc249ff8d..b1bc1571a 100644
--- a/nuttx/sched/sem_unlink.c
+++ b/nuttx/sched/sem_unlink.c
@@ -1,7 +1,7 @@
-/************************************************************
- * sem_unlink.c
+/****************************************************************************
+ * sched/sem_unlink.c
*
- * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * 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.
*
@@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Included Files
- ************************************************************/
+ ****************************************************************************/
#include <sys/types.h>
#include <semaphore.h>
@@ -44,46 +44,44 @@
#include "os_internal.h"
#include "sem_internal.h"
-/************************************************************
+/****************************************************************************
* Compilation Switches
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Definitions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Type Declarations
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Global Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Functions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Public Functions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Function: sem_unlink
*
* Description:
- * This function removes the semaphore named by the input
- * parameter "name." If the semaphore named by "name" is
- * currently referenced by other processes, the sem_unlink()
- * will have no effect on the state of the semaphore. If
- * one or more processes have the semaphore open when
- * sem_unlink() is called, destruction of the semaphore
- * will be postponed until all references to the semaphore
- * have been destroyed by calls of sem_close().
+ * This function removes the semaphore named by the input parameter 'name.'
+ * If the semaphore named by 'name' is currently referenced by other task,
+ * the sem_unlink() will have no effect on the state of the semaphore. If
+ * one or more processes have the semaphore open when sem_unlink() is
+ * called, destruction of the semaphore will be postponed until all
+ * references to the semaphore have been destroyed by calls of sem_close().
*
* Parameters:
* name - Semaphore name
@@ -93,9 +91,9 @@
*
* Assumptions:
*
- ************************************************************/
+ ****************************************************************************/
-int sem_unlink(const char *name)
+int sem_unlink(FAR const char *name)
{
FAR nsem_t *psem;
int ret = ERROR;
@@ -139,4 +137,3 @@ int sem_unlink(const char *name)
return ret;
}
-
diff --git a/nuttx/sched/sem_wait.c b/nuttx/sched/sem_wait.c
index b31a48fa8..ba223b1d4 100644
--- a/nuttx/sched/sem_wait.c
+++ b/nuttx/sched/sem_wait.c
@@ -1,7 +1,7 @@
-/************************************************************
- * sem_wait.c
+/****************************************************************************
+ * sched/sem_wait.c
*
- * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * 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.
*
@@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Included Files
- ************************************************************/
+ ****************************************************************************/
#include <sys/types.h>
#include <semaphore.h>
@@ -45,59 +45,57 @@
#include "os_internal.h"
#include "sem_internal.h"
-/************************************************************
+/****************************************************************************
* Compilation Switches
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Definitions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Type Declarations
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Global Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Functions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Public Functions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Function: sem_wait
*
* Description:
- * This function attempts to lock the semaphore referenced
- * by sem. If the semaphore value is (<=) zero, then the
- * calling task will not return until it successfully
- * acquires the lock.
+ * This function attempts to lock the semaphore referenced by 'sem'. If
+ * the semaphore value is (<=) zero, then the calling task will not return
+ * until it successfully acquires the lock.
*
* Parameters:
* sem - Semaphore descriptor.
*
* Return Value:
* 0 (OK), or -1 (ERROR) is unsuccessful
- * If this function returns -1 (ERROR), then the cause
- * of the failure will be reported in "errno" as:
+ * If this function returns -1 (ERROR), then the cause of the failure will
+ * be reported in 'errno' as:
* - EINVAL: Invalid attempt to get the semaphore
- * - EINTR: The wait was interrupted by the receipt of
- * a signal.
+ * - EINTR: The wait was interrupted by the receipt of a signal.
*
* Assumptions:
*
- ************************************************************/
+ ****************************************************************************/
-int sem_wait(sem_t *sem)
+int sem_wait(FAR sem_t *sem)
{
FAR _TCB *rtcb = (FAR _TCB*)g_readytorun.head;
int ret = ERROR;
@@ -105,7 +103,7 @@ int sem_wait(sem_t *sem)
/* This API should not be called from interrupt handlers */
- DEBUGASSERT(!up_interrupt_context())
+ DEBUGASSERT(up_interrupt_context() == FALSE)
/* Assume any errors reported are due to invalid arguments. */
@@ -182,4 +180,3 @@ int sem_wait(sem_t *sem)
return ret;
}
-
diff --git a/nuttx/sched/sig_action.c b/nuttx/sched/sig_action.c
index f7fe7cdb5..53e378297 100644
--- a/nuttx/sched/sig_action.c
+++ b/nuttx/sched/sig_action.c
@@ -1,7 +1,7 @@
-/************************************************************
- * sig_action.c
+/****************************************************************************
+ * sched/sig_action.c
*
- * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * 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.
*
@@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Included Files
- ************************************************************/
+ ****************************************************************************/
#include <sys/types.h>
#include <signal.h>
@@ -44,38 +44,38 @@
#include "os_internal.h"
#include "sig_internal.h"
-/************************************************************
+/****************************************************************************
* Definitions
- ************************************************************/
+ ****************************************************************************/
#define COPY_SIGACTION(t,f) \
{ (t)->sa_sigaction = (f)->sa_sigaction; \
(t)->sa_mask = (f)->sa_mask; \
(t)->sa_flags = (f)->sa_flags; }
-/************************************************************
+/****************************************************************************
* Private Type Declarations
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Global Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Functions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Function: sig_allocateaction
*
* Description:
* Allocate a new element for a sigaction queue
*
- ************************************************************/
+ ****************************************************************************/
static FAR sigactq_t *sig_allocateaction(void)
{
@@ -105,49 +105,41 @@ static FAR sigactq_t *sig_allocateaction(void)
return sigact;
}
-/************************************************************
+/****************************************************************************
* Public Functions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Function: sigaction
*
* Description:
- * This function allows the calling process to examine
- * and/or specify the action to be associated with a
- * specific signal.
+ * This function allows the calling process to examine and/or specify the
+ * action to be associated with a specific signal.
*
- * The structure sigaction, used to describe an action to
- * be taken, is defined to include the following members:
+ * The structure sigaction, used to describe an action to be taken, is
+ * defined to include the following members:
*
- * - sa_u.sa_handler: Pointer to a signal-catching
- * function
- * - sa_u.sa_sigaction: Alternative form of the
- * signal-catching function
- * - sa_mask: An additional set of signals to be blocked
- * during execution of a signal catching function
- * - sa_flags. Special flags to affect the behavior of a
- * signal.
+ * - sa_u.sa_handler: Pointer to a signal-catching function
+ * - sa_u.sa_sigaction: Alternative form of the signal-catching function
+ * - sa_mask: An additional set of signals to be blocked during execution
+ * of a signal catching function
+ * - sa_flags. Special flags to affect the behavior of a signal.
*
- * If the argument 'act' is not NULL, it points to a
- * structure specifying the action to be associated with
- * the specified signal. If the argument 'oact' is not
- * NULL, the action previously associated with the signal
- * is stored in the location pointed to by the argument
- * 'oact.'
+ * If the argument 'act' is not NULL, it points to a structure specifying
+ * the action to be associated with the specified signal. If the argument
+ * 'oact' is not NULL, the action previously associated with the signal
+ * is stored in the location pointed to by the argument 'oact.'
*
- * When a signal is caught by a signal-catching function
- * installed by sigaction() function, a new signal mask is
- * calculated and installed for the duration of the
- * signal-catching function. This mask is formed by taking
- * the union of the current signal mask and the value of the
- * sa_mask for the signal being delivered and then including
- * the signal being delivered. If and when the user's signal
- * handler returns, the original signal mask is restored.
+ * When a signal is caught by a signal-catching function installed by
+ * sigaction() function, a new signal mask is calculated and installed for
+ * the duration of the signal-catching function. This mask is formed by
+ * taking the union of the current signal mask and the value of the
+ * sa_mask for the signal being delivered and then including the signal
+ * being delivered. If and when the user's signal handler returns, the
+ * original signal mask is restored.
*
- * Once an action is installed for a specific signal, it
- * remains installed until another action is explicitly
- * requested by another call to sigaction().
+ * Once an action is installed for a specific signal, it remains installed
+ * until another action is explicitly requested by another call to sigaction().
*
* Parameters:
* sig - Signal of interest
@@ -166,18 +158,17 @@ static FAR sigactq_t *sig_allocateaction(void)
* - All sa_flags in struct sigaction of act input are
* ignored (all treated like SA_SIGINFO).
*
- ************************************************************/
+ ****************************************************************************/
-int sigaction(int signo, const struct sigaction *act,
- struct sigaction *oact)
+int sigaction(int signo, FAR const struct sigaction *act, FAR struct sigaction *oact)
{
FAR _TCB *rtcb = (FAR _TCB*)g_readytorun.head;
FAR sigactq_t *sigact;
int ret = ERROR; /* Assume failure */
- /* Since sigactions can only be installed from the running
- * thread of execution, no special precautions should be
- * necessary. */
+ /* Since sigactions can only be installed from the running thread of
+ * execution, no special precautions should be necessary.
+ */
/* Verify the signal */
@@ -262,13 +253,13 @@ int sigaction(int signo, const struct sigaction *act,
return ret;
}
-/************************************************************
+/****************************************************************************
* Function: sig_releaseaction
*
* Description:
* Deallocate a sigaction Q entry
*
- ************************************************************/
+ ****************************************************************************/
void sig_releaseaction(FAR sigactq_t *sigact)
{
diff --git a/nuttx/sched/sig_addset.c b/nuttx/sched/sig_addset.c
index b212a37a7..678a7fcaf 100644
--- a/nuttx/sched/sig_addset.c
+++ b/nuttx/sched/sig_addset.c
@@ -1,7 +1,7 @@
-/************************************************************
- * sig_addset.c
+/****************************************************************************
+ * sched/sig_addset.c
*
- * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * 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.
*
@@ -31,44 +31,44 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Included Files
- ************************************************************/
+ ****************************************************************************/
#include <signal.h>
-/************************************************************
+/****************************************************************************
* Definitions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Type Declarations
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Global Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Function Prototypes
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Public Functions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Function: sigaddset
*
* Description:
- * This function adds the signal specified by signo to the
- * signal set specified by set.
+ * This function adds the signal specified by signo to the signal set
+ * specified by set.
*
* Parameters:
* set - Signal set to add signal to
@@ -79,9 +79,9 @@
*
* Assumptions:
*
- ************************************************************/
+ ****************************************************************************/
-int sigaddset(sigset_t *set, int signo)
+int sigaddset(FAR sigset_t *set, int signo)
{
int ret = ERROR;
@@ -89,10 +89,10 @@ int sigaddset(sigset_t *set, int signo)
if (GOOD_SIGNO(signo))
{
- /* Add the signal to the set */
+ /* Add the signal to the set */
- *set |= SIGNO2SET(signo);
- ret = OK;
+ *set |= SIGNO2SET(signo);
+ ret = OK;
}
return ret;
diff --git a/nuttx/sched/sig_delset.c b/nuttx/sched/sig_delset.c
index b18454562..78f8dc177 100644
--- a/nuttx/sched/sig_delset.c
+++ b/nuttx/sched/sig_delset.c
@@ -1,7 +1,7 @@
-/************************************************************
- * sig_delset.c
+/****************************************************************************
+ * sched/sig_delset.c
*
- * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * 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.
*
@@ -31,44 +31,44 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Included Files
- ************************************************************/
+ ****************************************************************************/
#include <signal.h>
-/************************************************************
+/****************************************************************************
* Definitions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Type Declarations
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Global Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Function Prototypes
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Public Functions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Function: sigdelset
*
* Description:
- * This function deletes the signal specified by signo from
- * the signal set specified by set.
+ * This function deletes the signal specified by signo from the signal
+ * set specified by the 'set' argument.
*
* Parameters:
* set - Signal set to delete the signal from
@@ -79,9 +79,9 @@
*
* Assumptions:
*
- ************************************************************/
+ ****************************************************************************/
-int sigdelset(sigset_t *set, int signo)
+int sigdelset(FAR sigset_t *set, int signo)
{
int ret = ERROR;
@@ -89,10 +89,10 @@ int sigdelset(sigset_t *set, int signo)
if (GOOD_SIGNO(signo))
{
- /* Delete the signal to the set */
+ /* Delete the signal to the set */
- *set &= ~SIGNO2SET(signo);
- ret = OK;
+ *set &= ~SIGNO2SET(signo);
+ ret = OK;
}
return ret;
diff --git a/nuttx/sched/sig_emptyset.c b/nuttx/sched/sig_emptyset.c
index 7c5c9d58a..c8fc4ef40 100644
--- a/nuttx/sched/sig_emptyset.c
+++ b/nuttx/sched/sig_emptyset.c
@@ -1,7 +1,7 @@
-/************************************************************
- * sig_emptyset.c
+/****************************************************************************
+ * sched/sig_emptyset.c
*
- * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * 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.
*
@@ -31,57 +31,56 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Included Files
- ************************************************************/
+ ****************************************************************************/
#include <signal.h>
-/************************************************************
+/****************************************************************************
* Definitions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Type Declarations
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Global Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Functions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Public Functions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Function: sigemptyset
*
* Description:
- * This function initializes the signal set specified by
- * set such that all signals are excluded.
+ * This function initializes the signal set specified by set such that all
+ * signals are excluded.
*
* Parameters:
* set - Signal set to initalize
*
* Return Value:
- * 0 (OK), or -1 (ERROR) if the signal set cannot be
- * initialized.
+ * 0 (OK), or -1 (ERROR) if the signal set cannot be initialized.
*
* Assumptions:
*
- ************************************************************/
+ ****************************************************************************/
-int sigemptyset(sigset_t *set)
+int sigemptyset(FAR sigset_t *set)
{
*set = NULL_SIGNAL_SET;
return OK;
diff --git a/nuttx/sched/sig_fillset.c b/nuttx/sched/sig_fillset.c
index 2159c380c..d315c0d63 100644
--- a/nuttx/sched/sig_fillset.c
+++ b/nuttx/sched/sig_fillset.c
@@ -1,7 +1,7 @@
-/************************************************************
- * sig_fillset.c
+/****************************************************************************
+ * sched/sig_fillset.c
*
- * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * 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.
*
@@ -31,57 +31,56 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Included Files
- ************************************************************/
+ ****************************************************************************/
#include <signal.h>
-/************************************************************
+/****************************************************************************
* Definitions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Type Declarations
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Global Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Function Prototypes
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Publics Functioins
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Function: sigfillset
*
* Description:
- * This function initializes the signal set specified by
- * set such that all signals are included.
+ * This function initializes the signal set specified by set such that all
+ * signals are included.
*
* Parameters:
* set - Signal set to initalize
*
* Return Value:
- * 0 (OK), or -1 (ERROR) if the signal set cannot be
- * initialized.
+ * 0 (OK), or -1 (ERROR) if the signal set cannot be initialized.
*
* Assumptions:
*
- ************************************************************/
+ ****************************************************************************/
-int sigfillset(sigset_t *set)
+int sigfillset(FAR sigset_t *set)
{
*set = ALL_SIGNAL_SET;
return OK;
diff --git a/nuttx/sched/sig_ismember.c b/nuttx/sched/sig_ismember.c
index 3c363f710..77cd520fd 100644
--- a/nuttx/sched/sig_ismember.c
+++ b/nuttx/sched/sig_ismember.c
@@ -1,7 +1,7 @@
-/************************************************************
- * sig_ismember.c
+/****************************************************************************
+ * sched/sig_ismember.c
*
- * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * 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.
*
@@ -31,44 +31,44 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Included Files
- ************************************************************/
+ ****************************************************************************/
#include <signal.h>
-/************************************************************
+/****************************************************************************
* Definitions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Type Declarations
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Global Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Function Prototypes
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Public Functions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Function: sigismember
*
* Description:
- * This function tests whether the signal specified by signo
- * is a member of the set specified by set.
+ * This function tests whether the signal specified by signo is a member
+ * of the set specified by set.
*
* Parameters:
* set - Signal set to test
@@ -81,9 +81,9 @@
*
* Assumptions:
*
- ************************************************************/
+ ****************************************************************************/
-int sigismember(const sigset_t *set, int signo)
+int sigismember(FAR const sigset_t *set, int signo)
{
int ret = ERROR;
@@ -92,6 +92,7 @@ int sigismember(const sigset_t *set, int signo)
if (GOOD_SIGNO(signo))
{
/* Check if the signal is in the set */
+
ret = ((*set & SIGNO2SET(signo)) != 0);
}
diff --git a/nuttx/sched/sig_pending.c b/nuttx/sched/sig_pending.c
index a2ee01d4e..36f242ba4 100644
--- a/nuttx/sched/sig_pending.c
+++ b/nuttx/sched/sig_pending.c
@@ -1,7 +1,7 @@
-/************************************************************
- * sig_pending.c
+/****************************************************************************
+ * sched/sig_pending.c
*
- * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * 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.
*
@@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Included Files
- ************************************************************/
+ ****************************************************************************/
#include <sys/types.h>
#include <signal.h>
@@ -43,37 +43,37 @@
#include "os_internal.h"
#include "sig_internal.h"
-/************************************************************
+/****************************************************************************
* Definitions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Type Declarations
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Global Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Function Prototypes
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Public Functions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Function: sigpending
*
* Description:
- * This function stores the returns the set of signals that
- * are blocked for delivery and that are pending for the
- * calling process in the space pointed to by set.
+ * This function stores the returns the set of signals that are blocked
+ * for delivery and that are pending for the calling process in the space
+ * pointed to by set.
*
* Parameters:
* set - The location to return the pending signal set.
@@ -83,9 +83,9 @@
*
* Assumptions:
*
- ************************************************************/
+ ****************************************************************************/
-int sigpending(sigset_t *set)
+int sigpending(FAR sigset_t *set)
{
FAR _TCB *rtcb = (FAR _TCB*)g_readytorun.head;
int ret = ERROR;
@@ -99,12 +99,13 @@ int sigpending(sigset_t *set)
return ret;
}
-/************************************************************
+/****************************************************************************
* Function: sig_pendingset
*
* Description:
* Convert the list of pending signals into a signal set
- ************************************************************/
+ *
+ ****************************************************************************/
sigset_t sig_pendingset(FAR _TCB *stcb)
{
@@ -124,5 +125,3 @@ sigset_t sig_pendingset(FAR _TCB *stcb)
return sigpendset;
}
-
-
diff --git a/nuttx/sched/sig_procmask.c b/nuttx/sched/sig_procmask.c
index 2451f830d..fcfbd43c3 100644
--- a/nuttx/sched/sig_procmask.c
+++ b/nuttx/sched/sig_procmask.c
@@ -1,7 +1,7 @@
-/************************************************************
- * sig_procmask.c
+/****************************************************************************
+ * sched/sig_procmask.c
*
- * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * 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.
*
@@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Included Files
- ************************************************************/
+ ****************************************************************************/
#include <sys/types.h>
#include <unistd.h>
@@ -50,58 +50,55 @@
#include "os_internal.h"
#include "sig_internal.h"
-/************************************************************
+/****************************************************************************
* Definitions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Type Declarations
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Global Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Function Prototypes
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Public Functions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Function: sigprocmask
*
* Description:
- * This function allows the calling process to examine
- * and/or change its signal mask. If the set is not NULL,
- * then it points to a set of signals to be used to change
- * the currently blocked set. The value of how indicates
- * the manner in which the set is changed.
+ * This function allows the calling process to examine and/or change its
+ * signal mask. If the 'set' is not NULL, then it points to a set of
+ * signals to be used to change the currently blocked set. The value of
+ * 'how' indicates the manner in which the set is changed.
*
- * If there any pending unblocked signals after the call
- * to sigprocmask(), those signals will be delivered
- * before sigprocmask() returns.
+ * If there any pending unblocked signals after the call to sigprocmask(),
+ * those signals will be delivered before sigprocmask() returns.
*
- * If sigprocmask() fails, the signal mask of the process
- * is not changed by this function call.
+ * If sigprocmask() fails, the signal mask of the process is not changed
+ * by this function call.
*
* Parameters:
* how - How the signal mast will be changed:
- * SIG_BLOCK - The resulting set is the union of
- * the current set and the signal set
- * pointed to by set.
- * SIG_UNBLOCK - The resulting set is the intersection
- * of the current set and the complement
- * of the signal set pointed to by _set.
- * SIG_SETMASK - The resulting set is the signal set
- * pointed to by set.
- * set - Location of the new signal mask
+ * SIG_BLOCK - The resulting set is the union of the current set
+ * and the signal set pointed to by 'set'.
+ * SIG_UNBLOCK - The resulting set is the intersection of the current
+ * set and the complement of the signal set pointed to
+ * by 'set'.
+ * SIG_SETMASK - The resulting set is the signal set pointed to by
+ * 'set'.
+ * set - Location of the new signal mask
* oset - Location to store the old signal mask
*
* Return Value:
@@ -109,9 +106,9 @@
*
* Assumptions:
*
- ************************************************************/
+ ****************************************************************************/
-int sigprocmask(int how, const sigset_t *set, sigset_t *oset)
+int sigprocmask(int how, FAR const sigset_t *set, FAR sigset_t *oset)
{
FAR _TCB *rtcb = (FAR _TCB*)g_readytorun.head;
sigset_t oldsigprocmask;
diff --git a/nuttx/sched/sig_suspend.c b/nuttx/sched/sig_suspend.c
index 7f7acfce2..155195200 100644
--- a/nuttx/sched/sig_suspend.c
+++ b/nuttx/sched/sig_suspend.c
@@ -1,7 +1,7 @@
-/************************************************************
+/****************************************************************************
* sig_suspend.c
*
- * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * 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.
*
@@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Included Files
- ************************************************************/
+ ****************************************************************************/
#include <sys/types.h>
#include <signal.h>
@@ -46,48 +46,46 @@
#include "os_internal.h"
#include "sig_internal.h"
-/************************************************************
+/****************************************************************************
* Definitions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Type Declarations
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Global Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Function Prototypes
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Public Functions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Function: sigsuspend
*
* Description:
*
- * The sigsuspend() function replaces the signal mask of the
- * process with the set of signals pointed to by the argument
- * set and then suspends the process until delivery of a
- * signal to the process.
+ * The sigsuspend() function replaces the signal mask of the task with the
+ * set of signals pointed to by the argument 'set' and then suspends the
+ * process until delivery of a signal to the task.
*
- * If the effect of the set argument is to unblock a
- * pending signal, then no wait is performed.
+ * If the effect of the set argument is to unblock a pending signal, then
+ * no wait is performed.
*
- * The original signal mask is restored when this function
- * returns.
+ * The original signal mask is restored when this function returns.
*
- * Waiting for an empty signal set stops a task without
- * freeing any resources.
+ * Waiting for an empty signal set stops a task without freeing any
+ * resources.
*
* Parameters:
* set - signal mask to use while suspended.
@@ -100,16 +98,14 @@
* POSIX Compatibility:
* int sigsuspend(const sigset_t *set);
*
- * POSIX states that sigsuspend() "suspends the process
- * until delivery of a signal whose action is either to
- * execute a signal-catching function or to terminate the
- * process." Only the deliver of a signal is required in
- * the present implementation (even if the signal is
- * ignored).
+ * POSIX states that sigsuspend() "suspends the process until delivery of
+ * a signal whose action is either to execute a signal-catching function
+ * or to terminate the process." Only the deliver of a signal is required
+ * in the present implementation (even if the signal is ignored).
*
- ************************************************************/
+ ****************************************************************************/
-int sigsuspend(const sigset_t *set)
+int sigsuspend(FAR const sigset_t *set)
{
FAR _TCB *rtcb = (FAR _TCB*)g_readytorun.head;
sigset_t intersection;
diff --git a/nuttx/sched/sig_timedwait.c b/nuttx/sched/sig_timedwait.c
index 78fc9c28a..0fe35a069 100644
--- a/nuttx/sched/sig_timedwait.c
+++ b/nuttx/sched/sig_timedwait.c
@@ -1,7 +1,7 @@
-/************************************************************
- * sig_timedwait.c
+/****************************************************************************
+ * sched/sig_timedwait.c
*
- * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * 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.
*
@@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Included Files
- ************************************************************/
+ ****************************************************************************/
#include <sys/types.h>
#include <string.h>
@@ -50,40 +50,40 @@
#include "sig_internal.h"
#include "clock_internal.h"
-/************************************************************
+/****************************************************************************
* Definitions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Type Declarations
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Global Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Functionss
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Function: sig_timeout
*
* Description:
* A timeout elapsed while waiting for signals to be queued.
- ************************************************************/
+ *
+ ****************************************************************************/
-static void sig_timeout(int argc, uint32 itcb, ...)
+static void sig_timeout(int argc, uint32 itcb)
{
- /* On many small machines, pointers are encoded and cannot
- * be simply cast from uint32 to _TCB*. The following
- * union works around this (see wdogparm_t). This odd
- * logic could be conditioned on CONFIG_CAN_CAST_POINTERS,
- * but it is not too bad in any case.
+ /* On many small machines, pointers are encoded and cannot be simply cast
+ * from uint32 to _TCB*. The following union works around this
+ * (see wdogparm_t). This odd logic could be conditioned on
+ * CONFIG_CAN_CAST_POINTERS, but it is not too bad in any case.
*/
union
@@ -105,37 +105,34 @@ static void sig_timeout(int argc, uint32 itcb, ...)
if (u.wtcb->task_state == TSTATE_WAIT_SIG)
{
- u.wtcb->sigunbinfo.si_signo = ERROR;
- u.wtcb->sigunbinfo.si_code = SI_TIMER;
+ u.wtcb->sigunbinfo.si_signo = ERROR;
+ u.wtcb->sigunbinfo.si_code = SI_TIMER;
u.wtcb->sigunbinfo.si_value.sival_int = 0;
up_unblock_task(u.wtcb);
}
}
-/************************************************************
+/****************************************************************************
* Public Functions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Function: sigtimedwait
*
* Description:
- * This function selects the pending signal set specified
- * by the argument set. If multiple signals are pending
- * in set, it will remove and return the lowest numbered
- * one. If no signals in set are pending at the time of
- * the call, the calling process will be suspended until
- * one of the signals in set becomes pending, OR until
- * the process is interrupted by an unblocked signal, OR
- * until the time interval specified by timeout (if any),
- * has expired. If timeout is NULL, then the timeout
- * interval is forever.
+ * This function selects the pending signal set specified by the argument
+ * set. If multiple signals are pending in set, it will remove and return
+ * the lowest numbered one. If no signals in set are pending at the time
+ * of the call, the calling process will be suspended until one of the
+ * signals in set becomes pending, OR until the process is interrupted by
+ * an unblocked signal, OR until the time interval specified by timeout
+ * (if any), has expired. If timeout is NULL, then the timeout interval
+ * is forever.
*
- * If the info argument is non-NULL, the selected signal
- * number is stored in the si_signo member and the cause
- * of the signal is store in the si_code emember. The
- * content of si_value is only meaningful if the signal was
- * generated by sigqueue().
+ * If the info argument is non-NULL, the selected signal number is stored
+ * in the si_signo member and the cause of the signal is store in the
+ * si_code emember. The content of si_value is only meaningful if the
+ * signal was generated by sigqueue().
*
* The following values for si_code are defined in signal.h:
* SI_USER - Signal sent from kill, raise, or abort
@@ -151,15 +148,15 @@ static void sig_timeout(int argc, uint32 itcb, ...)
* timeout - The amount of time to wait
*
* Return Value:
- * Signal number that cause the wait to be terminated, otherwise
- * -1 (ERROR) is returned.
+ * Signal number that cause the wait to be terminated, otherwise -1 (ERROR)
+ * is returned.
*
* Assumptions:
*
- ************************************************************/
+ ****************************************************************************/
-int sigtimedwait(const sigset_t *set, struct siginfo *info,
- const struct timespec *timeout)
+int sigtimedwait(FAR const sigset_t *set, FAR struct siginfo *info,
+ FAR const struct timespec *timeout)
{
FAR _TCB *rtcb = (FAR _TCB*)g_readytorun.head;
sigset_t intersection;
@@ -242,12 +239,11 @@ int sigtimedwait(const sigset_t *set, struct siginfo *info,
*/
wdparm_t wdparm;
- wdparm.pvarg = (void*)rtcb;
+ wdparm.pvarg = (FAR void*)rtcb;
/* Start the watchdog */
- wd_start(wdog, waitticks, (wdentry_t)sig_timeout,
- 1, wdparm.dwarg);
+ wd_start(wdog, waitticks, (wdentry_t)sig_timeout, 1, wdparm.dwarg);
/* Now wait for either the signal or the watchdog */
@@ -290,4 +286,3 @@ int sigtimedwait(const sigset_t *set, struct siginfo *info,
return ret;
}
-
diff --git a/nuttx/sched/sig_waitinfo.c b/nuttx/sched/sig_waitinfo.c
index 3d539defb..fd218535c 100644
--- a/nuttx/sched/sig_waitinfo.c
+++ b/nuttx/sched/sig_waitinfo.c
@@ -1,7 +1,7 @@
-/************************************************************
- * sig_waitinfo.c
+/****************************************************************************
+ * sched/sig_waitinfo.c
*
- * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * 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.
*
@@ -31,59 +31,59 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Included Files
- ************************************************************/
+ ****************************************************************************/
#include <sys/types.h>
#include <signal.h>
-/************************************************************
+/****************************************************************************
* Definitions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Type Declarations
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Global Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Functions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Public Functions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Function: sigwaitinfo
*
* Description:
- * This function is equivalent to sigtimedwait with a NULL
- * timeout parameter. (see above).
+ * This function is equivalent to sigtimedwait with a NULL timeout
+ * parameter.
*
* Parameters:
* set - The pending signal set
* info - The returned value
*
* Return Value:
- * Signal number that cause the wait to be terminated, otherwise
- * -1 (ERROR) is returned.
+ * Signal number that cause the wait to be terminated, otherwise -1 (ERROR)
+ * is returned.
*
* Assumptions:
*
- ************************************************************/
+ ****************************************************************************/
-int sigwaitinfo(const sigset_t *set, struct siginfo *info)
+int sigwaitinfo(FAR const sigset_t *set, FAR struct siginfo *info)
{
return sigtimedwait(set, info, NULL);
}
diff --git a/nuttx/sched/timer_settime.c b/nuttx/sched/timer_settime.c
index a9a7fd7c4..c1729aeac 100644
--- a/nuttx/sched/timer_settime.c
+++ b/nuttx/sched/timer_settime.c
@@ -1,7 +1,7 @@
/********************************************************************************
- * timer_settime.c
+ * sched/timer_settime.c
*
- * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * 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.
*
@@ -140,7 +140,7 @@ static void inline timer_restart(FAR struct posix_timer_s *timer, uint32 itimer)
if (timer->pt_delay)
{
timer->pt_last = timer->pt_delay;
- (void)wd_start(timer->pt_wdog, timer->pt_delay, timer_timeout, 1, itimer);
+ (void)wd_start(timer->pt_wdog, timer->pt_delay, (wdentry_t)timer_timeout, 1, itimer);
}
}
@@ -164,7 +164,7 @@ static void inline timer_restart(FAR struct posix_timer_s *timer, uint32 itimer)
*
********************************************************************************/
-static void timer_timeout(int argc, uint32 itimer, ...)
+static void timer_timeout(int argc, uint32 itimer)
{
#ifndef CONFIG_CAN_PASS_STRUCTS
/* On many small machines, pointers are encoded and cannot be simply cast from
@@ -355,7 +355,7 @@ int timer_settime(timer_t timerid, int flags, FAR const struct itimerspec *value
if (delay > 0)
{
timer->pt_last = delay;
- ret = wd_start(timer->pt_wdog, timer->pt_delay, timer_timeout, 1, (uint32)timer);
+ ret = wd_start(timer->pt_wdog, timer->pt_delay, (wdentry_t)timer_timeout, 1, (uint32)timer);
}
irqrestore(state);
diff --git a/nuttx/sched/wd_create.c b/nuttx/sched/wd_create.c
index 0fad7cef9..dcd301a56 100644
--- a/nuttx/sched/wd_create.c
+++ b/nuttx/sched/wd_create.c
@@ -1,7 +1,7 @@
-/************************************************************
- * wd_create.c
+/****************************************************************************
+ * sched/wd_create.c
*
- * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * 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.
*
@@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Included Files
- ************************************************************/
+ ****************************************************************************/
#include <sys/types.h>
#include <wdog.h>
@@ -43,55 +43,55 @@
#include <nuttx/arch.h>
#include "wd_internal.h"
-/************************************************************
+/****************************************************************************
* Definitions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Type Declarations
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Global Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Functions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Public Functions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Function: wd_create
*
* Description:
- * The wd_create function will create a watchdog by
- * allocating it from the free list.
+ * The wd_create function will create a watchdog by allocating it from the
+ * list of free watchdogs.
*
* Parameters:
* None
*
* Return Value:
- * Pointer to watchdog (i.e., the watchdog ID), or NULL
- * if insufficient watchdogs are available.
+ * Pointer to watchdog (i.e., the watchdog ID), or NULL if insufficient
+ * watchdogs are available.
*
* Assumptions:
*
- ************************************************************/
+ ****************************************************************************/
WDOG_ID wd_create (void)
{
- wdog_t *wdog;
+ FAR wdog_t *wdog;
irqstate_t saved_state;
saved_state = irqsave();
- wdog = (wdog_t*)sq_remfirst(&g_wdfreelist);
+ wdog = (FAR wdog_t*)sq_remfirst(&g_wdfreelist);
irqrestore(saved_state);
/* Indicate that the watchdog is not actively timing */
diff --git a/nuttx/sched/wd_start.c b/nuttx/sched/wd_start.c
index a0fb469de..aa732420f 100644
--- a/nuttx/sched/wd_start.c
+++ b/nuttx/sched/wd_start.c
@@ -1,7 +1,7 @@
-/************************************************************
- * wd_start.c
+/****************************************************************************
+ * sched/wd_start.c
*
- * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * 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.
*
@@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Included Files
- ************************************************************/
+ ****************************************************************************/
#include <sys/types.h>
#include <stdarg.h>
@@ -46,13 +46,13 @@
#include "os_internal.h"
#include "wd_internal.h"
-/************************************************************
+/****************************************************************************
* Definitions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Type Declarations
- ************************************************************/
+ ****************************************************************************/
typedef void (*wdentry0_t)(int argc);
#if CONFIG_MAX_WDOGPARMS > 0
@@ -70,23 +70,23 @@ typedef void (*wdentry4_t)(int argc, uint32 arg1, uint32 arg2,
uint32 arg3, uint32 arg4);
#endif
-/************************************************************
+/****************************************************************************
* Global Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Variables
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Private Functions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Public Functions
- ************************************************************/
+ ****************************************************************************/
-/************************************************************
+/****************************************************************************
* Function: wd_start
*
* Description:
@@ -107,9 +107,9 @@ typedef void (*wdentry4_t)(int argc, uint32 arg1, uint32 arg2,
* any effect.
*
* Parameters:
- * wdog = watchdog ID
- * delay = Delay count in clock ticks
- * wdentry = function to call on timeout
+ * wdog = watchdog ID
+ * delay = Delay count in clock ticks
+ * wdentry = function to call on timeout
* parm1..4 = parameters to pass to wdentry
*
* Return Value:
@@ -119,15 +119,14 @@ typedef void (*wdentry4_t)(int argc, uint32 arg1, uint32 arg2,
* The watchdog routine runs in the context of the timer interrupt
* handler and is subject to all ISR restrictions.
*
- ************************************************************/
+ ****************************************************************************/
-STATUS wd_start(WDOG_ID wdog, int delay, wdentry_t wdentry,
- int argc, ...)
+STATUS wd_start(WDOG_ID wdog, int delay, wdentry_t wdentry, int argc, ...)
{
va_list ap;
- wdog_t *curr;
- wdog_t *prev;
- wdog_t *next;
+ FAR wdog_t *curr;
+ FAR wdog_t *prev;
+ FAR wdog_t *next;
sint32 now;
irqstate_t saved_state;
int i;
@@ -154,8 +153,8 @@ STATUS wd_start(WDOG_ID wdog, int delay, wdentry_t wdentry,
/* Save the data in the watchdog structure */
- wdog->func = wdentry; /* Function to execute when delay expires */
- wdog->argc = argc;
+ wdog->func = wdentry; /* Function to execute when delay expires */
+ wdog->argc = argc;
va_start(ap, argc);
for (i = 0; i < argc; i++)
@@ -226,7 +225,7 @@ STATUS wd_start(WDOG_ID wdog, int delay, wdentry_t wdentry,
/* Insert the new watchdog in the list */
- if (curr == (wdog_t*)g_wdactivelist.head)
+ if (curr == (FAR wdog_t*)g_wdactivelist.head)
{
sq_addfirst((FAR sq_entry_t*)wdog, &g_wdactivelist);
}
@@ -268,14 +267,13 @@ STATUS wd_start(WDOG_ID wdog, int delay, wdentry_t wdentry,
return OK;
}
-/************************************************************
+/****************************************************************************
* Function: wd_timer
*
* Description:
- * This function is called from the timer interrupt
- * handler to determine if it is time to execute a watchdog
- * function. If so, the watchdog function will be executed
- * in the context of the timer interrupt handler.
+ * This function is called from the timer interrupt handler to determine
+ * if it is time to execute a watchdog function. If so, the watchdog
+ * function will be executed in the context of the timer interrupt handler.
*
* Parameters:
* None
@@ -285,12 +283,12 @@ STATUS wd_start(WDOG_ID wdog, int delay, wdentry_t wdentry,
*
* Assumptions:
*
- ************************************************************/
+ ****************************************************************************/
void wd_timer(void)
{
- pid_t pid;
- wdog_t *wdog;
+ pid_t pid;
+ FAR wdog_t *wdog;
/* Check if there are any active watchdogs to process */
@@ -298,22 +296,22 @@ void wd_timer(void)
{
/* There are. Decrement the lag counter */
- --(((wdog_t*)g_wdactivelist.head)->lag);
+ --(((FAR wdog_t*)g_wdactivelist.head)->lag);
/* Check if the watchdog at the head of the list is ready to run */
- if (((wdog_t*)g_wdactivelist.head)->lag <= 0)
+ if (((FAR wdog_t*)g_wdactivelist.head)->lag <= 0)
{
/* Process the watchdog at the head of the list as well as any
* other watchdogs that became ready to run at this time
*/
while (g_wdactivelist.head &&
- ((wdog_t*)g_wdactivelist.head)->lag <= 0)
+ ((FAR wdog_t*)g_wdactivelist.head)->lag <= 0)
{
/* Remove the watchdog from the head of the list */
- wdog = (wdog_t*)sq_remfirst(&g_wdactivelist);
+ wdog = (FAR wdog_t*)sq_remfirst(&g_wdactivelist);
/* If there is another watchdog behind this one, update its
* its lag (this shouldn't be necessary).
@@ -321,7 +319,7 @@ void wd_timer(void)
if (g_wdactivelist.head)
{
- ((wdog_t*)g_wdactivelist.head)->lag += wdog->lag;
+ ((FAR wdog_t*)g_wdactivelist.head)->lag += wdog->lag;
}
/* Indicate that the watchdog is no longer activer. */