Fix some compilation errors when child status disabled; new waitpid logic not encoding/decoding status properly
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5561 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
caf5fdf217
commit
99603c9a02
@ -123,7 +123,7 @@ int pthread_join(pthread_t thread, FAR pthread_addr_t *pexit_value)
|
||||
* This can fail for one of three reasons: (1) There is no
|
||||
* thread associated with 'thread,' (2) the thread is a task
|
||||
* and does not have join information, or (3) the thread
|
||||
* was detached and has exitted.
|
||||
* was detached and has exited.
|
||||
*/
|
||||
|
||||
pjoin = pthread_findjoininfo((pid_t)thread);
|
||||
|
@ -54,16 +54,16 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
* Name: exitted_child
|
||||
* Name: exited_child
|
||||
*
|
||||
* Description:
|
||||
* Handle the case where a child exitted properlay was we (apparently) lost
|
||||
* Handle the case where a child exited properlay was we (apparently) lost
|
||||
* the detch of child signal.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SCHED_CHILD_STATUS
|
||||
static void exitted_child(FAR _TCB *rtcb, FAR struct child_status_s *child,
|
||||
static void exited_child(FAR _TCB *rtcb, FAR struct child_status_s *child,
|
||||
FAR siginfo_t *info)
|
||||
{
|
||||
/* The child has exited. Return the saved exit status (and some fudged
|
||||
@ -271,11 +271,11 @@ int waitid(idtype_t idtype, id_t id, FAR siginfo_t *info, int options)
|
||||
|
||||
if (retains && (child = task_exitchild(rtcb)) != NULL)
|
||||
{
|
||||
/* A child has exitted. Apparently we missed the signal.
|
||||
/* A child has exited. Apparently we missed the signal.
|
||||
* Return the exit status and break out of the loop.
|
||||
*/
|
||||
|
||||
exitted_child(rtcb, child, info);
|
||||
exited_child(rtcb, child, info);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -297,7 +297,7 @@ int waitid(idtype_t idtype, id_t id, FAR siginfo_t *info, int options)
|
||||
* of the loop.
|
||||
*/
|
||||
|
||||
exitted_child(rtcb, child, info);
|
||||
exited_child(rtcb, child, info);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -384,13 +384,13 @@ pid_t waitpid(pid_t pid, int *stat_loc, int options)
|
||||
DEBUGASSERT(!retains || rtcb->children);
|
||||
if (retains && (child = task_exitchild(rtcb)) != NULL)
|
||||
{
|
||||
/* A child has exitted. Apparently we missed the signal.
|
||||
/* A child has exited. Apparently we missed the signal.
|
||||
* Return the saved exit status.
|
||||
*/
|
||||
|
||||
/* The child has exited. Return the saved exit status */
|
||||
|
||||
*stat_loc = child->ch_status;
|
||||
*stat_loc = child->ch_status << 8;
|
||||
|
||||
/* Discard the child entry and break out of the loop */
|
||||
|
||||
@ -415,7 +415,7 @@ pid_t waitpid(pid_t pid, int *stat_loc, int options)
|
||||
{
|
||||
/* The child has exited. Return the saved exit status */
|
||||
|
||||
*stat_loc = child->ch_status;
|
||||
*stat_loc = child->ch_status << 8;
|
||||
|
||||
/* Discard the child entry and break out of the loop */
|
||||
|
||||
@ -452,7 +452,7 @@ pid_t waitpid(pid_t pid, int *stat_loc, int options)
|
||||
*/
|
||||
|
||||
if (rtcb->nchildren == 0 ||
|
||||
(pid != (pid_t)-1 && (ret = kill((pid_t)id, 0)) < 0))
|
||||
(pid != (pid_t)-1 && (ret = kill(pid, 0)) < 0))
|
||||
{
|
||||
/* We know that the child task was running okay we stared,
|
||||
* so we must have lost the signal. What can we do?
|
||||
@ -481,7 +481,7 @@ pid_t waitpid(pid_t pid, int *stat_loc, int options)
|
||||
{
|
||||
/* Yes... return the status and PID (in the event it was -1) */
|
||||
|
||||
*stat_loc = info.si_status;
|
||||
*stat_loc = info.si_status << 8;
|
||||
pid = info.si_pid;
|
||||
break;
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ static void task_dumpchildren(FAR _TCB *tcb, FAR const char *msg)
|
||||
}
|
||||
}
|
||||
#else
|
||||
# task_dumpchildren(t,m)
|
||||
# define task_dumpchildren(t,m)
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
@ -320,7 +320,7 @@ FAR struct child_status_s *task_exitchild(FAR _TCB *tcb)
|
||||
{
|
||||
FAR struct child_status_s *child;
|
||||
|
||||
/* Find the status structure with the matching PID */
|
||||
/* Find the status structure of any child task that has exitted. */
|
||||
|
||||
for (child = tcb->children; child; child = child->flink)
|
||||
{
|
||||
|
@ -137,7 +137,7 @@ void weak_function timer_initialize(void)
|
||||
* resources are referenced.
|
||||
*
|
||||
* Parameters:
|
||||
* pid - the task ID of the thread that exitted
|
||||
* pid - the task ID of the thread that exited
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
|
Loading…
Reference in New Issue
Block a user