Add -c to control the number of CPUs configured in the kernel.

This commit is contained in:
pooka 2011-01-03 10:44:40 +00:00
parent a5f859dbc3
commit 6fd00c3f62
2 changed files with 23 additions and 7 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: rump_allserver.1,v 1.6 2010/12/15 18:42:59 pooka Exp $
.\" $NetBSD: rump_allserver.1,v 1.7 2011/01/03 10:44:40 pooka Exp $
.\"
.\" Copyright (c) 2010 Antti Kantee. All rights reserved.
.\"
@ -23,7 +23,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd December 14, 2010
.Dd January 3, 2011
.Dt RUMP_SERVER 1
.Os
.Sh NAME
@ -33,6 +33,7 @@
.Sh SYNOPSIS
.Nm
.Op Fl s
.Op Fl c Ar ncpu
.Op Fl d Ar drivespec
.Op Fl l Ar library
.Op Fl m Ar module
@ -60,6 +61,12 @@ system was built.
At execution time it is possible to load components from the command
line as described in the options section.
.Bl -tag -width indent
.It Fl c Ar ncpu
Configure
.Ar ncpu
virtual CPUs on SMP-capable archs.
By default, the number of CPUs equals the number of CPUs on the
host.
.It Fl d Ar drivespec
The argument
.Ar drivespec

View File

@ -1,4 +1,4 @@
/* $NetBSD: rump_allserver.c,v 1.11 2010/12/15 19:07:43 pooka Exp $ */
/* $NetBSD: rump_allserver.c,v 1.12 2011/01/03 10:44:40 pooka Exp $ */
/*-
* Copyright (c) 2010 Antti Kantee. All Rights Reserved.
@ -27,7 +27,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: rump_allserver.c,v 1.11 2010/12/15 19:07:43 pooka Exp $");
__RCSID("$NetBSD: rump_allserver.c,v 1.12 2011/01/03 10:44:40 pooka Exp $");
#endif /* !lint */
#include <sys/types.h>
@ -51,8 +51,8 @@ static void
usage(void)
{
fprintf(stderr, "usage: %s [-s] [-d drivespec] [-l libs] [-m modules] "
"bindurl\n", getprogname());
fprintf(stderr, "usage: %s [-s] [-c ncpu] [-d drivespec] [-l libs] "
"[-m modules] bindurl\n", getprogname());
exit(1);
}
@ -101,12 +101,21 @@ main(int argc, char *argv[])
unsigned netfs = 0, curetfs = 0;
int error;
int ch, sflag;
int ncpu;
setprogname(argv[0]);
sflag = 0;
while ((ch = getopt(argc, argv, "d:l:m:s")) != -1) {
while ((ch = getopt(argc, argv, "c:d:l:m:s")) != -1) {
switch (ch) {
case 'c':
ncpu = atoi(optarg);
/* XXX: MAXCPUS is from host, not from kernel */
if (ncpu < 1 || ncpu > MAXCPUS)
err(1, "CPU count needs to be between "
"1 and %d\n", MAXCPUS);
setenv("RUMP_NCPU", optarg, 1);
break;
case 'd': {
char *options, *value;
char *key, *hostpath;