Home | History | Annotate | Line # | Download | only in rump_allserver
rump_allserver.c revision 1.13.2.2
      1  1.13.2.2  bouyer /*	$NetBSD: rump_allserver.c,v 1.13.2.2 2011/03/05 15:11:00 bouyer Exp $	*/
      2       1.1   pooka 
      3       1.1   pooka /*-
      4  1.13.2.1  bouyer  * Copyright (c) 2010, 2011 Antti Kantee.  All Rights Reserved.
      5       1.1   pooka  *
      6       1.1   pooka  * Redistribution and use in source and binary forms, with or without
      7       1.1   pooka  * modification, are permitted provided that the following conditions
      8       1.1   pooka  * are met:
      9       1.1   pooka  * 1. Redistributions of source code must retain the above copyright
     10       1.1   pooka  *    notice, this list of conditions and the following disclaimer.
     11       1.1   pooka  * 2. Redistributions in binary form must reproduce the above copyright
     12       1.1   pooka  *    notice, this list of conditions and the following disclaimer in the
     13       1.1   pooka  *    documentation and/or other materials provided with the distribution.
     14       1.1   pooka  *
     15       1.1   pooka  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
     16       1.1   pooka  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     17       1.1   pooka  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
     18       1.1   pooka  * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
     19       1.1   pooka  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     20       1.1   pooka  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
     21       1.1   pooka  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     22       1.1   pooka  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     23       1.1   pooka  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     24       1.1   pooka  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     25       1.1   pooka  * SUCH DAMAGE.
     26       1.1   pooka  */
     27       1.1   pooka 
     28       1.1   pooka #include <sys/cdefs.h>
     29       1.1   pooka #ifndef lint
     30  1.13.2.2  bouyer __RCSID("$NetBSD: rump_allserver.c,v 1.13.2.2 2011/03/05 15:11:00 bouyer Exp $");
     31       1.1   pooka #endif /* !lint */
     32       1.1   pooka 
     33       1.1   pooka #include <sys/types.h>
     34  1.13.2.1  bouyer #include <sys/disklabel.h>
     35       1.4   pooka #include <sys/signal.h>
     36       1.7   pooka #include <sys/module.h>
     37       1.1   pooka 
     38       1.1   pooka #include <rump/rump.h>
     39       1.4   pooka #include <rump/rump_syscalls.h>
     40       1.1   pooka 
     41       1.6   pooka #include <dlfcn.h>
     42       1.1   pooka #include <err.h>
     43       1.1   pooka #include <errno.h>
     44       1.9   pooka #include <fcntl.h>
     45       1.4   pooka #include <semaphore.h>
     46       1.1   pooka #include <stdio.h>
     47       1.1   pooka #include <stdlib.h>
     48       1.1   pooka #include <string.h>
     49       1.1   pooka #include <unistd.h>
     50  1.13.2.1  bouyer #include <util.h>
     51       1.1   pooka 
     52       1.1   pooka static void
     53       1.1   pooka usage(void)
     54       1.1   pooka {
     55       1.1   pooka 
     56      1.13     wiz 	fprintf(stderr, "usage: %s [-s] [-c ncpu] [-d drivespec] [-l libs] "
     57      1.12   pooka 	    "[-m modules] bindurl\n", getprogname());
     58       1.1   pooka 	exit(1);
     59       1.1   pooka }
     60       1.1   pooka 
     61       1.2   pooka static void
     62       1.2   pooka die(int sflag, int error, const char *reason)
     63       1.2   pooka {
     64       1.2   pooka 
     65       1.2   pooka 	warnx("%s: %s", reason, strerror(error));
     66       1.2   pooka 	if (!sflag)
     67       1.2   pooka 		rump_daemonize_done(error);
     68       1.2   pooka 	exit(1);
     69       1.2   pooka }
     70       1.2   pooka 
     71       1.4   pooka static sem_t sigsem;
     72       1.4   pooka static void
     73       1.4   pooka sigreboot(int sig)
     74       1.4   pooka {
     75       1.4   pooka 
     76       1.4   pooka 	sem_post(&sigsem);
     77       1.4   pooka }
     78       1.4   pooka 
     79       1.9   pooka static const char *const disktokens[] = {
     80       1.9   pooka #define DKEY 0
     81       1.9   pooka 	"key",
     82       1.9   pooka #define DFILE 1
     83       1.9   pooka 	"hostpath",
     84       1.9   pooka #define DSIZE 2
     85  1.13.2.2  bouyer #define DSIZE_E -1
     86       1.9   pooka 	"size",
     87  1.13.2.1  bouyer #define DOFFSET 3
     88  1.13.2.1  bouyer 	"offset",
     89  1.13.2.1  bouyer #define DLABEL 4
     90  1.13.2.1  bouyer 	"disklabel",
     91  1.13.2.2  bouyer #define DTYPE 5
     92  1.13.2.2  bouyer 	"type",
     93       1.9   pooka 	NULL
     94       1.9   pooka };
     95       1.9   pooka 
     96       1.9   pooka struct etfsreg {
     97       1.9   pooka 	const char *key;
     98       1.9   pooka 	const char *hostpath;
     99       1.9   pooka 	off_t flen;
    100  1.13.2.1  bouyer 	off_t foffset;
    101  1.13.2.1  bouyer 	char partition;
    102       1.9   pooka 	enum rump_etfs_type type;
    103       1.9   pooka };
    104       1.9   pooka 
    105  1.13.2.2  bouyer struct etfstype {
    106  1.13.2.2  bouyer 	const char *name;
    107  1.13.2.2  bouyer 	enum rump_etfs_type type;
    108  1.13.2.2  bouyer } etfstypes[] = {
    109  1.13.2.2  bouyer 	{ "blk", RUMP_ETFS_BLK },
    110  1.13.2.2  bouyer 	{ "chr", RUMP_ETFS_CHR },
    111  1.13.2.2  bouyer 	{ "reg", RUMP_ETFS_REG },
    112  1.13.2.2  bouyer };
    113  1.13.2.2  bouyer 
    114       1.1   pooka int
    115       1.1   pooka main(int argc, char *argv[])
    116       1.1   pooka {
    117       1.2   pooka 	const char *serverurl;
    118       1.7   pooka 	char **modarray = NULL;
    119       1.7   pooka 	unsigned nmods = 0, curmod = 0, i;
    120       1.9   pooka 	struct etfsreg *etfs = NULL;
    121       1.9   pooka 	unsigned netfs = 0, curetfs = 0;
    122       1.1   pooka 	int error;
    123       1.2   pooka 	int ch, sflag;
    124      1.12   pooka 	int ncpu;
    125       1.1   pooka 
    126       1.1   pooka 	setprogname(argv[0]);
    127       1.1   pooka 
    128       1.2   pooka 	sflag = 0;
    129  1.13.2.2  bouyer 	while ((ch = getopt(argc, argv, "c:d:l:m:r:sv")) != -1) {
    130       1.2   pooka 		switch (ch) {
    131      1.12   pooka 		case 'c':
    132      1.12   pooka 			ncpu = atoi(optarg);
    133      1.12   pooka 			/* XXX: MAXCPUS is from host, not from kernel */
    134      1.12   pooka 			if (ncpu < 1 || ncpu > MAXCPUS)
    135      1.12   pooka 				err(1, "CPU count needs to be between "
    136      1.12   pooka 				    "1 and %d\n", MAXCPUS);
    137      1.12   pooka 			setenv("RUMP_NCPU", optarg, 1);
    138      1.12   pooka 			break;
    139       1.9   pooka 		case 'd': {
    140       1.9   pooka 			char *options, *value;
    141       1.9   pooka 			char *key, *hostpath;
    142  1.13.2.1  bouyer 			long long flen, foffset;
    143  1.13.2.1  bouyer 			char partition;
    144  1.13.2.2  bouyer 			int ftype;
    145       1.9   pooka 
    146  1.13.2.1  bouyer 			flen = foffset = 0;
    147  1.13.2.1  bouyer 			partition = 0;
    148       1.9   pooka 			key = hostpath = NULL;
    149  1.13.2.2  bouyer 			ftype = -1;
    150       1.9   pooka 			options = optarg;
    151       1.9   pooka 			while (*options) {
    152       1.9   pooka 				switch (getsubopt(&options,
    153       1.9   pooka 				    __UNCONST(disktokens), &value)) {
    154       1.9   pooka 				case DKEY:
    155      1.11   pooka 					if (key != NULL) {
    156      1.11   pooka 						fprintf(stderr,
    157      1.11   pooka 						    "key already given\n");
    158      1.11   pooka 						usage();
    159      1.11   pooka 					}
    160       1.9   pooka 					key = value;
    161       1.9   pooka 					break;
    162  1.13.2.1  bouyer 
    163       1.9   pooka 				case DFILE:
    164      1.11   pooka 					if (hostpath != NULL) {
    165      1.11   pooka 						fprintf(stderr,
    166      1.11   pooka 						    "hostpath already given\n");
    167      1.11   pooka 						usage();
    168      1.11   pooka 					}
    169       1.9   pooka 					hostpath = value;
    170       1.9   pooka 					break;
    171  1.13.2.1  bouyer 
    172       1.9   pooka 				case DSIZE:
    173      1.11   pooka 					if (flen != 0) {
    174      1.11   pooka 						fprintf(stderr,
    175      1.11   pooka 						    "size already given\n");
    176      1.11   pooka 						usage();
    177      1.11   pooka 					}
    178  1.13.2.2  bouyer 					if (strcmp(value, "host") == 0) {
    179  1.13.2.2  bouyer 						if (foffset != 0) {
    180  1.13.2.2  bouyer 							fprintf(stderr,
    181  1.13.2.2  bouyer 							    "cannot specify "
    182  1.13.2.2  bouyer 							    "offset with "
    183  1.13.2.2  bouyer 							    "size=host\n");
    184  1.13.2.2  bouyer 							usage();
    185  1.13.2.2  bouyer 						}
    186  1.13.2.2  bouyer 						flen = DSIZE_E;
    187  1.13.2.2  bouyer 					} else {
    188  1.13.2.2  bouyer 						/* XXX: off_t max? */
    189  1.13.2.2  bouyer 						flen = strsuftoll("-d size",
    190  1.13.2.2  bouyer 						    value, 0, LLONG_MAX);
    191  1.13.2.2  bouyer 					}
    192       1.9   pooka 					break;
    193  1.13.2.1  bouyer 				case DOFFSET:
    194  1.13.2.1  bouyer 					if (foffset != 0) {
    195  1.13.2.1  bouyer 						fprintf(stderr,
    196  1.13.2.1  bouyer 						    "offset already given\n");
    197  1.13.2.1  bouyer 						usage();
    198  1.13.2.1  bouyer 					}
    199  1.13.2.2  bouyer 					if (flen == DSIZE_E) {
    200  1.13.2.2  bouyer 						fprintf(stderr, "cannot "
    201  1.13.2.2  bouyer 						    "specify offset with "
    202  1.13.2.2  bouyer 						    "size=host\n");
    203  1.13.2.2  bouyer 						usage();
    204  1.13.2.2  bouyer 					}
    205  1.13.2.1  bouyer 					/* XXX: off_t max? */
    206  1.13.2.1  bouyer 					foffset = strsuftoll("-d offset", value,
    207  1.13.2.1  bouyer 					    0, LLONG_MAX);
    208  1.13.2.1  bouyer 					break;
    209  1.13.2.1  bouyer 
    210  1.13.2.1  bouyer 				case DLABEL:
    211  1.13.2.1  bouyer 					if (foffset != 0 || flen != 0) {
    212  1.13.2.1  bouyer 						fprintf(stderr,
    213  1.13.2.1  bouyer 						    "disklabel needs to be "
    214  1.13.2.1  bouyer 						    "used alone\n");
    215  1.13.2.1  bouyer 						usage();
    216  1.13.2.1  bouyer 					}
    217  1.13.2.1  bouyer 					if (strlen(value) != 1 ||
    218  1.13.2.1  bouyer 					    *value < 'a' || *value > 'z') {
    219  1.13.2.1  bouyer 						fprintf(stderr,
    220  1.13.2.1  bouyer 						    "invalid label part\n");
    221  1.13.2.1  bouyer 						usage();
    222  1.13.2.1  bouyer 					}
    223  1.13.2.1  bouyer 					partition = *value;
    224  1.13.2.1  bouyer 					break;
    225  1.13.2.1  bouyer 
    226  1.13.2.2  bouyer 				case DTYPE:
    227  1.13.2.2  bouyer 					if (ftype != -1) {
    228  1.13.2.2  bouyer 						fprintf(stderr,
    229  1.13.2.2  bouyer 						    "type already specified\n");
    230  1.13.2.2  bouyer 						usage();
    231  1.13.2.2  bouyer 					}
    232  1.13.2.2  bouyer 
    233  1.13.2.2  bouyer 					for (i = 0;
    234  1.13.2.2  bouyer 					    i < __arraycount(etfstypes);
    235  1.13.2.2  bouyer 					    i++) {
    236  1.13.2.2  bouyer 						if (strcmp(etfstypes[i].name,
    237  1.13.2.2  bouyer 						    value) == 0)
    238  1.13.2.2  bouyer 							break;
    239  1.13.2.2  bouyer 					}
    240  1.13.2.2  bouyer 					if (i == __arraycount(etfstypes)) {
    241  1.13.2.2  bouyer 						fprintf(stderr,
    242  1.13.2.2  bouyer 						    "invalid type %s\n", value);
    243  1.13.2.2  bouyer 						usage();
    244  1.13.2.2  bouyer 					}
    245  1.13.2.2  bouyer 					ftype = etfstypes[i].type;
    246  1.13.2.2  bouyer 					break;
    247  1.13.2.2  bouyer 
    248       1.9   pooka 				default:
    249       1.9   pooka 					fprintf(stderr, "invalid dtoken\n");
    250       1.9   pooka 					usage();
    251       1.9   pooka 					break;
    252       1.9   pooka 				}
    253       1.9   pooka 			}
    254       1.9   pooka 
    255  1.13.2.1  bouyer 			if (key == NULL || hostpath == NULL ||
    256  1.13.2.1  bouyer 			    (flen == 0 && partition == 0)) {
    257       1.9   pooka 				fprintf(stderr, "incomplete drivespec\n");
    258       1.9   pooka 				usage();
    259       1.9   pooka 			}
    260  1.13.2.2  bouyer 			if (ftype == -1)
    261  1.13.2.2  bouyer 				ftype = RUMP_ETFS_BLK;
    262       1.9   pooka 
    263       1.9   pooka 			if (netfs - curetfs == 0) {
    264       1.9   pooka 				etfs = realloc(etfs, (netfs+16)*sizeof(*etfs));
    265       1.9   pooka 				if (etfs == NULL)
    266       1.9   pooka 					err(1, "realloc etfs");
    267       1.9   pooka 				netfs += 16;
    268       1.9   pooka 			}
    269       1.9   pooka 
    270       1.9   pooka 			etfs[curetfs].key = key;
    271       1.9   pooka 			etfs[curetfs].hostpath = hostpath;
    272       1.9   pooka 			etfs[curetfs].flen = flen;
    273  1.13.2.1  bouyer 			etfs[curetfs].foffset = foffset;
    274  1.13.2.1  bouyer 			etfs[curetfs].partition = partition;
    275  1.13.2.2  bouyer 			etfs[curetfs].type = ftype;
    276       1.9   pooka 			curetfs++;
    277       1.9   pooka 
    278       1.9   pooka 			break;
    279       1.9   pooka 		}
    280       1.6   pooka 		case 'l':
    281       1.8   pooka 			if (dlopen(optarg, RTLD_LAZY|RTLD_GLOBAL) == NULL) {
    282       1.8   pooka 				char pb[MAXPATHLEN];
    283       1.8   pooka 				/* try to mimic linker -l syntax */
    284       1.8   pooka 
    285       1.8   pooka 				snprintf(pb, sizeof(pb), "lib%s.so", optarg);
    286       1.8   pooka 				if (dlopen(pb, RTLD_LAZY|RTLD_GLOBAL) == NULL) {
    287       1.8   pooka 					errx(1, "dlopen %s failed: %s",
    288       1.8   pooka 					    pb, dlerror());
    289       1.8   pooka 				}
    290       1.8   pooka 			}
    291       1.6   pooka 			break;
    292       1.7   pooka 		case 'm':
    293       1.7   pooka 			if (nmods - curmod == 0) {
    294       1.7   pooka 				modarray = realloc(modarray,
    295       1.7   pooka 				    (nmods+16) * sizeof(char *));
    296       1.7   pooka 				if (modarray == NULL)
    297       1.7   pooka 					err(1, "realloc");
    298       1.7   pooka 				nmods += 16;
    299       1.7   pooka 			}
    300       1.7   pooka 			modarray[curmod++] = optarg;
    301       1.7   pooka 			break;
    302  1.13.2.2  bouyer 		case 'r':
    303  1.13.2.2  bouyer 			setenv("RUMP_MEMLIMIT", optarg, 1);
    304  1.13.2.2  bouyer 			break;
    305       1.2   pooka 		case 's':
    306       1.2   pooka 			sflag = 1;
    307       1.2   pooka 			break;
    308  1.13.2.2  bouyer 		case 'v':
    309  1.13.2.2  bouyer 			setenv("RUMP_VERBOSE", "1", 1);
    310  1.13.2.2  bouyer 			break;
    311       1.2   pooka 		default:
    312       1.2   pooka 			usage();
    313       1.2   pooka 			/*NOTREACHED*/
    314       1.2   pooka 		}
    315       1.2   pooka 	}
    316       1.2   pooka 
    317       1.2   pooka 	argc -= optind;
    318       1.2   pooka 	argv += optind;
    319       1.2   pooka 
    320       1.2   pooka 	if (argc != 1)
    321       1.1   pooka 		usage();
    322       1.1   pooka 
    323       1.2   pooka 	serverurl = argv[0];
    324       1.2   pooka 
    325       1.2   pooka 	if (!sflag) {
    326       1.2   pooka 		error = rump_daemonize_begin();
    327       1.2   pooka 		if (error)
    328       1.2   pooka 			errx(1, "rump daemonize: %s", strerror(error));
    329       1.2   pooka 	}
    330       1.2   pooka 
    331       1.1   pooka 	error = rump_init();
    332       1.1   pooka 	if (error)
    333       1.2   pooka 		die(sflag, error, "rump init failed");
    334       1.7   pooka 
    335       1.9   pooka 	/* load modules */
    336       1.7   pooka 	for (i = 0; i < curmod; i++) {
    337       1.7   pooka 		struct modctl_load ml;
    338       1.7   pooka 
    339       1.7   pooka #define ETFSKEY "/module.mod"
    340       1.7   pooka 		if ((error = rump_pub_etfs_register(ETFSKEY,
    341       1.7   pooka 		    modarray[0], RUMP_ETFS_REG)) != 0)
    342       1.7   pooka 			die(sflag, error, "module etfs register failed");
    343       1.7   pooka 		memset(&ml, 0, sizeof(ml));
    344       1.7   pooka 		ml.ml_filename = ETFSKEY;
    345       1.7   pooka 		if (rump_sys_modctl(MODCTL_LOAD, &ml) == -1)
    346       1.7   pooka 			die(sflag, errno, "module load failed");
    347       1.7   pooka 		rump_pub_etfs_remove(ETFSKEY);
    348       1.9   pooka #undef ETFSKEY
    349       1.9   pooka 	}
    350       1.9   pooka 
    351       1.9   pooka 	/* register host drives */
    352       1.9   pooka 	for (i = 0; i < curetfs; i++) {
    353  1.13.2.1  bouyer 		char buf[1<<16];
    354  1.13.2.1  bouyer 		struct disklabel dl;
    355  1.13.2.1  bouyer 		struct stat sb;
    356  1.13.2.1  bouyer 		off_t foffset, flen, fendoff;
    357  1.13.2.2  bouyer 		int fd, oflags;
    358       1.9   pooka 
    359  1.13.2.2  bouyer 		oflags = etfs[i].flen == DSIZE_E ? 0 : O_CREAT;
    360  1.13.2.2  bouyer 		fd = open(etfs[i].hostpath, O_RDWR | oflags, 0644);
    361       1.9   pooka 		if (fd == -1)
    362  1.13.2.2  bouyer 			die(sflag, errno, "etfs hostpath open");
    363  1.13.2.1  bouyer 
    364  1.13.2.1  bouyer 		if (etfs[i].partition) {
    365  1.13.2.1  bouyer 			int partition = etfs[i].partition - 'a';
    366  1.13.2.1  bouyer 
    367  1.13.2.1  bouyer 			pread(fd, buf, sizeof(buf), 0);
    368  1.13.2.1  bouyer 			if (disklabel_scan(&dl, buf, sizeof(buf)))
    369  1.13.2.1  bouyer 				die(sflag, ENOENT, "disklabel not found");
    370  1.13.2.1  bouyer 
    371  1.13.2.1  bouyer 			if (partition >= dl.d_npartitions)
    372  1.13.2.1  bouyer 				die(sflag, ENOENT, "partition not available");
    373  1.13.2.1  bouyer 
    374  1.13.2.1  bouyer 			foffset = dl.d_partitions[partition].p_offset
    375  1.13.2.1  bouyer 			    << DEV_BSHIFT;
    376  1.13.2.1  bouyer 			flen = dl.d_partitions[partition].p_size
    377  1.13.2.1  bouyer 			    << DEV_BSHIFT;
    378  1.13.2.1  bouyer 		} else {
    379  1.13.2.1  bouyer 			foffset = etfs[i].foffset;
    380  1.13.2.1  bouyer 			flen = etfs[i].flen;
    381  1.13.2.1  bouyer 		}
    382  1.13.2.1  bouyer 
    383  1.13.2.1  bouyer 		if (fstat(fd, &sb) == -1)
    384  1.13.2.1  bouyer 			die(sflag, errno, "fstat etfs hostpath");
    385  1.13.2.2  bouyer 		if (flen == DSIZE_E) {
    386  1.13.2.2  bouyer 			if (sb.st_size == 0)
    387  1.13.2.2  bouyer 				die(sflag, EINVAL, "size=host, but cannot "
    388  1.13.2.2  bouyer 				    "query non-zero size");
    389  1.13.2.2  bouyer 			flen = sb.st_size;
    390  1.13.2.2  bouyer 		}
    391  1.13.2.2  bouyer 		fendoff = foffset + flen;
    392  1.13.2.1  bouyer 		if (S_ISREG(sb.st_mode) && sb.st_size < fendoff) {
    393  1.13.2.1  bouyer 			if (ftruncate(fd, fendoff) == -1)
    394  1.13.2.1  bouyer 				die(sflag, errno, "truncate");
    395  1.13.2.1  bouyer 		}
    396       1.9   pooka 		close(fd);
    397       1.9   pooka 
    398  1.13.2.1  bouyer 		if ((error = rump_pub_etfs_register_withsize(etfs[i].key,
    399  1.13.2.1  bouyer 		    etfs[i].hostpath, etfs[i].type, foffset, flen)) != 0)
    400       1.9   pooka 			die(sflag, error, "etfs register");
    401       1.7   pooka 	}
    402       1.7   pooka 
    403       1.2   pooka 	error = rump_init_server(serverurl);
    404       1.1   pooka 	if (error)
    405       1.2   pooka 		die(sflag, error, "rump server init failed");
    406       1.2   pooka 
    407       1.2   pooka 	if (!sflag)
    408       1.3   pooka 		rump_daemonize_done(RUMP_DAEMONIZE_SUCCESS);
    409       1.2   pooka 
    410       1.4   pooka 	sem_init(&sigsem, 0, 0);
    411       1.4   pooka 	signal(SIGTERM, sigreboot);
    412       1.4   pooka 	signal(SIGINT, sigreboot);
    413       1.4   pooka 	sem_wait(&sigsem);
    414       1.4   pooka 
    415       1.4   pooka 	rump_sys_reboot(0, NULL);
    416       1.5   pooka 	/*NOTREACHED*/
    417       1.5   pooka 
    418       1.4   pooka 	return 0;
    419       1.1   pooka }
    420