Module Name:    src
Committed By:   pooka
Date:           Wed Apr 28 11:34:18 UTC 2010

Modified Files:
        src/sys/rump/librump/rumpkern: rump.c

Log Message:
If RUMP_NCPU is set, use that for virtual CPU count instead of
host CPU count.


To generate a diff of this commit:
cvs rdiff -u -r1.166 -r1.167 src/sys/rump/librump/rumpkern/rump.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/rump/librump/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.166 src/sys/rump/librump/rumpkern/rump.c:1.167
--- src/sys/rump/librump/rumpkern/rump.c:1.166	Wed Apr 28 00:43:16 2010
+++ src/sys/rump/librump/rumpkern/rump.c	Wed Apr 28 11:34:18 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.166 2010/04/28 00:43:16 pooka Exp $	*/
+/*	$NetBSD: rump.c,v 1.167 2010/04/28 11:34:18 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.166 2010/04/28 00:43:16 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.167 2010/04/28 11:34:18 pooka Exp $");
 
 #include <sys/systm.h>
 #define ELFSIZE ARCH_ELFSIZE
@@ -219,10 +219,20 @@
 			boothowto = AB_VERBOSE;
 	}
 
+	if (rumpuser_getenv("RUMP_NCPU", buf, sizeof(buf), &error) == 0)
+		error = 0;
 	/* non-x86 is missing CPU_INFO_FOREACH() support */
 #if defined(__i386__) || defined(__x86_64__)
-	numcpu = rumpuser_getnhostcpu();
+	if (error == 0) {
+		numcpu = strtoll(buf, NULL, 10);
+		if (numcpu < 1)
+			numcpu = 1;
+	} else {
+		numcpu = rumpuser_getnhostcpu();
+	}
 #else
+	if (error == 0)
+		printf("NCPU limited to 1 on this host\n");
 	numcpu = 1;
 #endif
 	rump_cpus_bootstrap(numcpu);

Reply via email to