From b6472b58dcce32d4ab2051f13cef89a6f0296c28 Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 25 Jan 2013 00:01:08 +0000 Subject: Fix some compilation errors when child status disabled; new waitpid logic not encoding/decoding status properly git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5561 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/sched/pthread_join.c | 2 +- nuttx/sched/sched_waitid.c | 12 ++++++------ nuttx/sched/sched_waitpid.c | 10 +++++----- nuttx/sched/task_childstatus.c | 4 ++-- nuttx/sched/timer_initialize.c | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) (limited to 'nuttx/sched') diff --git a/nuttx/sched/pthread_join.c b/nuttx/sched/pthread_join.c index 6a02af352..d3f648dc7 100644 --- a/nuttx/sched/pthread_join.c +++ b/nuttx/sched/pthread_join.c @@ -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); diff --git a/nuttx/sched/sched_waitid.c b/nuttx/sched/sched_waitid.c index e73bc223c..56bfb36f0 100644 --- a/nuttx/sched/sched_waitid.c +++ b/nuttx/sched/sched_waitid.c @@ -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; } } diff --git a/nuttx/sched/sched_waitpid.c b/nuttx/sched/sched_waitpid.c index ecdc60a2c..d7484fca9 100644 --- a/nuttx/sched/sched_waitpid.c +++ b/nuttx/sched/sched_waitpid.c @@ -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; } diff --git a/nuttx/sched/task_childstatus.c b/nuttx/sched/task_childstatus.c index 09aa48135..6007f03e5 100644 --- a/nuttx/sched/task_childstatus.c +++ b/nuttx/sched/task_childstatus.c @@ -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) { diff --git a/nuttx/sched/timer_initialize.c b/nuttx/sched/timer_initialize.c index 05980bb1a..2651469ef 100644 --- a/nuttx/sched/timer_initialize.c +++ b/nuttx/sched/timer_initialize.c @@ -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 -- cgit v1.2.3