Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/rump_allserver Add -c to control the number of CPUs ...



details:   https://anonhg.NetBSD.org/src/rev/bbc42069ac3e
branches:  trunk
changeset: 760352:bbc42069ac3e
user:      pooka <pooka%NetBSD.org@localhost>
date:      Mon Jan 03 10:44:40 2011 +0000

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

diffstat:

 usr.bin/rump_allserver/rump_allserver.1 |  11 +++++++++--
 usr.bin/rump_allserver/rump_allserver.c |  19 ++++++++++++++-----
 2 files changed, 23 insertions(+), 7 deletions(-)

diffs (91 lines):

diff -r 821f5bdcad0f -r bbc42069ac3e usr.bin/rump_allserver/rump_allserver.1
--- a/usr.bin/rump_allserver/rump_allserver.1   Mon Jan 03 09:39:46 2011 +0000
+++ b/usr.bin/rump_allserver/rump_allserver.1   Mon Jan 03 10:44:40 2011 +0000
@@ -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 @@
 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
diff -r 821f5bdcad0f -r bbc42069ac3e usr.bin/rump_allserver/rump_allserver.c
--- a/usr.bin/rump_allserver/rump_allserver.c   Mon Jan 03 09:39:46 2011 +0000
+++ b/usr.bin/rump_allserver/rump_allserver.c   Mon Jan 03 10:44:40 2011 +0000
@@ -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 @@
 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 @@
        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;



Home | Main Index | Thread Index | Old Index