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 | a2ec48846f786e72a976038c9467b25a61ad5a9f (patch) | |
tree | c4f4fcda6c667b7928c3b2aaa89a81027e298b47 /nuttx/sched/task_reparent.c | |
parent | 25e9b8d0846b68a18014c63146234193bfe539e8 (diff) | |
download | px4-firmware-a2ec48846f786e72a976038c9467b25a61ad5a9f.tar.gz px4-firmware-a2ec48846f786e72a976038c9467b25a61ad5a9f.tar.bz2 px4-firmware-a2ec48846f786e72a976038c9467b25a61ad5a9f.zip |
Fix some missing logic and inconsistencies in child status logic; Fix a bug introduced into sigaction()
git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5560 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/sched/task_reparent.c')
-rw-r--r-- | nuttx/sched/task_reparent.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/nuttx/sched/task_reparent.c b/nuttx/sched/task_reparent.c index 28d371bf1..3a7ece37d 100644 --- a/nuttx/sched/task_reparent.c +++ b/nuttx/sched/task_reparent.c @@ -138,14 +138,32 @@ int task_reparent(pid_t ppid, pid_t chpid) child = task_removechild(otcb, chpid); if (child) { - /* Add the child status entry to the new parent TCB */ + /* Has the new parent supressed child exit status? */ + + if ((ptcb->flags && TCB_FLAG_NOCLDWAIT) == 0) + { + /* No.. Add the child status entry to the new parent TCB */ + + task_addchild(ptcb, child); + } + else + { + /* Yes.. Discard the child status entry */ + + task_freechild(child); + } + + /* Either case is a success */ - task_addchild(ptcb, child); ret = OK; } else { - ret = -ENOENT; + /* This would not be an error if the original parent has + * suppressed child exit status. + */ + + ret = ((otcb->flags && TCB_FLAG_NOCLDWAIT) == 0) ? -ENOENT : OK; } #else DEBUGASSERT(otcb->nchildren > 0); |