sched/: Fix some spacing issues
This commit is contained in:
parent
59e5e2f5cc
commit
79d554939e
123 changed files with 381 additions and 374 deletions
2
arch
2
arch
|
@ -1 +1 @@
|
|||
Subproject commit 0b8c98bfac171b330430a02070ecbe8bb9618de3
|
||||
Subproject commit ecb67120352a5acc46c6ea06fe882ddfb597824f
|
2
configs
2
configs
|
@ -1 +1 @@
|
|||
Subproject commit 2386155376e4ebcbcdcb15b3dfb1e6205f33c54a
|
||||
Subproject commit 20921ccad2cf456d6828d5d9f4ec8763a5f31f1f
|
|
@ -85,7 +85,7 @@ static long compare_timespec(FAR const struct timespec *a,
|
|||
if (a->tv_sec > b->tv_sec)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return (long)a->tv_nsec -(long)b->tv_nsec;
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
|
||||
int clearenv(void)
|
||||
{
|
||||
FAR struct tcb_s *tcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
FAR struct tcb_s *tcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
DEBUGASSERT(tcb->group);
|
||||
|
||||
env_release(tcb->group);
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
|
||||
int env_dup(FAR struct task_group_s *group)
|
||||
{
|
||||
FAR struct tcb_s *ptcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
FAR struct tcb_s *ptcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR char *envp = NULL;
|
||||
size_t envlen;
|
||||
int ret = OK;
|
||||
|
|
|
@ -67,7 +67,7 @@ static bool env_cmpname(const char *pszname, const char *peqname)
|
|||
|
||||
/* On sucess, pszname will end with '\0' and peqname with '=' */
|
||||
|
||||
if ( *pszname == '\0' && *peqname == '=' )
|
||||
if (*pszname == '\0' && *peqname == '=')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -94,12 +94,12 @@ FAR char *getenv(const char *name)
|
|||
/* Get a reference to the thread-private environ in the TCB. */
|
||||
|
||||
sched_lock();
|
||||
rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
group = rtcb->group;
|
||||
|
||||
/* Check if the variable exists */
|
||||
|
||||
if ( !group || (pvar = env_findvar(group, name)) == NULL)
|
||||
if (!group || (pvar = env_findvar(group, name)) == NULL)
|
||||
{
|
||||
ret = ENOENT;
|
||||
goto errout_with_lock;
|
||||
|
@ -130,4 +130,3 @@ errout:
|
|||
}
|
||||
|
||||
#endif /* CONFIG_DISABLE_ENVIRON */
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR char **get_environ_ptr( void )
|
||||
FAR char **get_environ_ptr(void)
|
||||
{
|
||||
#if 1
|
||||
|
||||
|
@ -85,7 +85,7 @@ FAR char **get_environ_ptr( void )
|
|||
|
||||
/* Return a reference to the thread-private environ in the TCB. */
|
||||
|
||||
FAR struct tcb_s *ptcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
FAR struct tcb_s *ptcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
if (ptcb->envp)
|
||||
{
|
||||
return &ptcb->envp->ev_env;
|
||||
|
|
|
@ -100,7 +100,7 @@ int putenv(FAR const char *string)
|
|||
goto errout;
|
||||
}
|
||||
|
||||
pequal = strchr( pname, '=');
|
||||
pequal = strchr(pname, '=');
|
||||
if (pequal)
|
||||
{
|
||||
/* Then let setenv do all of the work */
|
||||
|
|
|
@ -124,7 +124,7 @@ int setenv(FAR const char *name, FAR const char *value, int overwrite)
|
|||
/* Get a reference to the thread-private environ in the TCB. */
|
||||
|
||||
sched_lock();
|
||||
rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
group = rtcb->group;
|
||||
DEBUGASSERT(group);
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
|
||||
int unsetenv(FAR const char *name)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct task_group_s *group = rtcb->group;
|
||||
FAR char *pvar;
|
||||
FAR char *newenvp;
|
||||
|
|
|
@ -101,7 +101,7 @@ FAR int *get_errno_ptr(void)
|
|||
* may be NULL.
|
||||
*/
|
||||
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
if (rtcb && rtcb->task_state == TSTATE_TASK_RUNNING)
|
||||
{
|
||||
/* Yes.. the task is running normally. Return a reference to the
|
||||
|
|
|
@ -115,7 +115,7 @@ static void group_assigngid(FAR struct task_group_s *group)
|
|||
|
||||
/* Loop until we create a unique ID */
|
||||
|
||||
for (;;)
|
||||
for (; ; )
|
||||
{
|
||||
/* Increment the ID counter. This is global data so be extra paranoid. */
|
||||
|
||||
|
|
|
@ -83,11 +83,11 @@ int group_foreachchild(FAR struct task_group_s *group,
|
|||
|
||||
for (i = 0; i < group->tg_nmembers; i++)
|
||||
{
|
||||
ret = handler(group->tg_members[i], arg);
|
||||
if (ret != 0)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
ret = handler(group->tg_members[i], arg);
|
||||
if (ret != 0)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -312,7 +312,7 @@ static inline void group_removemember(FAR struct task_group_s *group, pid_t pid)
|
|||
/* Does this member have the matching pid */
|
||||
|
||||
if (group->tg_members[i] == pid)
|
||||
{
|
||||
{
|
||||
/* Remove the member from the array of members. This must be an
|
||||
* atomic operation because the member array may be accessed from
|
||||
* interrupt handlers (read-only).
|
||||
|
|
|
@ -88,9 +88,9 @@ int group_setupstreams(FAR struct task_tcb_s *tcb)
|
|||
* fd = 2 is stderr (write-only, append)
|
||||
*/
|
||||
|
||||
(void)fs_fdopen(0, O_RDONLY, (FAR struct tcb_s *)tcb);
|
||||
(void)fs_fdopen(1, O_WROK|O_CREAT, (FAR struct tcb_s *)tcb);
|
||||
(void)fs_fdopen(2, O_WROK|O_CREAT, (FAR struct tcb_s *)tcb);
|
||||
(void)fs_fdopen(0, O_RDONLY, (FAR struct tcb_s *)tcb);
|
||||
(void)fs_fdopen(1, O_WROK | O_CREAT, (FAR struct tcb_s *)tcb);
|
||||
(void)fs_fdopen(2, O_WROK | O_CREAT, (FAR struct tcb_s *)tcb);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ static inline void sched_dupfiles(FAR struct task_tcb_s *tcb)
|
|||
{
|
||||
/* The parent task is the one at the head of the ready-to-run list */
|
||||
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct file *parent;
|
||||
FAR struct file *child;
|
||||
int i;
|
||||
|
@ -102,7 +102,7 @@ static inline void sched_dupfiles(FAR struct task_tcb_s *tcb)
|
|||
* accordingly above.
|
||||
*/
|
||||
|
||||
/* Get pointers to the parent and child task file lists */
|
||||
/* Get pointers to the parent and child task file lists */
|
||||
|
||||
parent = rtcb->group->tg_filelist.fl_files;
|
||||
child = tcb->cmn.group->tg_filelist.fl_files;
|
||||
|
@ -147,7 +147,7 @@ static inline void sched_dupsockets(FAR struct task_tcb_s *tcb)
|
|||
{
|
||||
/* The parent task is the one at the head of the ready-to-run list */
|
||||
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct socket *parent;
|
||||
FAR struct socket *child;
|
||||
int i;
|
||||
|
|
|
@ -311,7 +311,7 @@ void os_start(void)
|
|||
* that has pid == 0 and sched_priority == 0.
|
||||
*/
|
||||
|
||||
bzero((void*)&g_idletcb, sizeof(struct task_tcb_s));
|
||||
bzero((void *)&g_idletcb, sizeof(struct task_tcb_s));
|
||||
g_idletcb.cmn.task_state = TSTATE_TASK_RUNNING;
|
||||
g_idletcb.cmn.entry.main = (main_t)os_start;
|
||||
g_idletcb.cmn.flags = TCB_FLAG_TTYPE_KERNEL;
|
||||
|
@ -341,7 +341,7 @@ void os_start(void)
|
|||
|
||||
/* Then add the idle task's TCB to the head of the ready to run list */
|
||||
|
||||
dq_addfirst((FAR dq_entry_t*)&g_idletcb, (FAR dq_queue_t*)&g_readytorun);
|
||||
dq_addfirst((FAR dq_entry_t *)&g_idletcb, (FAR dq_queue_t *)&g_readytorun);
|
||||
|
||||
/* Initialize the processor-specific portion of the TCB */
|
||||
|
||||
|
@ -550,7 +550,7 @@ void os_start(void)
|
|||
/* When control is return to this point, the system is idle. */
|
||||
|
||||
sdbg("Beginning Idle Loop\n");
|
||||
for (;;)
|
||||
for (; ; )
|
||||
{
|
||||
/* Perform garbage collection (if it is not being done by the worker
|
||||
* thread). This cleans-up memory de-allocations that were queued
|
||||
|
|
|
@ -105,7 +105,7 @@
|
|||
|
||||
void mq_desclose(mqd_t mqdes)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s*)sched_self();
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)sched_self();
|
||||
FAR struct task_group_s *group = rtcb->group;
|
||||
FAR struct mqueue_inode_s *msgq;
|
||||
|
||||
|
@ -115,7 +115,7 @@ void mq_desclose(mqd_t mqdes)
|
|||
* descriptors.
|
||||
*/
|
||||
|
||||
sq_rem((FAR sq_entry_t*)mqdes, &group->tg_msgdesq);
|
||||
sq_rem((FAR sq_entry_t *)mqdes, &group->tg_msgdesq);
|
||||
|
||||
/* Find the message queue associated with the message descriptor */
|
||||
|
||||
|
@ -135,8 +135,8 @@ void mq_desclose(mqd_t mqdes)
|
|||
}
|
||||
#endif
|
||||
|
||||
/* Deallocate the message descriptor */
|
||||
/* Deallocate the message descriptor */
|
||||
|
||||
mq_desfree(mqdes);
|
||||
mq_desfree(mqdes);
|
||||
}
|
||||
|
||||
|
|
|
@ -166,7 +166,7 @@ mqd_t mq_descreate(FAR struct tcb_s *mtcb, FAR struct mqueue_inode_s *msgq,
|
|||
|
||||
/* And add it to the specified task's TCB */
|
||||
|
||||
sq_addlast((FAR sq_entry_t*)mqdes, &group->tg_msgdesq);
|
||||
sq_addlast((FAR sq_entry_t *)mqdes, &group->tg_msgdesq);
|
||||
}
|
||||
|
||||
return mqdes;
|
||||
|
|
|
@ -130,7 +130,7 @@ mq_msgblockalloc(FAR sq_queue_t *queue, uint16_t nmsgs,
|
|||
* configured number of messages.
|
||||
*/
|
||||
|
||||
mqmsgblock = (FAR struct mqueue_msg_s*)
|
||||
mqmsgblock = (FAR struct mqueue_msg_s *)
|
||||
kmm_malloc(sizeof(struct mqueue_msg_s) * nmsgs);
|
||||
|
||||
if (mqmsgblock)
|
||||
|
@ -141,7 +141,7 @@ mq_msgblockalloc(FAR sq_queue_t *queue, uint16_t nmsgs,
|
|||
for (i = 0; i < nmsgs; i++)
|
||||
{
|
||||
mqmsg->type = alloc_type;
|
||||
sq_addlast((FAR sq_entry_t*)mqmsg++, queue);
|
||||
sq_addlast((FAR sq_entry_t *)mqmsg++, queue);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -225,13 +225,13 @@ void mq_desblockalloc(void)
|
|||
* we ever need to reclaim the memory.
|
||||
*/
|
||||
|
||||
sq_addlast((FAR sq_entry_t*)&mqdesblock->queue, &g_desalloc);
|
||||
sq_addlast((FAR sq_entry_t *)&mqdesblock->queue, &g_desalloc);
|
||||
|
||||
/* Then add each message queue descriptor to the free list */
|
||||
|
||||
for (i = 0; i < NUM_MSG_DESCRIPTORS; i++)
|
||||
{
|
||||
sq_addlast((FAR sq_entry_t*)&mqdesblock->mqdes[i], &g_desfree);
|
||||
sq_addlast((FAR sq_entry_t *)&mqdesblock->mqdes[i], &g_desfree);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ void mq_msgfree(FAR struct mqueue_msg_s *mqmsg)
|
|||
*/
|
||||
|
||||
saved_state = irqsave();
|
||||
sq_addlast((FAR sq_entry_t*)mqmsg, &g_msgfree);
|
||||
sq_addlast((FAR sq_entry_t *)mqmsg, &g_msgfree);
|
||||
irqrestore(saved_state);
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ void mq_msgfree(FAR struct mqueue_msg_s *mqmsg)
|
|||
*/
|
||||
|
||||
saved_state = irqsave();
|
||||
sq_addlast((FAR sq_entry_t*)mqmsg, &g_msgfreeirq);
|
||||
sq_addlast((FAR sq_entry_t *)mqmsg, &g_msgfreeirq);
|
||||
irqrestore(saved_state);
|
||||
}
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ FAR struct mqueue_inode_s *mq_msgqalloc(mode_t mode,
|
|||
|
||||
/* Allocate memory for the new message queue. */
|
||||
|
||||
msgq = (FAR struct mqueue_inode_s*)
|
||||
msgq = (FAR struct mqueue_inode_s *)
|
||||
kmm_zalloc(sizeof(struct mqueue_inode_s));
|
||||
|
||||
if (msgq)
|
||||
|
|
|
@ -92,7 +92,7 @@ void mq_msgqfree(FAR struct mqueue_inode_s *msgq)
|
|||
|
||||
/* Deallocate any stranded messages in the message queue. */
|
||||
|
||||
curr = (FAR struct mqueue_msg_s*)msgq->msglist.head;
|
||||
curr = (FAR struct mqueue_msg_s *)msgq->msglist.head;
|
||||
while (curr)
|
||||
{
|
||||
/* Deallocate the message structure. */
|
||||
|
|
|
@ -149,7 +149,7 @@ int mq_notify(mqd_t mqdes, const struct sigevent *notification)
|
|||
|
||||
/* Get the current process ID */
|
||||
|
||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||
rtcb = (struct tcb_s *)g_readytorun.head;
|
||||
|
||||
/* Is there already a notification attached */
|
||||
|
||||
|
|
|
@ -166,7 +166,7 @@ FAR struct mqueue_msg_s *mq_waitreceive(mqd_t mqdes)
|
|||
|
||||
/* Get the message from the head of the queue */
|
||||
|
||||
while ((rcvmsg = (FAR struct mqueue_msg_s*)sq_remfirst(&msgq->msglist)) == NULL)
|
||||
while ((rcvmsg = (FAR struct mqueue_msg_s *)sq_remfirst(&msgq->msglist)) == NULL)
|
||||
{
|
||||
/* The queue is empty! Should we block until there the above condition
|
||||
* has been satisfied?
|
||||
|
@ -176,7 +176,7 @@ FAR struct mqueue_msg_s *mq_waitreceive(mqd_t mqdes)
|
|||
{
|
||||
/* Yes.. Block and try again */
|
||||
|
||||
rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
rtcb->msgwaitq = msgq;
|
||||
msgq->nwaitnotempty++;
|
||||
|
||||
|
@ -259,7 +259,7 @@ ssize_t mq_doreceive(mqd_t mqdes, FAR struct mqueue_msg_s *mqmsg,
|
|||
|
||||
/* Copy the message into the caller's buffer */
|
||||
|
||||
memcpy(ubuffer, (const void*)mqmsg->mail, rcvmsglen);
|
||||
memcpy(ubuffer, (FAR const void *)mqmsg->mail, rcvmsglen);
|
||||
|
||||
/* Copy the message priority as well (if a buffer is provided) */
|
||||
|
||||
|
@ -284,7 +284,7 @@ ssize_t mq_doreceive(mqd_t mqdes, FAR struct mqueue_msg_s *mqmsg,
|
|||
*/
|
||||
|
||||
saved_state = irqsave();
|
||||
for (btcb = (FAR struct tcb_s*)g_waitingformqnotfull.head;
|
||||
for (btcb = (FAR struct tcb_s *)g_waitingformqnotfull.head;
|
||||
btcb && btcb->msgwaitq != msgq;
|
||||
btcb = btcb->flink);
|
||||
|
||||
|
|
|
@ -174,12 +174,12 @@ FAR struct mqueue_msg_s *mq_msgalloc(void)
|
|||
{
|
||||
/* Try the general free list */
|
||||
|
||||
mqmsg = (FAR struct mqueue_msg_s*)sq_remfirst(&g_msgfree);
|
||||
mqmsg = (FAR struct mqueue_msg_s *)sq_remfirst(&g_msgfree);
|
||||
if (!mqmsg)
|
||||
{
|
||||
/* Try the free list reserved for interrupt handlers */
|
||||
|
||||
mqmsg = (FAR struct mqueue_msg_s*)sq_remfirst(&g_msgfreeirq);
|
||||
mqmsg = (FAR struct mqueue_msg_s *)sq_remfirst(&g_msgfreeirq);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ FAR struct mqueue_msg_s *mq_msgalloc(void)
|
|||
*/
|
||||
|
||||
saved_state = irqsave();
|
||||
mqmsg = (FAR struct mqueue_msg_s*)sq_remfirst(&g_msgfree);
|
||||
mqmsg = (FAR struct mqueue_msg_s *)sq_remfirst(&g_msgfree);
|
||||
irqrestore(saved_state);
|
||||
|
||||
/* If we cannot a message from the free list, then we will have to allocate one. */
|
||||
|
@ -278,7 +278,7 @@ int mq_waitsend(mqd_t mqdes)
|
|||
* When we are unblocked, we will try again
|
||||
*/
|
||||
|
||||
rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
rtcb->msgwaitq = msgq;
|
||||
msgq->nwaitnotfull++;
|
||||
|
||||
|
@ -293,7 +293,7 @@ int mq_waitsend(mqd_t mqdes)
|
|||
|
||||
if (get_errno() != OK)
|
||||
{
|
||||
return ERROR;
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -346,7 +346,7 @@ int mq_dosend(mqd_t mqdes, FAR struct mqueue_msg_s *mqmsg, FAR const char *msg,
|
|||
|
||||
/* Copy the message data into the message */
|
||||
|
||||
memcpy((void*)mqmsg->mail, (FAR const void*)msg, msglen);
|
||||
memcpy((FAR void *)mqmsg->mail, (FAR const void *)msg, msglen);
|
||||
|
||||
/* Insert the new message in the message queue */
|
||||
|
||||
|
@ -356,7 +356,7 @@ int mq_dosend(mqd_t mqdes, FAR struct mqueue_msg_s *mqmsg, FAR const char *msg,
|
|||
* message. Each is list is maintained in ascending priority order.
|
||||
*/
|
||||
|
||||
for (prev = NULL, next = (FAR struct mqueue_msg_s*)msgq->msglist.head;
|
||||
for (prev = NULL, next = (FAR struct mqueue_msg_s *)msgq->msglist.head;
|
||||
next && prio <= next->priority;
|
||||
prev = next, next = next->next);
|
||||
|
||||
|
@ -364,12 +364,12 @@ int mq_dosend(mqd_t mqdes, FAR struct mqueue_msg_s *mqmsg, FAR const char *msg,
|
|||
|
||||
if (prev)
|
||||
{
|
||||
sq_addafter((FAR sq_entry_t*)prev, (FAR sq_entry_t*)mqmsg,
|
||||
sq_addafter((FAR sq_entry_t *)prev, (FAR sq_entry_t *)mqmsg,
|
||||
&msgq->msglist);
|
||||
}
|
||||
else
|
||||
{
|
||||
sq_addfirst((FAR sq_entry_t*)mqmsg, &msgq->msglist);
|
||||
sq_addfirst((FAR sq_entry_t *)mqmsg, &msgq->msglist);
|
||||
}
|
||||
|
||||
/* Increment the count of messages in the queue */
|
||||
|
@ -422,7 +422,7 @@ int mq_dosend(mqd_t mqdes, FAR struct mqueue_msg_s *mqmsg, FAR const char *msg,
|
|||
* interrupts should never cause a change in this list
|
||||
*/
|
||||
|
||||
for (btcb = (FAR struct tcb_s*)g_waitingformqnotempty.head;
|
||||
for (btcb = (FAR struct tcb_s *)g_waitingformqnotempty.head;
|
||||
btcb && btcb->msgwaitq != msgq;
|
||||
btcb = btcb->flink);
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@
|
|||
|
||||
void pg_miss(void)
|
||||
{
|
||||
FAR struct tcb_s *ftcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
FAR struct tcb_s *ftcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *wtcb;
|
||||
|
||||
/* Sanity checking
|
||||
|
|
|
@ -249,7 +249,7 @@ static inline bool pg_dequeue(void)
|
|||
{
|
||||
/* Remove the TCB from the head of the list (if any) */
|
||||
|
||||
g_pftcb = (FAR struct tcb_s *)dq_remfirst((dq_queue_t*)&g_waitingforfill);
|
||||
g_pftcb = (FAR struct tcb_s *)dq_remfirst((dq_queue_t *)&g_waitingforfill);
|
||||
pgllvdbg("g_pftcb: %p\n", g_pftcb);
|
||||
if (g_pftcb != NULL)
|
||||
{
|
||||
|
@ -538,7 +538,7 @@ int pg_worker(int argc, char *argv[])
|
|||
|
||||
pglldbg("Started\n");
|
||||
(void)irqsave();
|
||||
for (;;)
|
||||
for (; ; )
|
||||
{
|
||||
/* Wait awhile. We will wait here until either the configurable timeout
|
||||
* elapses or until we are awakened by a signal (which terminates the
|
||||
|
@ -585,7 +585,7 @@ int pg_worker(int argc, char *argv[])
|
|||
*/
|
||||
|
||||
pglldbg("Restarting TCB: %p\n", g_pftcb);
|
||||
up_unblock_task(g_pftcb);;
|
||||
up_unblock_task(g_pftcb);
|
||||
|
||||
/* Yes .. Start the next asynchronous fill. Check the return
|
||||
* value to see a fill was actually started (false means that
|
||||
|
@ -638,7 +638,7 @@ int pg_worker(int argc, char *argv[])
|
|||
* pending fills have been processed.
|
||||
*/
|
||||
|
||||
for (;;)
|
||||
for (; ; )
|
||||
{
|
||||
/* Yes .. Start the fill and block until the fill completes.
|
||||
* Check the return value to see a fill was actually performed.
|
||||
|
@ -648,9 +648,9 @@ int pg_worker(int argc, char *argv[])
|
|||
pgllvdbg("Calling pg_startfill\n");
|
||||
if (!pg_startfill())
|
||||
{
|
||||
/* Break out of the loop -- there is nothing more to do */
|
||||
/* Break out of the loop -- there is nothing more to do */
|
||||
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Handle the page fill complete event by restarting the
|
||||
|
@ -661,7 +661,7 @@ int pg_worker(int argc, char *argv[])
|
|||
*/
|
||||
|
||||
pgllvdbg("Restarting TCB: %p\n", g_pftcb);
|
||||
up_unblock_task(g_pftcb);;
|
||||
up_unblock_task(g_pftcb);
|
||||
}
|
||||
|
||||
/* All queued fills have been processed */
|
||||
|
|
|
@ -132,7 +132,7 @@ int pthread_cancel(pthread_t thread)
|
|||
* same as pthread_exit(PTHREAD_CANCELED).
|
||||
*/
|
||||
|
||||
if (tcb == (struct tcb_s*)g_readytorun.head)
|
||||
if (tcb == (struct tcb_s *)g_readytorun.head)
|
||||
{
|
||||
pthread_exit(PTHREAD_CANCELED);
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ int pthread_cond_broadcast(FAR pthread_cond_t *cond)
|
|||
|
||||
/* Get the current value of the semaphore */
|
||||
|
||||
if (sem_getvalue((sem_t*)&cond->sem, &sval) != OK)
|
||||
if (sem_getvalue((FAR sem_t *)&cond->sem, &sval) != OK)
|
||||
{
|
||||
ret = EINVAL;
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ int pthread_cond_broadcast(FAR pthread_cond_t *cond)
|
|||
* Only the highest priority waiting thread will get to execute
|
||||
*/
|
||||
|
||||
ret = pthread_givesemaphore((sem_t*)&cond->sem);
|
||||
ret = pthread_givesemaphore((FAR sem_t *)&cond->sem);
|
||||
|
||||
/* Increment the semaphore count (as was done by the
|
||||
* above post).
|
||||
|
|
|
@ -75,9 +75,9 @@ int pthread_cond_destroy(FAR pthread_cond_t *cond)
|
|||
ret = EINVAL;
|
||||
}
|
||||
|
||||
/* Destroy the semaphore contained in the structure */
|
||||
/* Destroy the semaphore contained in the structure */
|
||||
|
||||
else if (sem_destroy((sem_t*)&cond->sem) != OK)
|
||||
else if (sem_destroy((FAR sem_t *)&cond->sem) != OK)
|
||||
{
|
||||
ret = EINVAL;
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ int pthread_cond_init(FAR pthread_cond_t *cond, FAR const pthread_condattr_t *at
|
|||
* with initial count = 0
|
||||
*/
|
||||
|
||||
else if (sem_init((sem_t*)&cond->sem, 0, 0) != OK)
|
||||
else if (sem_init((FAR sem_t *)&cond->sem, 0, 0) != OK)
|
||||
{
|
||||
ret = EINVAL;
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ int pthread_cond_signal(FAR pthread_cond_t *cond)
|
|||
{
|
||||
/* Get the current value of the semaphore */
|
||||
|
||||
if (sem_getvalue((sem_t*)&cond->sem, &sval) != OK)
|
||||
if (sem_getvalue((FAR sem_t *)&cond->sem, &sval) != OK)
|
||||
{
|
||||
ret = EINVAL;
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ int pthread_cond_signal(FAR pthread_cond_t *cond)
|
|||
if (sval < 0)
|
||||
{
|
||||
sdbg("Signalling...\n");
|
||||
ret = pthread_givesemaphore((sem_t*)&cond->sem);
|
||||
ret = pthread_givesemaphore((FAR sem_t *)&cond->sem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -272,7 +272,7 @@ int pthread_cond_timedwait(FAR pthread_cond_t *cond, FAR pthread_mutex_t *mutex,
|
|||
/* Give up the mutex */
|
||||
|
||||
mutex->pid = -1;
|
||||
ret = pthread_givesemaphore((sem_t*)&mutex->sem);
|
||||
ret = pthread_givesemaphore((FAR sem_t *)&mutex->sem);
|
||||
if (ret)
|
||||
{
|
||||
/* Restore interrupts (pre-emption will be enabled when
|
||||
|
@ -294,7 +294,7 @@ int pthread_cond_timedwait(FAR pthread_cond_t *cond, FAR pthread_mutex_t *mutex,
|
|||
* are started atomically.
|
||||
*/
|
||||
|
||||
status = sem_wait((sem_t*)&cond->sem);
|
||||
status = sem_wait((FAR sem_t *)&cond->sem);
|
||||
|
||||
/* Did we get the condition semaphore. */
|
||||
|
||||
|
@ -328,7 +328,7 @@ int pthread_cond_timedwait(FAR pthread_cond_t *cond, FAR pthread_mutex_t *mutex,
|
|||
/* Reacquire the mutex (retaining the ret). */
|
||||
|
||||
sdbg("Re-locking...\n");
|
||||
status = pthread_takesemaphore((sem_t*)&mutex->sem);
|
||||
status = pthread_takesemaphore((FAR sem_t *)&mutex->sem);
|
||||
if (!status)
|
||||
{
|
||||
mutex->pid = mypid;
|
||||
|
|
|
@ -114,17 +114,17 @@ int pthread_cond_wait(FAR pthread_cond_t *cond, FAR pthread_mutex_t *mutex)
|
|||
|
||||
sched_lock();
|
||||
mutex->pid = -1;
|
||||
ret = pthread_givesemaphore((sem_t*)&mutex->sem);
|
||||
ret = pthread_givesemaphore((FAR sem_t *)&mutex->sem);
|
||||
|
||||
/* Take the semaphore */
|
||||
|
||||
ret |= pthread_takesemaphore((sem_t*)&cond->sem);
|
||||
ret |= pthread_takesemaphore((FAR sem_t *)&cond->sem);
|
||||
sched_unlock();
|
||||
|
||||
/* Reacquire the mutex */
|
||||
|
||||
sdbg("Reacquire mutex...\n");
|
||||
ret |= pthread_takesemaphore((sem_t*)&mutex->sem);
|
||||
ret |= pthread_takesemaphore((FAR sem_t *)&mutex->sem);
|
||||
if (!ret)
|
||||
{
|
||||
mutex->pid = getpid();
|
||||
|
|
|
@ -165,9 +165,9 @@ static inline void pthread_addjoininfo(FAR struct task_group_s *group,
|
|||
|
||||
static void pthread_start(void)
|
||||
{
|
||||
FAR struct pthread_tcb_s *ptcb = (FAR struct pthread_tcb_s*)g_readytorun.head;
|
||||
FAR struct pthread_tcb_s *ptcb = (FAR struct pthread_tcb_s *)g_readytorun.head;
|
||||
FAR struct task_group_s *group = ptcb->cmn.group;
|
||||
FAR struct join_s *pjoin = (FAR struct join_s*)ptcb->joininfo;
|
||||
FAR struct join_s *pjoin = (FAR struct join_s *)ptcb->joininfo;
|
||||
pthread_addr_t exit_status;
|
||||
|
||||
DEBUGASSERT(group && pjoin);
|
||||
|
@ -280,7 +280,7 @@ int pthread_create(FAR pthread_t *thread, FAR const pthread_attr_t *attr,
|
|||
|
||||
/* Allocate a detachable structure to support pthread_join logic */
|
||||
|
||||
pjoin = (FAR struct join_s*)kmm_zalloc(sizeof(struct join_s));
|
||||
pjoin = (FAR struct join_s *)kmm_zalloc(sizeof(struct join_s));
|
||||
if (!pjoin)
|
||||
{
|
||||
sdbg("ERROR: Failed to allocate join\n");
|
||||
|
@ -509,7 +509,7 @@ int pthread_create(FAR pthread_t *thread, FAR const pthread_attr_t *attr,
|
|||
else
|
||||
{
|
||||
sched_unlock();
|
||||
dq_rem((FAR dq_entry_t*)ptcb, (dq_queue_t*)&g_inactivetasks);
|
||||
dq_rem((FAR dq_entry_t *)ptcb, (FAR dq_queue_t *)&g_inactivetasks);
|
||||
(void)sem_destroy(&pjoin->data_sem);
|
||||
(void)sem_destroy(&pjoin->exit_sem);
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@
|
|||
|
||||
void pthread_exit(FAR void *exit_value)
|
||||
{
|
||||
struct tcb_s *tcb = (struct tcb_s*)g_readytorun.head;
|
||||
struct tcb_s *tcb = (struct tcb_s *)g_readytorun.head;
|
||||
int status;
|
||||
|
||||
sdbg("exit_value=%p\n", exit_value);
|
||||
|
|
|
@ -104,7 +104,7 @@
|
|||
FAR void *pthread_getspecific(pthread_key_t key)
|
||||
{
|
||||
#if CONFIG_NPTHREAD_KEYS > 0
|
||||
FAR struct pthread_tcb_s *rtcb = (FAR struct pthread_tcb_s*)g_readytorun.head;
|
||||
FAR struct pthread_tcb_s *rtcb = (FAR struct pthread_tcb_s *)g_readytorun.head;
|
||||
FAR struct task_group_s *group = rtcb->cmn.group;
|
||||
FAR void *ret = NULL;
|
||||
|
||||
|
|
|
@ -108,10 +108,11 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
int pthread_key_create(FAR pthread_key_t *key, CODE void (*destructor)(void*))
|
||||
int pthread_key_create(FAR pthread_key_t *key,
|
||||
CODE void (*destructor)(FAR void *))
|
||||
{
|
||||
#if CONFIG_NPTHREAD_KEYS > 0
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct task_group_s *group = rtcb->group;
|
||||
int ret = EAGAIN;
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ int pthread_mutex_destroy(FAR pthread_mutex_t *mutex)
|
|||
{
|
||||
/* Destroy the semaphore */
|
||||
|
||||
status = sem_destroy((sem_t*)&mutex->sem);
|
||||
status = sem_destroy((FAR sem_t *)&mutex->sem);
|
||||
if (status != OK)
|
||||
{
|
||||
ret = EINVAL;
|
||||
|
|
|
@ -119,7 +119,7 @@ int pthread_mutex_init(FAR pthread_mutex_t *mutex, FAR const pthread_mutexattr_t
|
|||
|
||||
/* Initialize the mutex like a semaphore with initial count = 1 */
|
||||
|
||||
status = sem_init((sem_t*)&mutex->sem, pshared, 1);
|
||||
status = sem_init((FAR sem_t *)&mutex->sem, pshared, 1);
|
||||
if (status != OK)
|
||||
{
|
||||
ret = EINVAL;
|
||||
|
|
|
@ -168,7 +168,7 @@ int pthread_mutex_lock(FAR pthread_mutex_t *mutex)
|
|||
{
|
||||
/* Take the semaphore */
|
||||
|
||||
ret = pthread_takesemaphore((sem_t*)&mutex->sem);
|
||||
ret = pthread_takesemaphore((FAR sem_t *)&mutex->sem);
|
||||
|
||||
/* If we succussfully obtained the semaphore, then indicate
|
||||
* that we own it.
|
||||
|
|
|
@ -123,7 +123,7 @@ int pthread_mutex_trylock(FAR pthread_mutex_t *mutex)
|
|||
|
||||
/* Try to get the semaphore. */
|
||||
|
||||
if (sem_trywait((sem_t*)&mutex->sem) == OK)
|
||||
if (sem_trywait((FAR sem_t *)&mutex->sem) == OK)
|
||||
{
|
||||
/* If we successfully obtained the semaphore, then indicate
|
||||
* that we own it.
|
||||
|
|
|
@ -152,7 +152,7 @@ int pthread_mutex_unlock(FAR pthread_mutex_t *mutex)
|
|||
#ifdef CONFIG_MUTEX_TYPES
|
||||
mutex->nlocks = 0;
|
||||
#endif
|
||||
ret = pthread_givesemaphore((sem_t*)&mutex->sem);
|
||||
ret = pthread_givesemaphore((FAR sem_t *)&mutex->sem);
|
||||
}
|
||||
sched_unlock();
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
|
||||
int pthread_setcancelstate(int state, FAR int *oldstate)
|
||||
{
|
||||
struct tcb_s *tcb = (struct tcb_s*)g_readytorun.head;
|
||||
struct tcb_s *tcb = (struct tcb_s *)g_readytorun.head;
|
||||
int ret = OK;
|
||||
|
||||
/* Suppress context changes for a bit so that the flags are stable. (the
|
||||
|
@ -106,7 +106,7 @@ int pthread_setcancelstate(int state, FAR int *oldstate)
|
|||
|
||||
/* Clear the non-cancelable and cancel pending flags */
|
||||
|
||||
tcb->flags &= ~(TCB_FLAG_NONCANCELABLE|TCB_FLAG_CANCEL_PENDING);
|
||||
tcb->flags &= ~(TCB_FLAG_NONCANCELABLE | TCB_FLAG_CANCEL_PENDING);
|
||||
|
||||
/* If the cancel was pending, then just exit as requested */
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@
|
|||
int pthread_setspecific(pthread_key_t key, FAR const void *value)
|
||||
{
|
||||
#if CONFIG_NPTHREAD_KEYS > 0
|
||||
FAR struct pthread_tcb_s *rtcb = (FAR struct pthread_tcb_s*)g_readytorun.head;
|
||||
FAR struct pthread_tcb_s *rtcb = (FAR struct pthread_tcb_s *)g_readytorun.head;
|
||||
FAR struct task_group_s *group = rtcb->cmn.group;
|
||||
int ret = EINVAL;
|
||||
|
||||
|
@ -128,7 +128,7 @@ int pthread_setspecific(pthread_key_t key, FAR const void *value)
|
|||
{
|
||||
/* Store the data in the TCB. */
|
||||
|
||||
rtcb->pthread_data[key] = (FAR void*)value;
|
||||
rtcb->pthread_data[key] = (FAR void *)value;
|
||||
|
||||
/* Return success. */
|
||||
|
||||
|
|
|
@ -105,14 +105,14 @@ void sched_addblocked(FAR struct tcb_s *btcb, tstate_t task_state)
|
|||
/* Add the task to a prioritized list */
|
||||
|
||||
sched_addprioritized(btcb,
|
||||
(FAR dq_queue_t*)g_tasklisttable[task_state].list);
|
||||
(FAR dq_queue_t *)g_tasklisttable[task_state].list);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Add the task to a non-prioritized list */
|
||||
|
||||
dq_addlast((FAR dq_entry_t*)btcb,
|
||||
(FAR dq_queue_t*)g_tasklisttable[task_state].list);
|
||||
dq_addlast((FAR dq_entry_t *)btcb,
|
||||
(FAR dq_queue_t *)g_tasklisttable[task_state].list);
|
||||
}
|
||||
|
||||
/* Make sure the TCB's state corresponds to the list */
|
||||
|
|
|
@ -110,7 +110,7 @@ bool sched_addprioritized(FAR struct tcb_s *tcb, DSEG dq_queue_t *list)
|
|||
* Each is list is maintained in ascending sched_priority order.
|
||||
*/
|
||||
|
||||
for (next = (FAR struct tcb_s*)list->head;
|
||||
for (next = (FAR struct tcb_s *)list->head;
|
||||
(next && sched_priority <= next->sched_priority);
|
||||
next = next->flink);
|
||||
|
||||
|
@ -123,15 +123,15 @@ bool sched_addprioritized(FAR struct tcb_s *tcb, DSEG dq_queue_t *list)
|
|||
{
|
||||
/* The tcb goes at the end of the list. */
|
||||
|
||||
prev = (FAR struct tcb_s*)list->tail;
|
||||
prev = (FAR struct tcb_s *)list->tail;
|
||||
if (!prev)
|
||||
{
|
||||
/* Special case: The list is empty */
|
||||
|
||||
tcb->flink = NULL;
|
||||
tcb->blink = NULL;
|
||||
list->head = (FAR dq_entry_t*)tcb;
|
||||
list->tail = (FAR dq_entry_t*)tcb;
|
||||
list->head = (FAR dq_entry_t *)tcb;
|
||||
list->tail = (FAR dq_entry_t *)tcb;
|
||||
ret = true;
|
||||
}
|
||||
else
|
||||
|
@ -141,14 +141,14 @@ bool sched_addprioritized(FAR struct tcb_s *tcb, DSEG dq_queue_t *list)
|
|||
tcb->flink = NULL;
|
||||
tcb->blink = prev;
|
||||
prev->flink = tcb;
|
||||
list->tail = (FAR dq_entry_t*)tcb;
|
||||
list->tail = (FAR dq_entry_t *)tcb;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The tcb goes just before next */
|
||||
|
||||
prev = (FAR struct tcb_s*)next->blink;
|
||||
prev = (FAR struct tcb_s *)next->blink;
|
||||
if (!prev)
|
||||
{
|
||||
/* Special case: Insert at the head of the list */
|
||||
|
@ -156,7 +156,7 @@ bool sched_addprioritized(FAR struct tcb_s *tcb, DSEG dq_queue_t *list)
|
|||
tcb->flink = next;
|
||||
tcb->blink = NULL;
|
||||
next->blink = tcb;
|
||||
list->head = (FAR dq_entry_t*)tcb;
|
||||
list->head = (FAR dq_entry_t *)tcb;
|
||||
ret = true;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -100,7 +100,7 @@
|
|||
|
||||
bool sched_addreadytorun(FAR struct tcb_s *btcb)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
bool ret;
|
||||
|
||||
/* Check if pre-emption is disabled for the current running task and if
|
||||
|
@ -114,14 +114,14 @@ bool sched_addreadytorun(FAR struct tcb_s *btcb)
|
|||
* g_pendingtasks task list for now.
|
||||
*/
|
||||
|
||||
sched_addprioritized(btcb, (FAR dq_queue_t*)&g_pendingtasks);
|
||||
sched_addprioritized(btcb, (FAR dq_queue_t *)&g_pendingtasks);
|
||||
btcb->task_state = TSTATE_TASK_PENDING;
|
||||
ret = false;
|
||||
}
|
||||
|
||||
/* Otherwise, add the new task to the ready-to-run task list */
|
||||
|
||||
else if (sched_addprioritized(btcb, (FAR dq_queue_t*)&g_readytorun))
|
||||
else if (sched_addprioritized(btcb, (FAR dq_queue_t *)&g_readytorun))
|
||||
{
|
||||
/* Inform the instrumentation logic that we are switching tasks */
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ volatile uint32_t g_cpuload_total;
|
|||
|
||||
void weak_function sched_process_cpuload(void)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
int hash_index;
|
||||
int i;
|
||||
|
||||
|
|
|
@ -72,10 +72,10 @@ void sched_foreach(sched_foreach_t handler, FAR void *arg)
|
|||
|
||||
for (ndx = 0; ndx < CONFIG_MAX_TASKS; ndx++)
|
||||
{
|
||||
if (g_pidhash[ndx].tcb)
|
||||
{
|
||||
handler(g_pidhash[ndx].tcb, arg);
|
||||
}
|
||||
if (g_pidhash[ndx].tcb)
|
||||
{
|
||||
handler(g_pidhash[ndx].tcb, arg);
|
||||
}
|
||||
}
|
||||
|
||||
irqrestore(flags);
|
||||
|
|
|
@ -127,7 +127,8 @@ void sched_ufree(FAR void *address)
|
|||
|
||||
/* Delay the deallocation until a more appropriate time. */
|
||||
|
||||
sq_addlast((FAR sq_entry_t*)address, (sq_queue_t*)&g_delayed_kufree);
|
||||
sq_addlast((FAR sq_entry_t *)address,
|
||||
(FAR sq_queue_t *)&g_delayed_kufree);
|
||||
|
||||
/* Signal the worker thread that is has some clean up to do */
|
||||
|
||||
|
@ -167,7 +168,8 @@ void sched_kfree(FAR void *address)
|
|||
|
||||
/* Delay the deallocation until a more appropriate time. */
|
||||
|
||||
sq_addlast((FAR sq_entry_t*)address, (sq_queue_t*)&g_delayed_kfree);
|
||||
sq_addlast((FAR sq_entry_t *)address,
|
||||
(FAR sq_queue_t *)&g_delayed_kfree);
|
||||
|
||||
/* Signal the worker thread that is has some clean up to do */
|
||||
|
||||
|
|
|
@ -91,18 +91,18 @@ static inline void sched_kucleanup(void)
|
|||
irqstate_t flags;
|
||||
FAR void *address;
|
||||
|
||||
/* Test if the delayed deallocation queue is empty. No special protection
|
||||
* is needed because this is an atomic test.
|
||||
*/
|
||||
/* Test if the delayed deallocation queue is empty. No special protection
|
||||
* is needed because this is an atomic test.
|
||||
*/
|
||||
|
||||
while (g_delayed_kufree.head)
|
||||
while (g_delayed_kufree.head)
|
||||
{
|
||||
/* Remove the first delayed deallocation. This is not atomic and so
|
||||
* we must disable interrupts around the queue operation.
|
||||
*/
|
||||
|
||||
flags = irqsave();
|
||||
address = (FAR void*)sq_remfirst((FAR sq_queue_t*)&g_delayed_kufree);
|
||||
address = (FAR void *)sq_remfirst((FAR sq_queue_t *)&g_delayed_kufree);
|
||||
irqrestore(flags);
|
||||
|
||||
/* The address should always be non-NULL since that was checked in the
|
||||
|
@ -137,21 +137,21 @@ static inline void sched_kucleanup(void)
|
|||
defined(CONFIG_MM_KERNEL_HEAP)
|
||||
static inline void sched_kcleanup(void)
|
||||
{
|
||||
irqstate_t flags;
|
||||
FAR void *address;
|
||||
irqstate_t flags;
|
||||
FAR void *address;
|
||||
|
||||
/* Test if the delayed deallocation queue is empty. No special protection
|
||||
* is needed because this is an atomic test.
|
||||
*/
|
||||
/* Test if the delayed deallocation queue is empty. No special protection
|
||||
* is needed because this is an atomic test.
|
||||
*/
|
||||
|
||||
while (g_delayed_kfree.head)
|
||||
while (g_delayed_kfree.head)
|
||||
{
|
||||
/* Remove the first delayed deallocation. This is not atomic and so
|
||||
* we must disable interrupts around the queue operation.
|
||||
*/
|
||||
|
||||
flags = irqsave();
|
||||
address = (FAR void*)sq_remfirst((FAR sq_queue_t*)&g_delayed_kfree);
|
||||
address = (FAR void *)sq_remfirst((FAR sq_queue_t *)&g_delayed_kfree);
|
||||
irqrestore(flags);
|
||||
|
||||
/* The address should always be non-NULL since that was checked in the
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
|
||||
FAR struct filelist *sched_getfiles(void)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct task_group_s *group = rtcb->group;
|
||||
|
||||
/* The group may be NULL under certain conditions. For example, if
|
||||
|
|
|
@ -110,12 +110,12 @@ int sched_getparam (pid_t pid, FAR struct sched_param *param)
|
|||
|
||||
/* Check if the task to restart is the calling task */
|
||||
|
||||
rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
if ((pid == 0) || (pid == rtcb->pid))
|
||||
{
|
||||
/* Return the priority if the calling task. */
|
||||
/* Return the priority if the calling task. */
|
||||
|
||||
param->sched_priority = (int)rtcb->sched_priority;
|
||||
param->sched_priority = (int)rtcb->sched_priority;
|
||||
}
|
||||
|
||||
/* Ths pid is not for the calling task, we will have to look it up */
|
||||
|
|
|
@ -107,7 +107,7 @@ int sched_getscheduler(pid_t pid)
|
|||
|
||||
if (!pid)
|
||||
{
|
||||
tcb = (struct tcb_s*)g_readytorun.head;
|
||||
tcb = (struct tcb_s *)g_readytorun.head;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
|
||||
FAR struct socketlist *sched_getsockets(void)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct task_group_s *group = rtcb->group;
|
||||
|
||||
DEBUGASSERT(group);
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
|
||||
FAR struct streamlist *sched_getstreams(void)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct task_group_s *group = rtcb->group;
|
||||
|
||||
DEBUGASSERT(group);
|
||||
|
|
|
@ -84,7 +84,7 @@ FAR struct tcb_s *sched_gettcb(pid_t pid)
|
|||
|
||||
/* Verify that the PID is within range */
|
||||
|
||||
if (pid >= 0 )
|
||||
if (pid >= 0)
|
||||
{
|
||||
/* Get the hash_ndx associated with the pid */
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@
|
|||
|
||||
int sched_lock(void)
|
||||
{
|
||||
struct tcb_s *rtcb = (struct tcb_s*)g_readytorun.head;
|
||||
struct tcb_s *rtcb = (struct tcb_s *)g_readytorun.head;
|
||||
|
||||
/* Check for some special cases: (1) rtcb may be NULL only during
|
||||
* early boot-up phases, and (2) sched_lock() should have no
|
||||
|
|
|
@ -91,7 +91,7 @@
|
|||
|
||||
int sched_lockcount(void)
|
||||
{
|
||||
struct tcb_s *rtcb = (struct tcb_s*)g_readytorun.head;
|
||||
struct tcb_s *rtcb = (struct tcb_s *)g_readytorun.head;
|
||||
return (int)rtcb->lockcount;
|
||||
}
|
||||
|
||||
|
|
|
@ -102,11 +102,11 @@ bool sched_mergepending(void)
|
|||
|
||||
/* Initialize the inner search loop */
|
||||
|
||||
rtrtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
rtrtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
|
||||
/* Process every TCB in the g_pendingtasks list */
|
||||
|
||||
for (pndtcb = (FAR struct tcb_s*)g_pendingtasks.head; pndtcb; pndtcb = pndnext)
|
||||
for (pndtcb = (FAR struct tcb_s *)g_pendingtasks.head; pndtcb; pndtcb = pndnext)
|
||||
{
|
||||
pndnext = pndtcb->flink;
|
||||
|
||||
|
@ -142,7 +142,7 @@ bool sched_mergepending(void)
|
|||
pndtcb->flink = rtrtcb;
|
||||
pndtcb->blink = NULL;
|
||||
rtrtcb->blink = pndtcb;
|
||||
g_readytorun.head = (FAR dq_entry_t*)pndtcb;
|
||||
g_readytorun.head = (FAR dq_entry_t *)pndtcb;
|
||||
rtrtcb->task_state = TSTATE_TASK_READYTORUN;
|
||||
pndtcb->task_state = TSTATE_TASK_RUNNING;
|
||||
ret = true;
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
#if CONFIG_RR_INTERVAL > 0 || defined(CONFIG_SCHED_SPORADIC)
|
||||
static inline void sched_process_scheduler(void)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
|
||||
#if CONFIG_RR_INTERVAL > 0
|
||||
/* Check if the currently executing task uses round robin scheduling. */
|
||||
|
|
|
@ -124,7 +124,7 @@ int sched_releasetcb(FAR struct tcb_s *tcb, uint8_t ttype)
|
|||
*/
|
||||
|
||||
#ifdef CONFIG_HAVE_WEAKFUNCTIONS
|
||||
if (timer_deleteall != NULL)
|
||||
if (timer_deleteall != NULL)
|
||||
#endif
|
||||
{
|
||||
timer_deleteall(tcb->pid);
|
||||
|
|
|
@ -100,7 +100,8 @@ void sched_removeblocked(FAR struct tcb_s *btcb)
|
|||
* with this state
|
||||
*/
|
||||
|
||||
dq_rem((FAR dq_entry_t*)btcb, (dq_queue_t*)g_tasklisttable[task_state].list);
|
||||
dq_rem((FAR dq_entry_t *)btcb,
|
||||
(FAR dq_queue_t *)g_tasklisttable[task_state].list);
|
||||
|
||||
/* Make sure the TCB's state corresponds to not being in
|
||||
* any list
|
||||
|
|
|
@ -112,16 +112,16 @@ int sched_reprioritize(FAR struct tcb_s *tcb, int sched_priority)
|
|||
int ret = sched_setpriority(tcb, sched_priority);
|
||||
if (ret == 0)
|
||||
{
|
||||
/* Reset the base_priority -- the priority that the thread would return
|
||||
* to once it posts the semaphore.
|
||||
*/
|
||||
/* Reset the base_priority -- the priority that the thread would return
|
||||
* to once it posts the semaphore.
|
||||
*/
|
||||
|
||||
tcb->base_priority = (uint8_t)sched_priority;
|
||||
tcb->base_priority = (uint8_t)sched_priority;
|
||||
|
||||
/* Discard any pending reprioritizations as well */
|
||||
/* Discard any pending reprioritizations as well */
|
||||
|
||||
#if CONFIG_SEM_NNESTPRIO > 0
|
||||
tcb->npend_reprio = 0;
|
||||
tcb->npend_reprio = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ int sched_rr_get_interval(pid_t pid, struct timespec *interval)
|
|||
|
||||
if (!pid)
|
||||
{
|
||||
rrtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
rrtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
}
|
||||
|
||||
/* Return a special error code on invalid PID */
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
|
||||
FAR struct tcb_s *sched_self(void)
|
||||
{
|
||||
return (FAR struct tcb_s*)g_readytorun.head;
|
||||
return (FAR struct tcb_s *)g_readytorun.head;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ int sched_setparam(pid_t pid, FAR const struct sched_param *param)
|
|||
|
||||
/* Check if the task to reprioritize is the calling task */
|
||||
|
||||
rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
if (pid == 0 || pid == rtcb->pid)
|
||||
{
|
||||
tcb = rtcb;
|
||||
|
|
|
@ -103,7 +103,7 @@
|
|||
|
||||
int sched_setpriority(FAR struct tcb_s *tcb, int sched_priority)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
tstate_t task_state;
|
||||
irqstate_t saved_state;
|
||||
|
||||
|
@ -204,7 +204,8 @@ int sched_setpriority(FAR struct tcb_s *tcb, int sched_priority)
|
|||
{
|
||||
/* Remove the TCB from the prioritized task list */
|
||||
|
||||
dq_rem((FAR dq_entry_t*)tcb, (FAR dq_queue_t*)g_tasklisttable[task_state].list);
|
||||
dq_rem((FAR dq_entry_t *)tcb,
|
||||
(FAR dq_queue_t *)g_tasklisttable[task_state].list);
|
||||
|
||||
/* Change the task priority */
|
||||
|
||||
|
@ -214,7 +215,8 @@ int sched_setpriority(FAR struct tcb_s *tcb, int sched_priority)
|
|||
* position
|
||||
*/
|
||||
|
||||
sched_addprioritized(tcb, (FAR dq_queue_t*)g_tasklisttable[task_state].list);
|
||||
sched_addprioritized(tcb,
|
||||
(FAR dq_queue_t *)g_tasklisttable[task_state].list);
|
||||
}
|
||||
|
||||
/* CASE 3b. The task resides in a non-prioritized list. */
|
||||
|
|
|
@ -109,7 +109,7 @@ int sched_setscheduler(pid_t pid, int policy,
|
|||
|
||||
/* Check if the task to modify the calling task */
|
||||
|
||||
if (pid == 0 )
|
||||
if (pid == 0)
|
||||
{
|
||||
pid = getpid();
|
||||
}
|
||||
|
|
|
@ -768,16 +768,16 @@ int sched_sporadic_initialize(FAR struct tcb_s *tcb)
|
|||
* sporadic scheduling parameters and state data.
|
||||
*/
|
||||
|
||||
sporadic = (FAR struct sporadic_s *)kmm_zalloc(sizeof(struct sporadic_s));
|
||||
if (sporadic == NULL)
|
||||
{
|
||||
slldbg("ERROR: Failed to allocate sporadic data structure\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
sporadic = (FAR struct sporadic_s *)kmm_zalloc(sizeof(struct sporadic_s));
|
||||
if (sporadic == NULL)
|
||||
{
|
||||
slldbg("ERROR: Failed to allocate sporadic data structure\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/* The initialize required is to set the back pointer to the TCB in
|
||||
* each of the replenishment structures.
|
||||
*/
|
||||
/* The initialize required is to set the back pointer to the TCB in
|
||||
* each of the replenishment structures.
|
||||
*/
|
||||
|
||||
for (i = 0; i < CONFIG_SCHED_SPORADIC_MAXREPL; i++)
|
||||
{
|
||||
|
@ -1145,7 +1145,7 @@ int sched_sporadic_suspend(FAR struct tcb_s *tcb)
|
|||
*
|
||||
* Input Parameters:
|
||||
* tcb - The TCB of the thread that is beginning sporadic
|
||||
scheduling.
|
||||
* scheduling.
|
||||
* ticks - The number of elapsed ticks since the last time this
|
||||
* function was called.
|
||||
* noswitches - We are running in a context where context switching is
|
||||
|
|
|
@ -164,8 +164,8 @@ static struct timespec g_stop_time;
|
|||
#if CONFIG_RR_INTERVAL > 0 || defined(CONFIG_SCHED_SPORADIC)
|
||||
static inline uint32_t sched_process_scheduler(uint32_t ticks, bool noswitches)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
FAR struct tcb_s *ntcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct tcb_s *ntcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
uint32_t ret = 0;
|
||||
|
||||
#if CONFIG_RR_INTERVAL > 0
|
||||
|
@ -212,15 +212,15 @@ static inline uint32_t sched_process_scheduler(uint32_t ticks, bool noswitches)
|
|||
* the new task at the head of the ready to run list.
|
||||
*/
|
||||
|
||||
ntcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
ntcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
|
||||
/* Check if the new task at the head of the ready-to-run has changed. */
|
||||
|
||||
if (rtcb != ntcb)
|
||||
{
|
||||
/* Recurse just to get the correct return value */
|
||||
/* Recurse just to get the correct return value */
|
||||
|
||||
return sched_process_scheduler(0, true);
|
||||
return sched_process_scheduler(0, true);
|
||||
}
|
||||
|
||||
/* Returning zero means that there is no interesting event to be timed */
|
||||
|
@ -355,9 +355,9 @@ static void sched_timer_start(unsigned int ticks)
|
|||
ret = up_alarm_start(&ts);
|
||||
|
||||
#else
|
||||
/* [Re-]start the interval timer */
|
||||
/* [Re-]start the interval timer */
|
||||
|
||||
ret = up_timer_start(&ts);
|
||||
ret = up_timer_start(&ts);
|
||||
#endif
|
||||
|
||||
if (ret < 0)
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
|
||||
int sched_unlock(void)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
|
||||
/* Check for some special cases: (1) rtcb may be NULL only during
|
||||
* early boot-up phases, and (2) sched_unlock() should have no
|
||||
|
@ -118,7 +118,7 @@ int sched_unlock(void)
|
|||
* maximum.
|
||||
*/
|
||||
|
||||
if (rtcb != (FAR struct tcb_s*)g_readytorun.head)
|
||||
if (rtcb != (FAR struct tcb_s *)g_readytorun.head)
|
||||
{
|
||||
rtcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL);
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ int sched_unlock(void)
|
|||
* change the currently active task.
|
||||
*/
|
||||
|
||||
if (rtcb == (FAR struct tcb_s*)g_readytorun.head)
|
||||
if (rtcb == (FAR struct tcb_s *)g_readytorun.head)
|
||||
{
|
||||
sched_timer_reassess();
|
||||
}
|
||||
|
|
|
@ -225,9 +225,9 @@ int waitid(idtype_t idtype, id_t id, FAR siginfo_t *info, int options)
|
|||
|
||||
/* Does this task retain child status? */
|
||||
|
||||
if (retains)
|
||||
if (retains)
|
||||
{
|
||||
/* Check if this specific pid has allocated child status? */
|
||||
/* Check if this specific pid has allocated child status? */
|
||||
|
||||
if (group_findchild(rtcb->group, (pid_t)id) == NULL)
|
||||
{
|
||||
|
@ -248,7 +248,7 @@ int waitid(idtype_t idtype, id_t id, FAR siginfo_t *info, int options)
|
|||
}
|
||||
else if (idtype == P_PID)
|
||||
{
|
||||
/* Get the TCB corresponding to this PID and make sure it is our child. */
|
||||
/* Get the TCB corresponding to this PID and make sure it is our child. */
|
||||
|
||||
ctcb = sched_gettcb((pid_t)id);
|
||||
#ifdef HAVE_GROUP_MEMBERS
|
||||
|
@ -265,7 +265,7 @@ int waitid(idtype_t idtype, id_t id, FAR siginfo_t *info, int options)
|
|||
|
||||
/* Loop until the child that we are waiting for dies */
|
||||
|
||||
for (;;)
|
||||
for (; ; )
|
||||
{
|
||||
#ifdef CONFIG_SCHED_CHILD_STATUS
|
||||
/* Check if the task has already died. Signals are not queued in
|
||||
|
|
|
@ -353,11 +353,11 @@ pid_t waitpid(pid_t pid, int *stat_loc, int options)
|
|||
|
||||
/* Does this task retain child status? */
|
||||
|
||||
if (retains)
|
||||
if (retains)
|
||||
{
|
||||
/* Check if this specific pid has allocated child status? */
|
||||
/* Check if this specific pid has allocated child status? */
|
||||
|
||||
if (group_findchild(rtcb->group, pid) == NULL)
|
||||
if (group_findchild(rtcb->group, pid) == NULL)
|
||||
{
|
||||
err = ECHILD;
|
||||
goto errout_with_errno;
|
||||
|
@ -376,7 +376,7 @@ pid_t waitpid(pid_t pid, int *stat_loc, int options)
|
|||
}
|
||||
else if (pid != (pid_t)-1)
|
||||
{
|
||||
/* Get the TCB corresponding to this PID and make sure it is our child. */
|
||||
/* Get the TCB corresponding to this PID and make sure it is our child. */
|
||||
|
||||
ctcb = sched_gettcb(pid);
|
||||
#ifdef HAVE_GROUP_MEMBERS
|
||||
|
@ -394,7 +394,7 @@ pid_t waitpid(pid_t pid, int *stat_loc, int options)
|
|||
|
||||
/* Loop until the child that we are waiting for dies */
|
||||
|
||||
for (;;)
|
||||
for (; ; )
|
||||
{
|
||||
#ifdef CONFIG_SCHED_CHILD_STATUS
|
||||
/* Check if the task has already died. Signals are not queued in
|
||||
|
|
|
@ -90,7 +90,7 @@
|
|||
|
||||
int sched_yield(void)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
|
||||
/* This equivalent to just resetting the task priority to its current value
|
||||
* since this will cause the task to be rescheduled behind any other tasks
|
||||
|
|
|
@ -290,10 +290,10 @@ static int sem_boostholderprio(FAR struct semholder_s *pholder,
|
|||
*/
|
||||
|
||||
if (!sched_verifytcb(htcb))
|
||||
{
|
||||
{
|
||||
sdbg("TCB 0x%08x is a stale handle, counts lost\n", htcb);
|
||||
sem_freeholder(sem, pholder);
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_SEM_NNESTPRIO > 0
|
||||
|
||||
|
@ -441,10 +441,10 @@ static int sem_restoreholderprio(FAR struct semholder_s *pholder,
|
|||
*/
|
||||
|
||||
if (!sched_verifytcb(htcb))
|
||||
{
|
||||
{
|
||||
sdbg("TCB 0x%08x is a stale handle, counts lost\n", htcb);
|
||||
sem_freeholder(sem, pholder);
|
||||
}
|
||||
}
|
||||
|
||||
/* Was the priority of the holder thread boosted? If so, then drop its
|
||||
* priority back to the correct level. What is the correct level?
|
||||
|
@ -573,7 +573,7 @@ static int sem_restoreholderprio(FAR struct semholder_s *pholder,
|
|||
static int sem_restoreholderprioA(FAR struct semholder_s *pholder,
|
||||
FAR sem_t *sem, FAR void *arg)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
if (pholder->htcb != rtcb)
|
||||
{
|
||||
return sem_restoreholderprio(pholder, sem, arg);
|
||||
|
@ -593,7 +593,7 @@ static int sem_restoreholderprioA(FAR struct semholder_s *pholder,
|
|||
static int sem_restoreholderprioB(FAR struct semholder_s *pholder,
|
||||
FAR sem_t *sem, FAR void *arg)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
if (pholder->htcb == rtcb)
|
||||
{
|
||||
(void)sem_restoreholderprio(pholder, sem, arg);
|
||||
|
@ -699,7 +699,7 @@ static inline void sem_restorebaseprio_irq(FAR struct tcb_s *stcb,
|
|||
static inline void sem_restorebaseprio_task(FAR struct tcb_s *stcb,
|
||||
FAR sem_t *sem)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct semholder_s *pholder;
|
||||
|
||||
/* Perform the following actions only if a new thread was given a count.
|
||||
|
@ -858,7 +858,7 @@ void sem_destroyholder(FAR sem_t *sem)
|
|||
|
||||
void sem_addholder(FAR sem_t *sem)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct semholder_s *pholder;
|
||||
|
||||
/* Find or allocate a container for this new holder */
|
||||
|
@ -893,7 +893,7 @@ void sem_addholder(FAR sem_t *sem)
|
|||
|
||||
void sem_boostpriority(FAR sem_t *sem)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
|
||||
/* Boost the priority of every thread holding counts on this semaphore
|
||||
* that are lower in priority than the new thread that is waiting for a
|
||||
|
@ -922,7 +922,7 @@ void sem_boostpriority(FAR sem_t *sem)
|
|||
|
||||
void sem_releaseholder(FAR sem_t *sem)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct semholder_s *pholder;
|
||||
|
||||
/* Find the container for this holder */
|
||||
|
|
|
@ -144,7 +144,7 @@ int sem_post(FAR sem_t *sem)
|
|||
* that we want.
|
||||
*/
|
||||
|
||||
for (stcb = (FAR struct tcb_s*)g_waitingforsemaphore.head;
|
||||
for (stcb = (FAR struct tcb_s *)g_waitingforsemaphore.head;
|
||||
(stcb && stcb->waitsem != sem);
|
||||
stcb = stcb->flink);
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ int sem_tickwait(FAR sem_t *sem, uint32_t start, uint32_t delay)
|
|||
/* Adjust the delay for any time since the delay was calculated */
|
||||
|
||||
elapsed = clock_systimer() - start;
|
||||
if (/*elapsed >= (UINT32_MAX / 2) || */ elapsed >= delay)
|
||||
if (/* elapsed >= (UINT32_MAX / 2) || */ elapsed >= delay)
|
||||
{
|
||||
ret = -ETIMEDOUT;
|
||||
goto errout_with_irqdisabled;
|
||||
|
|
|
@ -96,7 +96,7 @@
|
|||
|
||||
int sem_trywait(FAR sem_t *sem)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
irqstate_t saved_state;
|
||||
int ret = ERROR;
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@
|
|||
|
||||
int sem_wait(FAR sem_t *sem)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
irqstate_t saved_state;
|
||||
int ret = ERROR;
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ static FAR sigactq_t *sig_allocateaction(void)
|
|||
|
||||
/* Try to get the signal action structure from the free list */
|
||||
|
||||
sigact = (FAR sigactq_t*)sq_remfirst(&g_sigfreeaction);
|
||||
sigact = (FAR sigactq_t *)sq_remfirst(&g_sigfreeaction);
|
||||
|
||||
/* Check if we got one. */
|
||||
|
||||
|
@ -100,7 +100,7 @@ static FAR sigactq_t *sig_allocateaction(void)
|
|||
|
||||
/* And try again */
|
||||
|
||||
sigact = (FAR sigactq_t*)sq_remfirst(&g_sigfreeaction);
|
||||
sigact = (FAR sigactq_t *)sq_remfirst(&g_sigfreeaction);
|
||||
ASSERT(sigact);
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ static FAR sigactq_t *sig_allocateaction(void)
|
|||
|
||||
int sigaction(int signo, FAR const struct sigaction *act, FAR struct sigaction *oact)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR sigactq_t *sigact;
|
||||
|
||||
/* Since sigactions can only be installed from the running thread of
|
||||
|
@ -254,7 +254,7 @@ int sigaction(int signo, FAR const struct sigaction *act, FAR struct sigaction *
|
|||
{
|
||||
/* Yes.. Remove it from sigactionq */
|
||||
|
||||
sq_rem((FAR sq_entry_t*)sigact, &rtcb->sigactionq);
|
||||
sq_rem((FAR sq_entry_t *)sigact, &rtcb->sigactionq);
|
||||
|
||||
/* And deallocate it */
|
||||
|
||||
|
@ -279,10 +279,10 @@ int sigaction(int signo, FAR const struct sigaction *act, FAR struct sigaction *
|
|||
/* An error has occurred if we could not allocate the sigaction */
|
||||
|
||||
if (!sigact)
|
||||
{
|
||||
{
|
||||
set_errno(ENOMEM);
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/* Put the signal number in the queue entry */
|
||||
|
||||
|
@ -290,7 +290,7 @@ int sigaction(int signo, FAR const struct sigaction *act, FAR struct sigaction *
|
|||
|
||||
/* Add the new sigaction to sigactionq */
|
||||
|
||||
sq_addlast((FAR sq_entry_t*)sigact, &rtcb->sigactionq);
|
||||
sq_addlast((FAR sq_entry_t *)sigact, &rtcb->sigactionq);
|
||||
}
|
||||
|
||||
/* Set the new sigaction */
|
||||
|
@ -313,5 +313,5 @@ void sig_releaseaction(FAR sigactq_t *sigact)
|
|||
{
|
||||
/* Just put it back on the free list */
|
||||
|
||||
sq_addlast((FAR sq_entry_t*)sigact, &g_sigfreeaction);
|
||||
sq_addlast((FAR sq_entry_t *)sigact, &g_sigfreeaction);
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ FAR sigq_t *sig_allocatependingsigaction(void)
|
|||
{
|
||||
/* Try to get the pending signal action structure from the free list */
|
||||
|
||||
sigq = (FAR sigq_t*)sq_remfirst(&g_sigpendingaction);
|
||||
sigq = (FAR sigq_t *)sq_remfirst(&g_sigpendingaction);
|
||||
|
||||
/* If so, then try the special list of structures reserved for
|
||||
* interrupt handlers
|
||||
|
@ -96,7 +96,7 @@ FAR sigq_t *sig_allocatependingsigaction(void)
|
|||
|
||||
if (!sigq)
|
||||
{
|
||||
sigq = (FAR sigq_t*)sq_remfirst(&g_sigpendingirqaction);
|
||||
sigq = (FAR sigq_t *)sq_remfirst(&g_sigpendingirqaction);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ FAR sigq_t *sig_allocatependingsigaction(void)
|
|||
/* Try to get the pending signal action structure from the free list */
|
||||
|
||||
saved_state = irqsave();
|
||||
sigq = (FAR sigq_t*)sq_remfirst(&g_sigpendingaction);
|
||||
sigq = (FAR sigq_t *)sq_remfirst(&g_sigpendingaction);
|
||||
irqrestore(saved_state);
|
||||
|
||||
/* Check if we got one. */
|
||||
|
|
|
@ -83,29 +83,29 @@ void sig_cleanup(FAR struct tcb_s *stcb)
|
|||
|
||||
/* Deallocate all entries in the list of signal actions */
|
||||
|
||||
while ((sigact = (FAR sigactq_t*)sq_remfirst(&stcb->sigactionq)) != NULL)
|
||||
while ((sigact = (FAR sigactq_t *)sq_remfirst(&stcb->sigactionq)) != NULL)
|
||||
{
|
||||
sig_releaseaction(sigact);
|
||||
}
|
||||
|
||||
/* Deallocate all entries in the list of pending signal actions */
|
||||
|
||||
while ((sigq = (FAR sigq_t*)sq_remfirst(&stcb->sigpendactionq)) != NULL)
|
||||
while ((sigq = (FAR sigq_t *)sq_remfirst(&stcb->sigpendactionq)) != NULL)
|
||||
{
|
||||
sig_releasependingsigaction(sigq);
|
||||
}
|
||||
|
||||
/* Deallocate all entries in the list of posted signal actions */
|
||||
|
||||
while ((sigq = (FAR sigq_t*)sq_remfirst(&stcb->sigpostedq)) != NULL)
|
||||
while ((sigq = (FAR sigq_t *)sq_remfirst(&stcb->sigpostedq)) != NULL)
|
||||
{
|
||||
sig_releasependingsigaction(sigq);
|
||||
}
|
||||
|
||||
/* Misc. signal-related clean-up */
|
||||
/* Misc. signal-related clean-up */
|
||||
|
||||
stcb->sigprocmask = ALL_SIGNAL_SET;
|
||||
stcb->sigwaitmask = NULL_SIGNAL_SET;
|
||||
stcb->sigprocmask = ALL_SIGNAL_SET;
|
||||
stcb->sigwaitmask = NULL_SIGNAL_SET;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -125,7 +125,7 @@ void sig_release(FAR struct task_group_s *group)
|
|||
|
||||
/* Deallocate all entries in the list of pending signals */
|
||||
|
||||
while ((sigpend = (FAR sigpendq_t*)sq_remfirst(&group->sigpendingq)) != NULL)
|
||||
while ((sigpend = (FAR sigpendq_t *)sq_remfirst(&group->sigpendingq)) != NULL)
|
||||
{
|
||||
sig_releasependingsignal(sigpend);
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ void sig_deliver(FAR struct tcb_s *stcb)
|
|||
*/
|
||||
|
||||
saved_errno = stcb->pterrno;
|
||||
for (sigq = (FAR sigq_t*)stcb->sigpendactionq.head; (sigq); sigq = next)
|
||||
for (sigq = (FAR sigq_t *)stcb->sigpendactionq.head; (sigq); sigq = next)
|
||||
{
|
||||
next = sigq->flink;
|
||||
sdbg("Sending signal sigq=0x%x\n", sigq);
|
||||
|
@ -112,8 +112,8 @@ void sig_deliver(FAR struct tcb_s *stcb)
|
|||
*/
|
||||
|
||||
saved_state = irqsave();
|
||||
sq_rem((FAR sq_entry_t*)sigq, &(stcb->sigpendactionq));
|
||||
sq_addlast((FAR sq_entry_t*)sigq, &(stcb->sigpostedq));
|
||||
sq_rem((FAR sq_entry_t *)sigq, &(stcb->sigpendactionq));
|
||||
sq_addlast((FAR sq_entry_t *)sigq, &(stcb->sigpostedq));
|
||||
irqrestore(saved_state);
|
||||
|
||||
/* Call the signal handler (unless the signal was cancelled)
|
||||
|
@ -173,13 +173,13 @@ void sig_deliver(FAR struct tcb_s *stcb)
|
|||
/* Remove the signal from the sigpostedq */
|
||||
|
||||
saved_state = irqsave();
|
||||
sq_rem((FAR sq_entry_t*)sigq, &(stcb->sigpostedq));
|
||||
sq_rem((FAR sq_entry_t *)sigq, &(stcb->sigpostedq));
|
||||
irqrestore(saved_state);
|
||||
|
||||
/* Then deallocate it */
|
||||
|
||||
sig_releasependingsigaction(sigq);
|
||||
}
|
||||
}
|
||||
|
||||
stcb->pterrno = saved_errno;
|
||||
sched_unlock();
|
||||
|
|
|
@ -117,15 +117,15 @@ static int sig_queueaction(FAR struct tcb_s *stcb, siginfo_t *info)
|
|||
{
|
||||
/* Populate the new signal queue element */
|
||||
|
||||
sigq->action.sighandler = sigact->act.sa_u._sa_sigaction;
|
||||
sigq->mask = sigact->act.sa_mask;
|
||||
memcpy(&sigq->info, info, sizeof(siginfo_t));
|
||||
sigq->action.sighandler = sigact->act.sa_u._sa_sigaction;
|
||||
sigq->mask = sigact->act.sa_mask;
|
||||
memcpy(&sigq->info, info, sizeof(siginfo_t));
|
||||
|
||||
/* Put it at the end of the pending signals list */
|
||||
/* Put it at the end of the pending signals list */
|
||||
|
||||
saved_state = irqsave();
|
||||
sq_addlast((FAR sq_entry_t*)sigq, &(stcb->sigpendactionq));
|
||||
irqrestore(saved_state);
|
||||
saved_state = irqsave();
|
||||
sq_addlast((FAR sq_entry_t *)sigq, &(stcb->sigpendactionq));
|
||||
irqrestore(saved_state);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ static FAR sigpendq_t *sig_allocatependingsignal(void)
|
|||
{
|
||||
/* Try to get the pending signal structure from the free list */
|
||||
|
||||
sigpend = (FAR sigpendq_t*)sq_remfirst(&g_sigpendingsignal);
|
||||
sigpend = (FAR sigpendq_t *)sq_remfirst(&g_sigpendingsignal);
|
||||
if (!sigpend)
|
||||
{
|
||||
/* If no pending signal structure is available in the free list,
|
||||
|
@ -160,7 +160,7 @@ static FAR sigpendq_t *sig_allocatependingsignal(void)
|
|||
* interrupt handlers
|
||||
*/
|
||||
|
||||
sigpend = (FAR sigpendq_t*)sq_remfirst(&g_sigpendingirqsignal);
|
||||
sigpend = (FAR sigpendq_t *)sq_remfirst(&g_sigpendingirqsignal);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -172,7 +172,7 @@ static FAR sigpendq_t *sig_allocatependingsignal(void)
|
|||
/* Try to get the pending signal structure from the free list */
|
||||
|
||||
saved_state = irqsave();
|
||||
sigpend = (FAR sigpendq_t*)sq_remfirst(&g_sigpendingsignal);
|
||||
sigpend = (FAR sigpendq_t *)sq_remfirst(&g_sigpendingsignal);
|
||||
irqrestore(saved_state);
|
||||
|
||||
/* Check if we got one. */
|
||||
|
@ -220,7 +220,7 @@ static FAR sigpendq_t *sig_findpendingsignal(FAR struct task_group_s *group,
|
|||
|
||||
/* Seach the list for a sigpendion on this signal */
|
||||
|
||||
for (sigpend = (FAR sigpendq_t*)group->sigpendingq.head;
|
||||
for (sigpend = (FAR sigpendq_t *)group->sigpendingq.head;
|
||||
(sigpend && sigpend->info.si_signo != signo);
|
||||
sigpend = sigpend->flink);
|
||||
|
||||
|
@ -274,7 +274,7 @@ static FAR sigpendq_t *sig_addpendingsignal(FAR struct tcb_s *stcb,
|
|||
/* Add the structure to the pending signal list */
|
||||
|
||||
saved_state = irqsave();
|
||||
sq_addlast((FAR sq_entry_t*)sigpend, &group->sigpendingq);
|
||||
sq_addlast((FAR sq_entry_t *)sigpend, &group->sigpendingq);
|
||||
irqrestore(saved_state);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ FAR sigactq_t *sig_findaction(FAR struct tcb_s *stcb, int signo)
|
|||
|
||||
/* Seach the list for a sigaction on this signal */
|
||||
|
||||
for (sigact = (FAR sigactq_t*)stcb->sigactionq.head;
|
||||
for (sigact = (FAR sigactq_t *)stcb->sigactionq.head;
|
||||
((sigact) && (sigact->signo != signo));
|
||||
sigact = sigact->flink);
|
||||
|
||||
|
|
|
@ -147,19 +147,19 @@ static sigpendq_t *sig_allocatependingsignalblock(sq_queue_t *siglist,
|
|||
static sigq_t *sig_allocateblock(sq_queue_t *siglist, uint16_t nsigs,
|
||||
uint8_t sigtype)
|
||||
{
|
||||
sigq_t *sigqalloc;
|
||||
sigq_t *sigq;
|
||||
int i;
|
||||
FAR sigq_t *sigqalloc;
|
||||
FAR sigq_t *sigq;
|
||||
int i;
|
||||
|
||||
/* Allocate a block of pending signal actions */
|
||||
|
||||
sigqalloc = (sigq_t*)kmm_malloc((sizeof(sigq_t)) * nsigs);
|
||||
sigqalloc = (FAR sigq_t *)kmm_malloc((sizeof(sigq_t)) * nsigs);
|
||||
|
||||
sigq = sigqalloc;
|
||||
for (i = 0; i < nsigs; i++)
|
||||
{
|
||||
sigq->type = sigtype;
|
||||
sq_addlast((FAR sq_entry_t*)sigq++, siglist);
|
||||
sq_addlast((FAR sq_entry_t *)sigq++, siglist);
|
||||
}
|
||||
|
||||
return sigqalloc;
|
||||
|
@ -177,20 +177,20 @@ static sigq_t *sig_allocateblock(sq_queue_t *siglist, uint16_t nsigs,
|
|||
static sigpendq_t *sig_allocatependingsignalblock(sq_queue_t *siglist,
|
||||
uint16_t nsigs, uint8_t sigtype)
|
||||
{
|
||||
sigpendq_t *sigpendalloc;
|
||||
sigpendq_t *sigpend;
|
||||
FAR sigpendq_t *sigpendalloc;
|
||||
FAR sigpendq_t *sigpend;
|
||||
int i;
|
||||
|
||||
/* Allocate a block of pending signal structures */
|
||||
|
||||
sigpendalloc =
|
||||
(sigpendq_t*)kmm_malloc((sizeof(sigpendq_t)) * nsigs);
|
||||
(FAR sigpendq_t *)kmm_malloc((sizeof(sigpendq_t)) * nsigs);
|
||||
|
||||
sigpend = sigpendalloc;
|
||||
for (i = 0; i < nsigs; i++)
|
||||
{
|
||||
sigpend->type = sigtype;
|
||||
sq_addlast((FAR sq_entry_t*)sigpend++, siglist);
|
||||
sq_addlast((FAR sq_entry_t *)sigpend++, siglist);
|
||||
}
|
||||
|
||||
return sigpendalloc;
|
||||
|
@ -254,17 +254,17 @@ void sig_initialize(void)
|
|||
|
||||
void sig_allocateactionblock(void)
|
||||
{
|
||||
sigactq_t *sigact;
|
||||
FAR sigactq_t *sigact;
|
||||
int i;
|
||||
|
||||
/* Allocate a block of signal actions */
|
||||
|
||||
g_sigactionalloc =
|
||||
(sigactq_t*)kmm_malloc((sizeof(sigactq_t)) * NUM_SIGNAL_ACTIONS);
|
||||
(FAR sigactq_t *)kmm_malloc((sizeof(sigactq_t)) * NUM_SIGNAL_ACTIONS);
|
||||
|
||||
sigact = g_sigactionalloc;
|
||||
for (i = 0; i < NUM_SIGNAL_ACTIONS; i++)
|
||||
{
|
||||
sq_addlast((FAR sq_entry_t*)sigact++, &g_sigfreeaction);
|
||||
sq_addlast((FAR sq_entry_t *)sigact++, &g_sigfreeaction);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@
|
|||
|
||||
int sigpending(FAR sigset_t *set)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
int ret = ERROR;
|
||||
|
||||
if (set)
|
||||
|
@ -121,7 +121,7 @@ sigset_t sig_pendingset(FAR struct tcb_s *stcb)
|
|||
sigpendset = NULL_SIGNAL_SET;
|
||||
|
||||
saved_state = irqsave();
|
||||
for (sigpend = (FAR sigpendq_t*)group->sigpendingq.head;
|
||||
for (sigpend = (FAR sigpendq_t *)group->sigpendingq.head;
|
||||
(sigpend); sigpend = sigpend->flink)
|
||||
{
|
||||
sigaddset(&sigpendset, sigpend->info.si_signo);
|
||||
|
|
|
@ -113,7 +113,7 @@
|
|||
|
||||
int sigprocmask(int how, FAR const sigset_t *set, FAR sigset_t *oset)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
sigset_t oldsigprocmask;
|
||||
irqstate_t saved_state;
|
||||
int ret = OK;
|
||||
|
|
|
@ -89,9 +89,9 @@ void sig_releasependingsigaction(FAR sigq_t *sigq)
|
|||
* list from interrupt handlers. */
|
||||
|
||||
saved_state = irqsave();
|
||||
sq_addlast((FAR sq_entry_t*)sigq, &g_sigpendingaction);
|
||||
sq_addlast((FAR sq_entry_t *)sigq, &g_sigpendingaction);
|
||||
irqrestore(saved_state);
|
||||
}
|
||||
}
|
||||
|
||||
/* If this is a message pre-allocated for interrupts,
|
||||
* then put it back in the correct free list.
|
||||
|
@ -103,7 +103,7 @@ void sig_releasependingsigaction(FAR sigq_t *sigq)
|
|||
* list from interrupt handlers. */
|
||||
|
||||
saved_state = irqsave();
|
||||
sq_addlast((FAR sq_entry_t*)sigq, &g_sigpendingirqaction);
|
||||
sq_addlast((FAR sq_entry_t *)sigq, &g_sigpendingirqaction);
|
||||
irqrestore(saved_state);
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ void sig_releasependingsignal(FAR sigpendq_t *sigpend)
|
|||
*/
|
||||
|
||||
saved_state = irqsave();
|
||||
sq_addlast((FAR sq_entry_t*)sigpend, &g_sigpendingsignal);
|
||||
sq_addlast((FAR sq_entry_t *)sigpend, &g_sigpendingsignal);
|
||||
irqrestore(saved_state);
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ void sig_releasependingsignal(FAR sigpendq_t *sigpend)
|
|||
*/
|
||||
|
||||
saved_state = irqsave();
|
||||
sq_addlast((FAR sq_entry_t*)sigpend, &g_sigpendingirqsignal);
|
||||
sq_addlast((FAR sq_entry_t *)sigpend, &g_sigpendingirqsignal);
|
||||
irqrestore(saved_state);
|
||||
}
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ FAR sigpendq_t *sig_removependingsignal(FAR struct tcb_s *stcb, int signo)
|
|||
|
||||
saved_state = irqsave();
|
||||
|
||||
for (prevsig = NULL, currsig = (FAR sigpendq_t*)group->sigpendingq.head;
|
||||
for (prevsig = NULL, currsig = (FAR sigpendq_t *)group->sigpendingq.head;
|
||||
(currsig && currsig->info.si_signo != signo);
|
||||
prevsig = currsig, currsig = currsig->flink);
|
||||
|
||||
|
@ -103,7 +103,7 @@ FAR sigpendq_t *sig_removependingsignal(FAR struct tcb_s *stcb, int signo)
|
|||
{
|
||||
if (prevsig)
|
||||
{
|
||||
sq_remafter((FAR sq_entry_t*)prevsig, &group->sigpendingq);
|
||||
sq_remafter((FAR sq_entry_t *)prevsig, &group->sigpendingq);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -110,7 +110,7 @@
|
|||
|
||||
int sigsuspend(FAR const sigset_t *set)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
sigset_t intersection;
|
||||
sigset_t saved_sigprocmask;
|
||||
FAR sigpendq_t *sigpend;
|
||||
|
|
|
@ -93,7 +93,7 @@
|
|||
static void sig_timeout(int argc, wdparm_t itcb)
|
||||
{
|
||||
/* On many small machines, pointers are encoded and cannot be simply cast
|
||||
* from uint32_t to struct tcb_s*. The following union works around this
|
||||
* from uint32_t to struct tcb_s *. 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.
|
||||
*/
|
||||
|
@ -175,7 +175,7 @@ static void sig_timeout(int argc, wdparm_t itcb)
|
|||
int sigtimedwait(FAR const sigset_t *set, FAR struct siginfo *info,
|
||||
FAR const struct timespec *timeout)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
sigset_t intersection;
|
||||
FAR sigpendq_t *sigpend;
|
||||
irqstate_t saved_state;
|
||||
|
@ -351,8 +351,8 @@ int sigtimedwait(FAR const sigset_t *set, FAR struct siginfo *info,
|
|||
}
|
||||
|
||||
irqrestore(saved_state);
|
||||
}
|
||||
}
|
||||
|
||||
sched_unlock();
|
||||
return ret;
|
||||
sched_unlock();
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -80,29 +80,29 @@
|
|||
|
||||
void sig_unmaskpendingsignal(void)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
sigset_t unmaskedset;
|
||||
FAR sigpendq_t *pendingsig;
|
||||
int signo;
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
sigset_t unmaskedset;
|
||||
FAR sigpendq_t *pendingsig;
|
||||
int signo;
|
||||
|
||||
/* Prohibit any context switches until we are done with this.
|
||||
* We may still be performing signal operations from interrupt
|
||||
* handlers, however, none of the pending signals that we
|
||||
* are concerned with here should be effected.
|
||||
*/
|
||||
/* Prohibit any context switches until we are done with this.
|
||||
* We may still be performing signal operations from interrupt
|
||||
* handlers, however, none of the pending signals that we
|
||||
* are concerned with here should be effected.
|
||||
*/
|
||||
|
||||
sched_lock();
|
||||
sched_lock();
|
||||
|
||||
/* Get the set of pending signals that were just unmasked. The
|
||||
* following operation should be safe because the sigprocmask
|
||||
* can only be changed on this thread of execution.
|
||||
*/
|
||||
/* Get the set of pending signals that were just unmasked. The
|
||||
* following operation should be safe because the sigprocmask
|
||||
* can only be changed on this thread of execution.
|
||||
*/
|
||||
|
||||
unmaskedset = ~(rtcb->sigprocmask) & sig_pendingset(rtcb);
|
||||
unmaskedset = ~(rtcb->sigprocmask) & sig_pendingset(rtcb);
|
||||
|
||||
/* Loop while there are unmasked pending signals to be processed. */
|
||||
/* Loop while there are unmasked pending signals to be processed. */
|
||||
|
||||
while (unmaskedset != NULL_SIGNAL_SET)
|
||||
while (unmaskedset != NULL_SIGNAL_SET)
|
||||
{
|
||||
/* Pending signals will be processed from lowest numbered signal
|
||||
* to highest
|
||||
|
|
|
@ -93,7 +93,7 @@
|
|||
|
||||
void exit(int status)
|
||||
{
|
||||
struct tcb_s *tcb = (struct tcb_s*)g_readytorun.head;
|
||||
struct tcb_s *tcb = (struct tcb_s *)g_readytorun.head;
|
||||
|
||||
/* Only the lower 8-bits of status are used */
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ int atexit(void (*func)(void))
|
|||
return on_exit((onexitfunc_t)func, NULL);
|
||||
|
||||
#elif defined(CONFIG_SCHED_ATEXIT_MAX) && CONFIG_SCHED_ATEXIT_MAX > 1
|
||||
FAR struct tcb_s *tcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
FAR struct tcb_s *tcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct task_group_s *group = tcb->group;
|
||||
int index;
|
||||
int ret = ERROR;
|
||||
|
@ -155,7 +155,7 @@ int atexit(void (*func)(void))
|
|||
|
||||
return ret;
|
||||
#else
|
||||
FAR struct tcb_s *tcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
FAR struct tcb_s *tcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
FAR struct task_group_s *group = tcb->group;
|
||||
int ret = ERROR;
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue