summaryrefslogtreecommitdiff
path: root/apps/examples
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-01-24 23:18:32 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-01-24 23:18:32 +0000
commit2a8490551299ccfdfa300c1b859719c08581e553 (patch)
treec4f4fcda6c667b7928c3b2aaa89a81027e298b47 /apps/examples
parent76860c5a3ef2b54b7eb8e5d63138aa84422bbf75 (diff)
downloadpx4-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 'apps/examples')
-rw-r--r--apps/examples/ostest/ostest_main.c28
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);