Remove building with NOCRYPTO option
[minix3.git] / tests / rump / rumpkern / h_server / h_simpleserver.c
blob4e04c2269177b7bdba38df8d7226f7dbdae02224
1 /* $NetBSD: h_simpleserver.c,v 1.3 2011/01/14 13:23:15 pooka Exp $ */
3 #include <sys/types.h>
5 #include <rump/rump.h>
7 #include <err.h>
8 #include <stdio.h>
9 #include <stdlib.h>
10 #include <string.h>
11 #include <unistd.h>
13 #include "../../kernspace/kernspace.h"
15 #define NOFAIL(e) do { int rv = e; if (rv) err(1, #e); } while (/*CONSTCOND*/0)
17 struct {
18 const char *str;
19 void (*dofun)(char *);
20 } actions[] = {
21 { "sendsig", rumptest_sendsig },
24 int
25 main(int argc, char *argv[])
27 unsigned i;
28 bool match;
30 if (argc < 2)
31 exit(1);
33 NOFAIL(rump_daemonize_begin());
34 NOFAIL(rump_init());
35 NOFAIL(rump_init_server(argv[1]));
36 NOFAIL(rump_daemonize_done(RUMP_DAEMONIZE_SUCCESS));
38 if (argc > 2) {
39 char *arg = NULL;
41 if (argc == 4)
42 arg = argv[3];
44 for (i = 0; i < __arraycount(actions); i++) {
45 if (strcmp(actions[i].str, argv[2]) == 0) {
46 rump_schedule();
47 actions[i].dofun(arg);
48 rump_unschedule();
49 match = true;
53 if (!match) {
54 exit(1);
56 pause();
57 } else {
58 for (;;)
59 pause();
62 return 0;