add error message for vkernel started with vm.vkernel_enable=0

Joe Talbott josepht at cstone.net
Tue Jul 17 19:39:48 PDT 2007


I'd like to add something like the attached patch to the vkernel to
let the user know that vm.vkernel_enable = 0.  I spent quite a while
today chasing down why mmap() was failing before remembering that I
needed to turn vm.vkernel_enable on.

Joe
Index: sys/platform/vkernel/platform/init.c
===================================================================
RCS file: /home/dcvs/src/sys/platform/vkernel/platform/init.c,v
retrieving revision 1.44
diff -u -r1.44 init.c
--- sys/platform/vkernel/platform/init.c	10 Jul 2007 18:35:38 -0000	1.44
+++ sys/platform/vkernel/platform/init.c	18 Jul 2007 01:03:42 -0000
@@ -141,6 +141,8 @@
 	int c;
 	int i;
 	int n;
+	int real_vkernel_enable;
+	size_t real_vkernel_enable_size;
 	
 	save_ac = ac;
 	save_av = av;
@@ -154,6 +156,12 @@
 #endif
 	lwp_cpu_lock = LCL_NONE;
 
+	real_vkernel_enable_size = sizeof(real_vkernel_enable);
+	sysctlbyname("vm.vkernel_enable", &real_vkernel_enable, &real_vkernel_enable_size, NULL, 0);
+	
+	if (real_vkernel_enable == 0)
+		errx(1,"vm.vkernel_enable is %d, must be set to 1 to execute a vkernel!", real_vkernel_enable);
+
 	real_ncpus_size = sizeof(real_ncpus);
 	sysctlbyname("hw.ncpu", &real_ncpus, &real_ncpus_size, NULL, 0);
 




More information about the Kernel mailing list