Subject: Sysctl types for vm.bufmem* are wrong
To: None <tech-kern@NetBSD.org>
From: Martin Husemann <martin@duskware.de>
List: tech-kern
Date: 10/17/2007 12:50:52
--qDbXVdCdHGoSgWSk
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi folks,

the attached patch is the easy fix for an obvious type mismatch
(on archs where int != long).

But I don't know

 - if we would like to keep ABI here (and introduce vm.bufmem64 and
   friends)
 - if we better keep those vars u_long and just add special sysctl
   node handlers for them

Martin

--qDbXVdCdHGoSgWSk
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=patch

Index: vfs_bio.c
===================================================================
RCS file: /cvsroot/src/sys/kern/vfs_bio.c,v
retrieving revision 1.179
diff -u -p -r1.179 vfs_bio.c
--- vfs_bio.c	8 Oct 2007 18:04:05 -0000	1.179
+++ vfs_bio.c	17 Oct 2007 10:44:38 -0000
@@ -231,10 +231,10 @@ static struct pool_allocator bufmempool_
 };
 
 /* Buffer memory management variables */
-u_long bufmem_valimit;
-u_long bufmem_hiwater;
-u_long bufmem_lowater;
-u_long bufmem;
+u_quad_t bufmem_valimit;
+u_quad_t bufmem_hiwater;
+u_quad_t bufmem_lowater;
+u_quad_t bufmem;
 
 /*
  * MD code can call this to set a hard limit on the amount
@@ -1672,21 +1672,21 @@ SYSCTL_SETUP(sysctl_vm_buf_setup, "sysct
 		       CTL_VM, CTL_CREATE, CTL_EOL);
 	sysctl_createv(clog, 0, NULL, NULL,
 		       CTLFLAG_PERMANENT|CTLFLAG_READONLY,
-		       CTLTYPE_INT, "bufmem",
+		       CTLTYPE_QUAD, "bufmem",
 		       SYSCTL_DESCR("Amount of kernel memory used by buffer "
 				    "cache"),
 		       NULL, 0, &bufmem, 0,
 		       CTL_VM, CTL_CREATE, CTL_EOL);
 	sysctl_createv(clog, 0, NULL, NULL,
 		       CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
-		       CTLTYPE_INT, "bufmem_lowater",
+		       CTLTYPE_QUAD, "bufmem_lowater",
 		       SYSCTL_DESCR("Minimum amount of kernel memory to "
 				    "reserve for buffer cache"),
 		       sysctl_bufvm_update, 0, &bufmem_lowater, 0,
 		       CTL_VM, CTL_CREATE, CTL_EOL);
 	sysctl_createv(clog, 0, NULL, NULL,
 		       CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
-		       CTLTYPE_INT, "bufmem_hiwater",
+		       CTLTYPE_QUAD, "bufmem_hiwater",
 		       SYSCTL_DESCR("Maximum amount of kernel memory to use "
 				    "for buffer cache"),
 		       sysctl_bufvm_update, 0, &bufmem_hiwater, 0,

--qDbXVdCdHGoSgWSk--