xref: /minix3/tests/rump/rumpkern/h_client/h_simplecli.c (revision 11be35a165022172ed3cea20f2b5df0307540b0e)
1*11be35a1SLionel Sambuc /*	$NetBSD: h_simplecli.c,v 1.2 2011/01/14 13:23:15 pooka Exp $	*/
2*11be35a1SLionel Sambuc 
3*11be35a1SLionel Sambuc #include <sys/types.h>
4*11be35a1SLionel Sambuc 
5*11be35a1SLionel Sambuc #include <err.h>
6*11be35a1SLionel Sambuc #include <stdlib.h>
7*11be35a1SLionel Sambuc #include <stdio.h>
8*11be35a1SLionel Sambuc #include <unistd.h>
9*11be35a1SLionel Sambuc 
10*11be35a1SLionel Sambuc #include <rump/rump_syscalls.h>
11*11be35a1SLionel Sambuc #include <rump/rumpclient.h>
12*11be35a1SLionel Sambuc 
13*11be35a1SLionel Sambuc int
main(int argc,char * argv[])14*11be35a1SLionel Sambuc main(int argc, char *argv[])
15*11be35a1SLionel Sambuc {
16*11be35a1SLionel Sambuc 
17*11be35a1SLionel Sambuc 	if (rumpclient_init() == -1)
18*11be35a1SLionel Sambuc 		err(1, "rumpclient init");
19*11be35a1SLionel Sambuc 
20*11be35a1SLionel Sambuc 	if (argc > 1) {
21*11be35a1SLionel Sambuc 		for (;;) {
22*11be35a1SLionel Sambuc 			rump_sys_getpid();
23*11be35a1SLionel Sambuc 			usleep(10000);
24*11be35a1SLionel Sambuc 		}
25*11be35a1SLionel Sambuc 	} else {
26*11be35a1SLionel Sambuc 		if (rump_sys_getpid() > 0)
27*11be35a1SLionel Sambuc 			exit(0);
28*11be35a1SLionel Sambuc 		err(1, "getpid");
29*11be35a1SLionel Sambuc 	}
30*11be35a1SLionel Sambuc }
31