summaryrefslogtreecommitdiff
path: root/regress/sys
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2002-02-17 05:22:42 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2002-02-17 05:22:42 +0000
commit89483c0839e81a56a2e3c8ef2b4e17cb6f852dc0 (patch)
tree86b9b81e0a8e7d1690ff25a9fdbc9d211838b532 /regress/sys
parentba5684d7cb7011f557b12f3ea52890889ab25bcd (diff)
test rfork(RFNOWAIT)
Diffstat (limited to 'regress/sys')
-rw-r--r--regress/sys/kern/rfork/rfnowait/Makefile5
-rw-r--r--regress/sys/kern/rfork/rfnowait/rfnowait.c32
2 files changed, 37 insertions, 0 deletions
diff --git a/regress/sys/kern/rfork/rfnowait/Makefile b/regress/sys/kern/rfork/rfnowait/Makefile
new file mode 100644
index 00000000000..7f716a0315f
--- /dev/null
+++ b/regress/sys/kern/rfork/rfnowait/Makefile
@@ -0,0 +1,5 @@
+# $OpenBSD: Makefile,v 1.1 2002/02/17 05:22:41 art Exp $
+
+PROG=rfnowait
+
+.include <bsd.regress.mk>
diff --git a/regress/sys/kern/rfork/rfnowait/rfnowait.c b/regress/sys/kern/rfork/rfnowait/rfnowait.c
new file mode 100644
index 00000000000..7a304d8efb6
--- /dev/null
+++ b/regress/sys/kern/rfork/rfnowait/rfnowait.c
@@ -0,0 +1,32 @@
+/* $OpenBSD: rfnowait.c,v 1.1 2002/02/17 05:22:41 art Exp $ */
+/*
+ * Written by Artur Grabowski <art@openbsd.org>, 2002 Public Domain.
+ */
+#include <sys/param.h>
+#include <sys/wait.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <err.h>
+#include <errno.h>
+
+int
+main()
+{
+ int status;
+
+ switch(rfork(RFFDG|RFNOWAIT|RFPROC)) {
+ case -1:
+ err(1, "fork");
+ case 0:
+ _exit(0);
+ }
+
+ if (wait(&status) >= 0)
+ errx(1, "wait returned a child?");
+
+ if (errno != ECHILD)
+ err(1, "unexpected errno (%d)");
+
+ return 0;
+} \ No newline at end of file