summaryrefslogtreecommitdiff
path: root/apps/examples
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-02-08 22:53:14 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-02-08 22:53:14 +0000
commit3219f837f162088ad89b2102d1fcf71b293c14fc (patch)
treee683adb1fe0d36ce9fa9f6219951a8fa2cc369c8 /apps/examples
parent08650208d65dad8629ef44064f443dfbc2420f38 (diff)
downloadpx4-nuttx-3219f837f162088ad89b2102d1fcf71b293c14fc.tar.gz
px4-nuttx-3219f837f162088ad89b2102d1fcf71b293c14fc.tar.bz2
px4-nuttx-3219f837f162088ad89b2102d1fcf71b293c14fc.zip
Fix some problems with the vfork() test on the STM32F3Discovery
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5628 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'apps/examples')
-rw-r--r--apps/examples/ostest/Makefile2
-rw-r--r--apps/examples/ostest/ostest.h3
-rw-r--r--apps/examples/ostest/ostest_main.c3
-rw-r--r--apps/examples/ostest/vfork.c9
4 files changed, 11 insertions, 6 deletions
diff --git a/apps/examples/ostest/Makefile b/apps/examples/ostest/Makefile
index fd8ef79e0..e0265fc31 100644
--- a/apps/examples/ostest/Makefile
+++ b/apps/examples/ostest/Makefile
@@ -89,8 +89,10 @@ CSRCS += posixtimer.c
endif
ifeq ($(CONFIG_ARCH_HAVE_VFORK),y)
+ifeq ($(CONFIG_SCHED_WAITPID),y)
CSRCS += vfork.c
endif
+endif
ifneq ($(CONFIG_DISABLE_SIGNALS),y)
ifneq ($(CONFIG_DISABLE_PTHREAD),y)
diff --git a/apps/examples/ostest/ostest.h b/apps/examples/ostest/ostest.h
index 9c6bb082b..d5016540b 100644
--- a/apps/examples/ostest/ostest.h
+++ b/apps/examples/ostest/ostest.h
@@ -175,7 +175,8 @@ void priority_inheritance(void);
/* vfork.c ******************************************************************/
-#ifdef CONFIG_ARCH_HAVE_VFORK
+#if defined(CONFIG_ARCH_HAVE_VFORK) && defined(CONFIG_SCHED_WAITPID) && \
+ !defined(CONFIG_DISABLE_SIGNALS)
int vfork_test(void);
#endif
diff --git a/apps/examples/ostest/ostest_main.c b/apps/examples/ostest/ostest_main.c
index 978f72f9e..21f5e6077 100644
--- a/apps/examples/ostest/ostest_main.c
+++ b/apps/examples/ostest/ostest_main.c
@@ -451,7 +451,8 @@ static int user_main(int argc, char *argv[])
check_test_memory_usage();
#endif /* CONFIG_PRIORITY_INHERITANCE && !CONFIG_DISABLE_SIGNALS && !CONFIG_DISABLE_PTHREAD */
-#ifdef CONFIG_ARCH_HAVE_VFORK
+#if defined(CONFIG_ARCH_HAVE_VFORK) && defined(CONFIG_SCHED_WAITPID) && \
+ !defined(CONFIG_DISABLE_SIGNALS)
printf("\nuser_main: vfork() test\n");
vfork_test();
#endif
diff --git a/apps/examples/ostest/vfork.c b/apps/examples/ostest/vfork.c
index 4e1b8c892..fd99d1aea 100644
--- a/apps/examples/ostest/vfork.c
+++ b/apps/examples/ostest/vfork.c
@@ -47,6 +47,9 @@
#include "ostest.h"
+#if defined(CONFIG_ARCH_HAVE_VFORK) && defined(CONFIG_SCHED_WAITPID) && \
+ !defined(CONFIG_DISABLE_SIGNALS)
+
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
@@ -55,9 +58,7 @@
* Private Data
****************************************************************************/
-#if defined(CONFIG_ARCH_HAVE_VFORK) && !defined(CONFIG_DISABLE_SIGNALS)
static volatile bool g_vforkchild;
-#endif
/****************************************************************************
* Public Functions
@@ -65,7 +66,6 @@ static volatile bool g_vforkchild;
int vfork_test(void)
{
-#if defined(CONFIG_ARCH_HAVE_VFORK) && !defined(CONFIG_DISABLE_SIGNALS)
pid_t pid;
g_vforkchild = false;
@@ -97,7 +97,8 @@ int vfork_test(void)
return -1;
}
}
-#endif
return 0;
}
+
+#endif /* CONFIG_ARCH_HAVE_VFORK && CONFIG_SCHED_WAITPID && !CONFIG_DISABLE_SIGNALS */