summaryrefslogtreecommitdiff
path: root/nuttx/sched
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-03-20 16:51:12 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-03-20 16:51:12 +0000
commit360b2b7ab8fd7cf337f02e260346a0f0ecbb8064 (patch)
tree7e83b806156983fa5af8a32715d849762b8c7346 /nuttx/sched
parentd913f00d3b4bcbebc12dfa7ea017bacd17464b88 (diff)
downloadpx4-nuttx-360b2b7ab8fd7cf337f02e260346a0f0ecbb8064.tar.gz
px4-nuttx-360b2b7ab8fd7cf337f02e260346a0f0ecbb8064.tar.bz2
px4-nuttx-360b2b7ab8fd7cf337f02e260346a0f0ecbb8064.zip
Restructure header files for POSIX compliance; eliminate compile warnings
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@107 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/sched')
-rw-r--r--nuttx/sched/mq_internal.h3
-rw-r--r--nuttx/sched/mq_notify.c1
-rw-r--r--nuttx/sched/mq_open.c1
-rw-r--r--nuttx/sched/mq_receive.c3
-rw-r--r--nuttx/sched/mq_send.c3
-rw-r--r--nuttx/sched/mq_setattr.c1
-rw-r--r--nuttx/sched/pthread_attrgetschedparam.c1
-rw-r--r--nuttx/sched/pthread_attrsetschedparam.c1
-rw-r--r--nuttx/sched/pthread_attrsetschedpolicy.c1
-rw-r--r--nuttx/sched/pthread_create.c3
-rw-r--r--nuttx/sched/sched_addblocked.c4
-rw-r--r--nuttx/sched/sched_addreadytorun.c4
-rw-r--r--nuttx/sched/sched_free.c2
-rw-r--r--nuttx/sched/sched_removeblocked.c2
-rw-r--r--nuttx/sched/sched_removereadytorun.c2
-rw-r--r--nuttx/sched/sched_setparam.c4
-rw-r--r--nuttx/sched/sched_setupidlefiles.c1
-rw-r--r--nuttx/sched/sem_init.c3
-rw-r--r--nuttx/sched/sem_open.c6
-rw-r--r--nuttx/sched/sem_post.c3
-rw-r--r--nuttx/sched/sig_timedwait.c9
-rw-r--r--nuttx/sched/task_create.c2
-rw-r--r--nuttx/sched/task_delete.c2
-rw-r--r--nuttx/sched/task_restart.c6
-rw-r--r--nuttx/sched/task_setup.c2
25 files changed, 43 insertions, 27 deletions
diff --git a/nuttx/sched/mq_internal.h b/nuttx/sched/mq_internal.h
index 0ffdea53e..a19e71bdf 100644
--- a/nuttx/sched/mq_internal.h
+++ b/nuttx/sched/mq_internal.h
@@ -41,6 +41,7 @@
************************************************************/
#include <sys/types.h>
+#include <limits.h>
#include <mqueue.h>
#include <sched.h>
#include <signal.h>
@@ -57,7 +58,7 @@
#define MQ_MAX_BYTES CONFIG_MQ_MAXMSGSIZE
#define MQ_MAX_HWORDS ((MQ_MAX_BYTES + sizeof(uint16) - 1) / sizeof(uint16))
#define MQ_MAX_MSGS 16
-#define MQ_PRIO_MAX 255
+#define MQ_PRIO_MAX _POSIX_MQ_PRIO_MAX
/* This defines the number of messages descriptors to allocate
* at each "gulp."
diff --git a/nuttx/sched/mq_notify.c b/nuttx/sched/mq_notify.c
index 3632c7636..60d5bc1a8 100644
--- a/nuttx/sched/mq_notify.c
+++ b/nuttx/sched/mq_notify.c
@@ -38,6 +38,7 @@
************************************************************/
#include <sys/types.h> /* uint32, etc. */
+#include <signal.h>
#include <mqueue.h>
#include <sched.h>
#include "os_internal.h"
diff --git a/nuttx/sched/mq_open.c b/nuttx/sched/mq_open.c
index 13c964e53..8290aa0d2 100644
--- a/nuttx/sched/mq_open.c
+++ b/nuttx/sched/mq_open.c
@@ -40,6 +40,7 @@
#include <sys/types.h> /* uint32, etc. */
#include <stdarg.h> /* va_list */
#include <mqueue.h>
+#include <fcntl.h>
#include <string.h>
#include <sched.h>
#include <errno.h>
diff --git a/nuttx/sched/mq_receive.c b/nuttx/sched/mq_receive.c
index 35b84bb74..65fcb81c2 100644
--- a/nuttx/sched/mq_receive.c
+++ b/nuttx/sched/mq_receive.c
@@ -40,6 +40,7 @@
#include <sys/types.h> /* uint32, etc. */
#include <stdarg.h> /* va_list */
#include <unistd.h>
+#include <fcntl.h> /* O_NONBLOCK */
#include <string.h>
#include <assert.h>
#include <mqueue.h>
@@ -183,7 +184,7 @@ int mq_receive(mqd_t mqdes, void *msg, size_t msglen, int *prio)
/* Copy the message into the caller's buffer */
- memcpy(msg, (void*)curr->mail, rcvmsglen);
+ memcpy(msg, (const void*)curr->mail, rcvmsglen);
/* Copy the message priority as well (if a buffer is provided) */
diff --git a/nuttx/sched/mq_send.c b/nuttx/sched/mq_send.c
index a0172a154..96d577759 100644
--- a/nuttx/sched/mq_send.c
+++ b/nuttx/sched/mq_send.c
@@ -40,6 +40,7 @@
#include <nuttx/compiler.h>
#include <nuttx/kmalloc.h>
#include <sys/types.h> /* uint32, etc. */
+#include <fcntl.h>
#include <mqueue.h>
#include <string.h>
#include <sched.h>
@@ -306,7 +307,7 @@ int mq_send(mqd_t mqdes, const void *msg, size_t msglen, int prio)
/* Copy the message data into the message */
- memcpy((const void*)curr->mail, (void*)msg, msglen);
+ memcpy((void*)curr->mail, (const void*)msg, msglen);
/* Insert the new message in the message queue */
diff --git a/nuttx/sched/mq_setattr.c b/nuttx/sched/mq_setattr.c
index 6976886de..f0eca4eae 100644
--- a/nuttx/sched/mq_setattr.c
+++ b/nuttx/sched/mq_setattr.c
@@ -38,6 +38,7 @@
************************************************************/
#include <sys/types.h> /* uint32, etc. */
+#include <fcntl.h> /* O_NONBLOCK */
#include <mqueue.h>
#include "mq_internal.h"
diff --git a/nuttx/sched/pthread_attrgetschedparam.c b/nuttx/sched/pthread_attrgetschedparam.c
index defed57e6..e33b132cd 100644
--- a/nuttx/sched/pthread_attrgetschedparam.c
+++ b/nuttx/sched/pthread_attrgetschedparam.c
@@ -40,6 +40,7 @@
#include <sys/types.h>
#include <pthread.h>
#include <string.h>
+#include <sched.h>
#include <debug.h>
#include <errno.h>
#include "pthread_internal.h"
diff --git a/nuttx/sched/pthread_attrsetschedparam.c b/nuttx/sched/pthread_attrsetschedparam.c
index 77dfa1ccc..c9660c31c 100644
--- a/nuttx/sched/pthread_attrsetschedparam.c
+++ b/nuttx/sched/pthread_attrsetschedparam.c
@@ -40,6 +40,7 @@
#include <sys/types.h>
#include <pthread.h>
#include <string.h>
+#include <sched.h>
#include <debug.h>
#include <errno.h>
#include "pthread_internal.h"
diff --git a/nuttx/sched/pthread_attrsetschedpolicy.c b/nuttx/sched/pthread_attrsetschedpolicy.c
index 2ba20db51..09a9e92a0 100644
--- a/nuttx/sched/pthread_attrsetschedpolicy.c
+++ b/nuttx/sched/pthread_attrsetschedpolicy.c
@@ -40,6 +40,7 @@
#include <sys/types.h>
#include <pthread.h>
#include <string.h>
+#include <sched.h>
#include <debug.h>
#include <errno.h>
#include "pthread_internal.h"
diff --git a/nuttx/sched/pthread_create.c b/nuttx/sched/pthread_create.c
index 4346a6f65..8247ed78e 100644
--- a/nuttx/sched/pthread_create.c
+++ b/nuttx/sched/pthread_create.c
@@ -39,6 +39,7 @@
#include <nuttx/config.h>
#include <sys/types.h>
+#include <string.h>
#include <pthread.h>
#include <sched.h>
#include <debug.h>
@@ -408,7 +409,7 @@ int pthread_create(pthread_t *thread, pthread_attr_t *attr,
else
{
sched_unlock();
- dq_rem((FAR dq_entry_t*)ptcb, &g_inactivetasks);
+ dq_rem((FAR dq_entry_t*)ptcb, (dq_queue_t*)&g_inactivetasks);
(void)sem_destroy(&pjoin->data_sem);
(void)sem_destroy(&pjoin->exit_sem);
sched_releasetcb(ptcb);
diff --git a/nuttx/sched/sched_addblocked.c b/nuttx/sched/sched_addblocked.c
index 648d3f581..571b532a5 100644
--- a/nuttx/sched/sched_addblocked.c
+++ b/nuttx/sched/sched_addblocked.c
@@ -102,13 +102,13 @@ void sched_addblocked(FAR _TCB *btcb, tstate_t task_state)
{
/* Add the task to a prioritized list */
- sched_addprioritized(btcb, g_tasklisttable[task_state].list);
+ sched_addprioritized(btcb, (dq_queue_t*)g_tasklisttable[task_state].list);
}
else
{
/* Add the task to a non-prioritized list */
- dq_addlast((FAR dq_entry_t*)btcb, g_tasklisttable[task_state].list);
+ dq_addlast((FAR dq_entry_t*)btcb, (dq_queue_t*)g_tasklisttable[task_state].list);
}
/* Make sure the TCB's state corresponds to the list */
diff --git a/nuttx/sched/sched_addreadytorun.c b/nuttx/sched/sched_addreadytorun.c
index 4344caf31..d3b32fef1 100644
--- a/nuttx/sched/sched_addreadytorun.c
+++ b/nuttx/sched/sched_addreadytorun.c
@@ -111,14 +111,14 @@ boolean sched_addreadytorun(FAR _TCB *btcb)
* task to the g_pendingtasks task list for now.
*/
- sched_addprioritized(btcb, &g_pendingtasks);
+ sched_addprioritized(btcb, (dq_queue_t*)&g_pendingtasks);
btcb->task_state = TSTATE_TASK_PENDING;
ret = FALSE;
}
/* Otherwise, add the new task to the g_readytorun task list */
- else if (sched_addprioritized(btcb, &g_readytorun))
+ else if (sched_addprioritized(btcb, (dq_queue_t*)&g_readytorun))
{
/* Information the instrumentation logic that we are switching tasks */
diff --git a/nuttx/sched/sched_free.c b/nuttx/sched/sched_free.c
index 832e71082..ec2688c57 100644
--- a/nuttx/sched/sched_free.c
+++ b/nuttx/sched/sched_free.c
@@ -93,7 +93,7 @@ void sched_free(FAR void *address)
/* Yes.. Delay the deallocation until a more appropriate time. */
irqstate_t saved_state = irqsave();
- sq_addlast((FAR sq_entry_t*)address, &g_delayeddeallocations);
+ sq_addlast((FAR sq_entry_t*)address, (sq_queue_t*)&g_delayeddeallocations);
irqrestore(saved_state);
}
else
diff --git a/nuttx/sched/sched_removeblocked.c b/nuttx/sched/sched_removeblocked.c
index 2b9294003..79e8a3e75 100644
--- a/nuttx/sched/sched_removeblocked.c
+++ b/nuttx/sched/sched_removeblocked.c
@@ -103,7 +103,7 @@ void sched_removeblocked(FAR _TCB *btcb)
* with this state
*/
- dq_rem((FAR dq_entry_t*)btcb, g_tasklisttable[task_state].list);
+ dq_rem((FAR dq_entry_t*)btcb, (dq_queue_t*)g_tasklisttable[task_state].list);
/* Make sure the TCB's state corresponds to not being in
* any list
diff --git a/nuttx/sched/sched_removereadytorun.c b/nuttx/sched/sched_removereadytorun.c
index 1c17feba0..2c3c8352d 100644
--- a/nuttx/sched/sched_removereadytorun.c
+++ b/nuttx/sched/sched_removereadytorun.c
@@ -110,7 +110,7 @@ boolean sched_removereadytorun(FAR _TCB *rtcb)
/* Remove the TCB from the ready-to-run list */
- dq_rem((FAR dq_entry_t*)rtcb, &g_readytorun);
+ dq_rem((FAR dq_entry_t*)rtcb, (dq_queue_t*)&g_readytorun);
rtcb->task_state = TSTATE_TASK_INVALID;
return ret;
diff --git a/nuttx/sched/sched_setparam.c b/nuttx/sched/sched_setparam.c
index 52389ae49..cb363950c 100644
--- a/nuttx/sched/sched_setparam.c
+++ b/nuttx/sched/sched_setparam.c
@@ -240,7 +240,7 @@ int sched_setparam(pid_t pid, const struct sched_param *param)
{
/* Remove the TCB from the prioritized task list */
- dq_rem((FAR dq_entry_t*)tcb, g_tasklisttable[task_state].list);
+ dq_rem((FAR dq_entry_t*)tcb, (dq_queue_t*)g_tasklisttable[task_state].list);
/* Change the task priority */
@@ -250,7 +250,7 @@ int sched_setparam(pid_t pid, const struct sched_param *param)
* position
*/
- sched_addprioritized(tcb, g_tasklisttable[task_state].list);
+ sched_addprioritized(tcb, (dq_queue_t*)g_tasklisttable[task_state].list);
}
/* CASE 3b. The task resides in a non-prioritized list. */
diff --git a/nuttx/sched/sched_setupidlefiles.c b/nuttx/sched/sched_setupidlefiles.c
index 871a445bd..78d8d60ad 100644
--- a/nuttx/sched/sched_setupidlefiles.c
+++ b/nuttx/sched/sched_setupidlefiles.c
@@ -40,6 +40,7 @@
#include <nuttx/config.h>
#include <stdio.h>
#include <unistd.h>
+#include <fcntl.h>
#include <sched.h>
#include <errno.h>
#include "os_internal.h"
diff --git a/nuttx/sched/sem_init.c b/nuttx/sched/sem_init.c
index 36f2b9942..861d62056 100644
--- a/nuttx/sched/sem_init.c
+++ b/nuttx/sched/sem_init.c
@@ -38,6 +38,7 @@
************************************************************/
#include <sys/types.h>
+#include <limits.h>
#include <semaphore.h>
#include "sem_internal.h"
@@ -100,7 +101,7 @@ int sem_init (sem_t *sem, int pshared, unsigned int value)
{
int ret = ERROR;
- if (sem && value <= SEM_MAX_VALUE)
+ if (sem && value <= SEM_VALUE_MAX)
{
sem->semcount = (sint16)value;
ret = OK;
diff --git a/nuttx/sched/sem_open.c b/nuttx/sched/sem_open.c
index e9f6335c6..dbfa98fd5 100644
--- a/nuttx/sched/sem_open.c
+++ b/nuttx/sched/sem_open.c
@@ -39,6 +39,8 @@
#include <sys/types.h>
#include <stdarg.h>
+#include <limits.h>
+#include <fcntl.h>
#include <string.h>
#include <semaphore.h>
#include <errno.h>
@@ -105,7 +107,7 @@
* 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_MAX_VALUE.
+ * or equal to SEM_VALUE_MAX.
*
* Return Value:
* A pointer to sem_t or -1 (ERROR) if unsuccessful.
@@ -170,7 +172,7 @@ FAR sem_t *sem_open (const char *name, int oflag, ...)
/* Verify that a legal initial value was selected. */
- if (value <= SEM_MAX_VALUE)
+ if (value <= SEM_VALUE_MAX)
{
/* Allocate memory for the new semaphore */
diff --git a/nuttx/sched/sem_post.c b/nuttx/sched/sem_post.c
index 857b20def..2a6af5e21 100644
--- a/nuttx/sched/sem_post.c
+++ b/nuttx/sched/sem_post.c
@@ -38,6 +38,7 @@
************************************************************/
#include <sys/types.h>
+#include <limits.h>
#include <semaphore.h>
#include <sched.h>
#include <nuttx/arch.h>
@@ -123,7 +124,7 @@ int sem_post(sem_t *sem)
/* Perform the semaphore unlock operation. */
- ASSERT(sem->semcount < SEM_MAX_VALUE);
+ ASSERT(sem->semcount < SEM_VALUE_MAX);
sem->semcount++;
/* If the result of of semaphore unlock is non-positive, then
diff --git a/nuttx/sched/sig_timedwait.c b/nuttx/sched/sig_timedwait.c
index eb3151dfa..78fc9c28a 100644
--- a/nuttx/sched/sig_timedwait.c
+++ b/nuttx/sched/sig_timedwait.c
@@ -106,7 +106,7 @@ 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_TIMEOUT;
+ u.wtcb->sigunbinfo.si_code = SI_TIMER;
u.wtcb->sigunbinfo.si_value.sival_int = 0;
up_unblock_task(u.wtcb);
}
@@ -138,11 +138,12 @@ static void sig_timeout(int argc, uint32 itcb, ...)
* generated by sigqueue().
*
* The following values for si_code are defined in signal.h:
+ * SI_USER - Signal sent from kill, raise, or abort
* SI_QUEUE - Signal sent from sigqueue
+ * SI_TIMER - Signal is result of timer expiration
+ * SI_ASYNCIO - Signal is the result of asynch IO completion
* SI_MESGQ - Signal generated by arrival of a message on an
- * empty message queue
- * SI_NOWAIT - Signal already pending -- don't know how sent
- * SI_TIMEOUT - No Signal, restarted by timeout
+ * empty message queue.
*
* Parameters:
* set - The pending signal set.
diff --git a/nuttx/sched/task_create.c b/nuttx/sched/task_create.c
index 04313c499..d142581ff 100644
--- a/nuttx/sched/task_create.c
+++ b/nuttx/sched/task_create.c
@@ -170,7 +170,7 @@ int task_create(const char *name, int priority,
status = task_activate(tcb);
if (status != OK)
{
- dq_rem((FAR dq_entry_t*)tcb, &g_inactivetasks);
+ dq_rem((FAR dq_entry_t*)tcb, (dq_queue_t*)&g_inactivetasks);
sched_releasetcb(tcb);
return ERROR;
}
diff --git a/nuttx/sched/task_delete.c b/nuttx/sched/task_delete.c
index f6f2827e1..4f463bd60 100644
--- a/nuttx/sched/task_delete.c
+++ b/nuttx/sched/task_delete.c
@@ -148,7 +148,7 @@ STATUS task_delete(pid_t pid)
/* Remove the task from the OS's tasks lists. */
- dq_rem((FAR dq_entry_t*)dtcb, g_tasklisttable[dtcb->task_state].list);
+ dq_rem((FAR dq_entry_t*)dtcb, (dq_queue_t*)g_tasklisttable[dtcb->task_state].list);
dtcb->task_state = TSTATE_TASK_INVALID;
irqrestore(saved_state);
diff --git a/nuttx/sched/task_restart.c b/nuttx/sched/task_restart.c
index eb6ef8d72..399bcb6e5 100644
--- a/nuttx/sched/task_restart.c
+++ b/nuttx/sched/task_restart.c
@@ -139,7 +139,7 @@ STATUS task_restart(pid_t pid)
*/
state = irqsave();
- dq_rem((FAR dq_entry_t*)tcb, g_tasklisttable[tcb->task_state].list);
+ dq_rem((FAR dq_entry_t*)tcb, (dq_queue_t*)g_tasklisttable[tcb->task_state].list);
tcb->task_state = TSTATE_TASK_INVALID;
irqrestore(state);
@@ -159,7 +159,7 @@ STATUS task_restart(pid_t pid)
/* Add the task to the inactive task list */
- dq_addfirst((FAR dq_entry_t*)tcb, &g_inactivetasks);
+ dq_addfirst((FAR dq_entry_t*)tcb, (dq_queue_t*)&g_inactivetasks);
tcb->task_state = TSTATE_TASK_INACTIVE;
/* Activate the task */
@@ -167,7 +167,7 @@ STATUS task_restart(pid_t pid)
status = task_activate(tcb);
if (status != OK)
{
- dq_rem((FAR dq_entry_t*)tcb, &g_inactivetasks);
+ dq_rem((FAR dq_entry_t*)tcb, (dq_queue_t*)&g_inactivetasks);
sched_releasetcb(tcb);
return ERROR;
}
diff --git a/nuttx/sched/task_setup.c b/nuttx/sched/task_setup.c
index fbce5fcee..6b2a5c2ff 100644
--- a/nuttx/sched/task_setup.c
+++ b/nuttx/sched/task_setup.c
@@ -201,7 +201,7 @@ STATUS task_schedsetup(FAR _TCB *tcb, int priority,
/* Add the task to the inactive task list */
sched_lock();
- dq_addfirst((FAR dq_entry_t*)tcb, &g_inactivetasks);
+ dq_addfirst((FAR dq_entry_t*)tcb, (dq_queue_t*)&g_inactivetasks);
tcb->task_state = TSTATE_TASK_INACTIVE;
sched_unlock();
}