diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-01-24 23:18:32 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-01-24 23:18:32 +0000 |
commit | 2a8490551299ccfdfa300c1b859719c08581e553 (patch) | |
tree | c4f4fcda6c667b7928c3b2aaa89a81027e298b47 /nuttx/sched/task_childstatus.c | |
parent | 76860c5a3ef2b54b7eb8e5d63138aa84422bbf75 (diff) | |
download | px4-nuttx-2a8490551299ccfdfa300c1b859719c08581e553.tar.gz px4-nuttx-2a8490551299ccfdfa300c1b859719c08581e553.tar.bz2 px4-nuttx-2a8490551299ccfdfa300c1b859719c08581e553.zip |
Fix some missing logic and inconsistencies in child status logic; Fix a bug introduced into sigaction()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5560 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/sched/task_childstatus.c')
-rw-r--r-- | nuttx/sched/task_childstatus.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/nuttx/sched/task_childstatus.c b/nuttx/sched/task_childstatus.c index 0f6d36c29..09aa48135 100644 --- a/nuttx/sched/task_childstatus.c +++ b/nuttx/sched/task_childstatus.c @@ -298,6 +298,42 @@ FAR struct child_status_s *task_findchild(FAR _TCB *tcb, pid_t pid) } /***************************************************************************** + * Name: task_exitchild + * + * Description: + * Search for any child that has exitted. + * + * Parameters: + * tcb - The TCB of the parent task to containing the child status. + * + * Return Value: + * On success, a non-NULL pointer to a child status structure for the + * exited child. NULL is returned if not child has exited. + * + * Assumptions: + * Called during SIGCHLD processing in a safe context. No special precautions + * are required here. + * + *****************************************************************************/ + +FAR struct child_status_s *task_exitchild(FAR _TCB *tcb) +{ + FAR struct child_status_s *child; + + /* Find the status structure with the matching PID */ + + for (child = tcb->children; child; child = child->flink) + { + if ((child->ch_flags & CHILD_FLAG_EXITED) != 0) + { + return child; + } + } + + return NULL; +} + +/***************************************************************************** * Name: task_removechild * * Description: |