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 /apps/examples/ostest | |
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 'apps/examples/ostest')
-rw-r--r-- | apps/examples/ostest/ostest_main.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/apps/examples/ostest/ostest_main.c b/apps/examples/ostest/ostest_main.c index aab1ff045..3e4197fdc 100644 --- a/apps/examples/ostest/ostest_main.c +++ b/apps/examples/ostest/ostest_main.c @@ -43,8 +43,11 @@ #include <stdio.h> #include <stdlib.h> #include <unistd.h> +#include <signal.h> #include <string.h> #include <sched.h> +#include <errno.h> + #include <nuttx/init.h> #include "ostest.h" @@ -264,6 +267,31 @@ static int user_main(int argc, char *argv[]) } check_test_memory_usage(); + /* If retention of child status is enable, then suppress it for this task. + * This task may produce many, many children (especially if + * CONFIG_EXAMPLES_OSTEST_LOOPS) and it does not harvest their exit status. + * As a result, the test may fail inappropriately unless retention of + * child exit status is disabled. + * + * So basically, this tests that child status can be disabled, but cannot + * verify that status is retained correctly. + */ + +#if defined(CONFIG_SCHED_HAVE_PARENT) && defined(CONFIG_SCHED_CHILD_STATUS) + { + struct sigaction sa; + int ret; + + sa.sa_handler = SIG_IGN; + sa.sa_flags = SA_NOCLDWAIT; + ret = sigaction(SIGCHLD, &sa, NULL); + if (ret < 0) + { + printf("user_main: ERROR: sigaction failed: %d\n", errno); + } + } +#endif + /* Check environment variables */ #ifndef CONFIG_DISABLE_ENVIRON show_environment(true, true, true); |