mirror of
https://github.com/apache/nuttx.git
synced 2026-05-23 06:39:01 +08:00
sched/: Fix some spacing issues
This commit is contained in:
+1
-1
Submodule arch updated: 0b8c98bfac...ecb6712035
+1
-1
Submodule configs updated: 2386155376...20921ccad2
@@ -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 */
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user