summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorPhilip Guenthe <guenther@cvs.openbsd.org>2012-04-12 14:00:23 +0000
committerPhilip Guenthe <guenther@cvs.openbsd.org>2012-04-12 14:00:23 +0000
commitbcc80ee02f051d35a08f455d3f34fa401882dbfc (patch)
treea654a035dae5222e687fe43ae72d70856e7f533b /regress
parent1085047e8635095083ba5f535703469755011a1b (diff)
rfork RIP
Diffstat (limited to 'regress')
-rw-r--r--regress/sys/kern/Makefile3
-rw-r--r--regress/sys/kern/rfork/Makefile10
-rw-r--r--regress/sys/kern/rfork/kqueue/Makefile5
-rw-r--r--regress/sys/kern/rfork/kqueue/kqueue.c50
-rw-r--r--regress/sys/kern/rfork/madness/Makefile5
-rw-r--r--regress/sys/kern/rfork/madness/madness.c55
-rw-r--r--regress/sys/kern/rfork/rfcfdg/Makefile5
-rw-r--r--regress/sys/kern/rfork/rfcfdg/rfcfdg.c38
-rw-r--r--regress/sys/kern/rfork/rfmem-stack/Makefile5
-rw-r--r--regress/sys/kern/rfork/rfmem-stack/rfmem-stack.c54
-rw-r--r--regress/sys/kern/rfork/rfmem/Makefile5
-rw-r--r--regress/sys/kern/rfork/rfmem/rfmem.c50
-rw-r--r--regress/sys/kern/rfork/rfnowait/Makefile5
-rw-r--r--regress/sys/kern/rfork/rfnowait/rfnowait.c32
-rw-r--r--regress/sys/kern/rfork/rfsharefd/Makefile5
-rw-r--r--regress/sys/kern/rfork/rfsharefd/rfsharefd.c42
16 files changed, 1 insertions, 368 deletions
diff --git a/regress/sys/kern/Makefile b/regress/sys/kern/Makefile
index 0953ca1ad48..23e794decb6 100644
--- a/regress/sys/kern/Makefile
+++ b/regress/sys/kern/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.57 2012/03/05 02:40:21 guenther Exp $
+# $OpenBSD: Makefile,v 1.58 2012/04/12 14:00:22 guenther Exp $
SUBDIR+= __syscall accept dup2 dup2_self exec_self execve exit extent
SUBDIR+= fchdir
@@ -10,7 +10,6 @@ SUBDIR+= main-thread-exited
SUBDIR+= mmap mmap2 mmap3 mmap-fail
#SUBDIR+= mquery
SUBDIR+= nanosleep noexec pread preadv ptmget pwrite pwritev rcvtimeo
-#SUBDIR+= rfork
SUBDIR+= rlimit-file signal signal-stress sigsuspend
SUBDIR+= syscall sysvmsg sysvsem
SUBDIR+= sysvshm unalign unfdpass wait
diff --git a/regress/sys/kern/rfork/Makefile b/regress/sys/kern/rfork/Makefile
deleted file mode 100644
index 8449dcb2e0f..00000000000
--- a/regress/sys/kern/rfork/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-# $OpenBSD: Makefile,v 1.8 2010/08/04 06:06:31 guenther Exp $
-
-SUBDIR=rfcfdg rfnowait rfsharefd kqueue
-
-# RFMEM requires something like rfork_thread() to fix up the stack
-#SUBDIR=rfmem madness rfmem-stack
-
-install:
-
-.include <bsd.subdir.mk>
diff --git a/regress/sys/kern/rfork/kqueue/Makefile b/regress/sys/kern/rfork/kqueue/Makefile
deleted file mode 100644
index 7a3dcf68cc5..00000000000
--- a/regress/sys/kern/rfork/kqueue/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.1 2010/08/04 06:05:26 guenther Exp $
-
-PROG=kqueue
-
-.include <bsd.regress.mk>
diff --git a/regress/sys/kern/rfork/kqueue/kqueue.c b/regress/sys/kern/rfork/kqueue/kqueue.c
deleted file mode 100644
index f21fadc5798..00000000000
--- a/regress/sys/kern/rfork/kqueue/kqueue.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* $OpenBSD: kqueue.c,v 1.1 2010/08/04 06:05:26 guenther Exp $ */
-/*
- * Written by Philip Guenther <guenther@openbsd.org>, 2010 Public Domain.
- *
- * Verify that having a process exit while it has knotes attached to it
- * that are from a kqueue that is open in another process doesn't cause
- * problems.
- */
-#include <sys/param.h>
-#include <sys/event.h>
-#include <sys/time.h>
-#include <sys/wait.h>
-#include <err.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-int
-main(int argc, char *argv[])
-{
- struct kevent ev;
- int status;
- int kq;
-
- if ((kq = kqueue()) < 0)
- err(1, "kqueue");
-
- signal(SIGINT, SIG_IGN);
- EV_SET(&ev, SIGINT, EVFILT_SIGNAL, EV_ADD|EV_ENABLE, 0, 0, 0);
-
- switch(rfork(RFPROC)) {
- case -1:
- err(1, "rfork");
- case 0:
- if (kevent(kq, &ev, 1, NULL, 0, NULL))
- err(1, "kevent");
- raise(SIGINT);
- _exit(0);
- }
-
- if (wait(&status) < 0)
- err(1, "wait");
-
- if (!WIFEXITED(status))
- err(1, "child error");
-
- return WEXITSTATUS(status) != 0;
-}
diff --git a/regress/sys/kern/rfork/madness/Makefile b/regress/sys/kern/rfork/madness/Makefile
deleted file mode 100644
index d44f5ff2b76..00000000000
--- a/regress/sys/kern/rfork/madness/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.1 2002/02/17 05:58:51 art Exp $
-
-PROG=madness
-
-.include <bsd.regress.mk>
diff --git a/regress/sys/kern/rfork/madness/madness.c b/regress/sys/kern/rfork/madness/madness.c
deleted file mode 100644
index 7b1006bffa5..00000000000
--- a/regress/sys/kern/rfork/madness/madness.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/* $OpenBSD: madness.c,v 1.3 2003/08/02 01:24:36 david Exp $ */
-/*
- * Written by Artur Grabowski <art@openbsd.org>, 2002 Public Domain.
- */
-#include <sys/param.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <err.h>
-
-volatile int step;
-
-int
-main(int argc, char *argv[])
-{
- int fds[2], fd;
- pid_t pid1, pid2, pid3;
-
- if (pipe(fds) < 0)
- err(1, "pipe");
-
- fd = fds[0];
-
- if ((pid1 = rfork(RFPROC|RFMEM|RFFDG|RFNOWAIT)) == 0) {
- char foo[1024];
- step = 1;
- read(fd, foo, sizeof(foo));
- _exit(0);
- }
-
- if ((pid2 = rfork(RFPROC|RFMEM|RFFDG|RFNOWAIT)) == 0) {
- while (step < 1)
- sleep(1);
- sleep(1);
- step = 2;
- close(fd);
- _exit(0);
- }
- if ((pid3 = rfork(RFPROC|RFMEM|RFFDG|RFNOWAIT)) == 0) {
- while (step < 2)
- sleep(1);
- sleep(1);
- step = 3;
- dup2(0, fd);
- _exit(0);
- }
- while (step < 3)
- sleep(1);
- sleep(1);
- kill(pid1, SIGKILL);
- kill(pid2, SIGKILL);
- kill(pid3, SIGKILL);
- return 0;
-}
diff --git a/regress/sys/kern/rfork/rfcfdg/Makefile b/regress/sys/kern/rfork/rfcfdg/Makefile
deleted file mode 100644
index d0fd9ab703b..00000000000
--- a/regress/sys/kern/rfork/rfcfdg/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.1 2002/02/17 05:16:41 art Exp $
-
-PROG=rfcfdg
-
-.include <bsd.regress.mk>
diff --git a/regress/sys/kern/rfork/rfcfdg/rfcfdg.c b/regress/sys/kern/rfork/rfcfdg/rfcfdg.c
deleted file mode 100644
index 95fd6204368..00000000000
--- a/regress/sys/kern/rfork/rfcfdg/rfcfdg.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* $OpenBSD: rfcfdg.c,v 1.3 2003/07/31 21:48:09 deraadt 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 <fcntl.h>
-
-int
-main(int argc, char *argv[])
-{
- int status;
-
- /* Make sure that at least fd 0 is allocated. */
- if (open("/dev/null", O_RDONLY) < 0)
- err(1, "open(/dev/null)");
-
- switch(rfork(RFCFDG|RFPROC)) {
- case -1:
- err(1, "fork");
- case 0:
- if (open("/dev/null", O_RDONLY) != 0)
- _exit(1); /* pretty hard to print to stderr */
- _exit(0);
- }
-
- if (wait(&status) < 0)
- err(1, "wait");
-
- if (!WIFEXITED(status))
- err(1, "child error");
-
- return WEXITSTATUS(status) != 0;
-}
diff --git a/regress/sys/kern/rfork/rfmem-stack/Makefile b/regress/sys/kern/rfork/rfmem-stack/Makefile
deleted file mode 100644
index 491df13bda7..00000000000
--- a/regress/sys/kern/rfork/rfmem-stack/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.1 2002/02/21 21:07:11 art Exp $
-
-PROG=rfmem-stack
-
-.include <bsd.regress.mk>
diff --git a/regress/sys/kern/rfork/rfmem-stack/rfmem-stack.c b/regress/sys/kern/rfork/rfmem-stack/rfmem-stack.c
deleted file mode 100644
index 29dbf7e11b4..00000000000
--- a/regress/sys/kern/rfork/rfmem-stack/rfmem-stack.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* $OpenBSD: rfmem-stack.c,v 1.5 2003/08/02 01:24:37 david Exp $ */
-/*
- * Written by Artur Grabowski <art@openbsd.org>, 2002 Public Domain.
- */
-#include <sys/param.h>
-#include <sys/wait.h>
-#include <sys/mman.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <err.h>
-
-#define MAGIC "inherited"
-
-int
-main(int argc, char *argv[])
-{
- char *map, *map2;
- int status;
-
- map = alloca(sizeof(MAGIC));
- memset(map, 0, sizeof(MAGIC));
-
- map2 = alloca(sizeof(MAGIC));
- memset(map2, 0, sizeof(MAGIC));
-
- switch(rfork(RFFDG|RFPROC|RFMEM)) {
- case -1:
- err(1, "fork");
- case 0:
- memcpy(map, MAGIC, sizeof(MAGIC));
- sleep(1);
- if (memcmp(map2, MAGIC, sizeof(MAGIC)) == 0) {
- write(2, "child stack polluted\n", 21);
- _exit(1);
- }
- _exit(0);
- }
-
- memcpy(map2, MAGIC, sizeof(MAGIC));
-
- if (wait(&status) < 0)
- err(1, "wait");
-
- if (!WIFEXITED(status))
- err(1, "child error");
-
- if (memcmp(map, MAGIC, sizeof(MAGIC)) == 0)
- return 1;
-
- return WEXITSTATUS(status) != 0;
-}
diff --git a/regress/sys/kern/rfork/rfmem/Makefile b/regress/sys/kern/rfork/rfmem/Makefile
deleted file mode 100644
index 3e2df82ce58..00000000000
--- a/regress/sys/kern/rfork/rfmem/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.1 2002/02/17 05:10:40 art Exp $
-
-PROG=rfmem
-
-.include <bsd.regress.mk>
diff --git a/regress/sys/kern/rfork/rfmem/rfmem.c b/regress/sys/kern/rfork/rfmem/rfmem.c
deleted file mode 100644
index 84ae38d1f62..00000000000
--- a/regress/sys/kern/rfork/rfmem/rfmem.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* $OpenBSD: rfmem.c,v 1.4 2003/08/02 01:24:37 david Exp $ */
-/*
- * Written by Artur Grabowski <art@openbsd.org>, 2002 Public Domain.
- */
-#include <sys/param.h>
-#include <sys/wait.h>
-#include <sys/mman.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <err.h>
-#include <unistd.h>
-
-#define MAGIC "inherited"
-
-int
-main(int argc, char *argv[])
-{
- void *map;
- int page_size;
- int status;
-
- page_size = getpagesize();
-
- if ((map = mmap(NULL, page_size, PROT_READ|PROT_WRITE, MAP_ANON,
- -1, 0)) == MAP_FAILED)
- err(1, "mmap");
-
- memset(map, 0, sizeof(MAGIC));
-
- switch(rfork(RFFDG|RFPROC|RFMEM)) {
- case -1:
- err(1, "fork");
- case 0:
- memcpy(map, MAGIC, sizeof(MAGIC));
- _exit(0);
- }
-
- if (wait(&status) < 0)
- err(1, "wait");
-
- if (!WIFEXITED(status))
- err(1, "child error");
-
- if (memcmp(map, MAGIC, sizeof(MAGIC)) != 0)
- return 1;
-
- return WEXITSTATUS(status) != 0;
-}
diff --git a/regress/sys/kern/rfork/rfnowait/Makefile b/regress/sys/kern/rfork/rfnowait/Makefile
deleted file mode 100644
index 7f716a0315f..00000000000
--- a/regress/sys/kern/rfork/rfnowait/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $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
deleted file mode 100644
index 58d2421557d..00000000000
--- a/regress/sys/kern/rfork/rfnowait/rfnowait.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* $OpenBSD: rfnowait.c,v 1.3 2003/07/31 21:48:09 deraadt 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 argc, char *argv[])
-{
- 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;
-}
diff --git a/regress/sys/kern/rfork/rfsharefd/Makefile b/regress/sys/kern/rfork/rfsharefd/Makefile
deleted file mode 100644
index a6246575273..00000000000
--- a/regress/sys/kern/rfork/rfsharefd/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.1 2002/02/17 05:44:07 art Exp $
-
-PROG=rfsharefd
-
-.include <bsd.regress.mk>
diff --git a/regress/sys/kern/rfork/rfsharefd/rfsharefd.c b/regress/sys/kern/rfork/rfsharefd/rfsharefd.c
deleted file mode 100644
index ad7c0a3f331..00000000000
--- a/regress/sys/kern/rfork/rfsharefd/rfsharefd.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* $OpenBSD: rfsharefd.c,v 1.3 2003/07/31 21:48:09 deraadt 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 <fcntl.h>
-
-int
-main(int argc, char *argv[])
-{
- int status;
- int fd;
-
- /* Make sure that at least fd 0 is allocated. */
- if ((fd = open("/dev/null", O_RDONLY)) < 0)
- err(1, "open(/dev/null)");
-
- switch(rfork(RFPROC)) {
- case -1:
- err(1, "fork");
- case 0:
- if (close(fd) < 0)
- _exit(1);
- _exit(0);
- }
-
- if (wait(&status) < 0)
- err(1, "wait");
-
- if (!WIFEXITED(status))
- err(1, "child error");
-
- if (close(fd) == 0)
- errx(1, "fd 0 not closed");
-
- return WEXITSTATUS(status) != 0;
-}