summaryrefslogtreecommitdiffstats
path: root/contrib/netbsd-tests/rump/rumpkern/h_server/h_simpleserver.c
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2014-10-02 23:26:49 +0000
committerngie <ngie@FreeBSD.org>2014-10-02 23:26:49 +0000
commit3f09b8d0af642c2aeb96a4d667cefb7fe3bce443 (patch)
tree544932e2a2c5a5a202b752beefba0b3e327b3858 /contrib/netbsd-tests/rump/rumpkern/h_server/h_simpleserver.c
parentb941fec92da62b0eab650295f4e8a381dbbc04b4 (diff)
parente1f2d32c0e0678782c353c48364cddedfae58b0a (diff)
downloadFreeBSD-src-3f09b8d0af642c2aeb96a4d667cefb7fe3bce443.zip
FreeBSD-src-3f09b8d0af642c2aeb96a4d667cefb7fe3bce443.tar.gz
Import the NetBSD test suite from ^/vendor/NetBSD/tests/09.30.2014_20.45 ,
minus the vendor Makefiles Provide directions for how to bootstrap the vendor sources in FREEBSD-upgrade MFC after 2 weeks Discussed with: rpaulo Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'contrib/netbsd-tests/rump/rumpkern/h_server/h_simpleserver.c')
-rw-r--r--contrib/netbsd-tests/rump/rumpkern/h_server/h_simpleserver.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/contrib/netbsd-tests/rump/rumpkern/h_server/h_simpleserver.c b/contrib/netbsd-tests/rump/rumpkern/h_server/h_simpleserver.c
new file mode 100644
index 0000000..4e04c22
--- /dev/null
+++ b/contrib/netbsd-tests/rump/rumpkern/h_server/h_simpleserver.c
@@ -0,0 +1,63 @@
+/* $NetBSD: h_simpleserver.c,v 1.3 2011/01/14 13:23:15 pooka Exp $ */
+
+#include <sys/types.h>
+
+#include <rump/rump.h>
+
+#include <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "../../kernspace/kernspace.h"
+
+#define NOFAIL(e) do { int rv = e; if (rv) err(1, #e); } while (/*CONSTCOND*/0)
+
+struct {
+ const char *str;
+ void (*dofun)(char *);
+} actions[] = {
+ { "sendsig", rumptest_sendsig },
+};
+
+int
+main(int argc, char *argv[])
+{
+ unsigned i;
+ bool match;
+
+ if (argc < 2)
+ exit(1);
+
+ NOFAIL(rump_daemonize_begin());
+ NOFAIL(rump_init());
+ NOFAIL(rump_init_server(argv[1]));
+ NOFAIL(rump_daemonize_done(RUMP_DAEMONIZE_SUCCESS));
+
+ if (argc > 2) {
+ char *arg = NULL;
+
+ if (argc == 4)
+ arg = argv[3];
+
+ for (i = 0; i < __arraycount(actions); i++) {
+ if (strcmp(actions[i].str, argv[2]) == 0) {
+ rump_schedule();
+ actions[i].dofun(arg);
+ rump_unschedule();
+ match = true;
+ }
+ }
+
+ if (!match) {
+ exit(1);
+ }
+ pause();
+ } else {
+ for (;;)
+ pause();
+ }
+
+ return 0;
+}
OpenPOWER on IntegriCloud