summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_mib.c
diff options
context:
space:
mode:
authortmm <tmm@FreeBSD.org>2002-11-07 23:57:17 +0000
committertmm <tmm@FreeBSD.org>2002-11-07 23:57:17 +0000
commitf740e3df9bd1ce0fef776b6c9444176d4c64bcaa (patch)
tree4cf885259d3ca54239f82ab003a069f284512d18 /sys/kern/kern_mib.c
parentaae3d5b8b6dbe84cd25f622726f44f46008df89a (diff)
downloadFreeBSD-src-f740e3df9bd1ce0fef776b6c9444176d4c64bcaa.zip
FreeBSD-src-f740e3df9bd1ce0fef776b6c9444176d4c64bcaa.tar.gz
Move the definitions of the hw.physmem, hw.usermem and hw.availpages
sysctls to MI code; this reduces code duplication and makes all of them available on sparc64, and the latter two on powerpc. The semantics by the i386 and pc98 hw.availpages is slightly changed: previously, holes between ranges of available pages would be included, while they are excluded now. The new behaviour should be more correct and brings i386 in line with the other architectures. Move physmem to vm/vm_init.c, where this variable is used in MI code.
Diffstat (limited to 'sys/kern/kern_mib.c')
-rw-r--r--sys/kern/kern_mib.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/sys/kern/kern_mib.c b/sys/kern/kern_mib.c
index 29f6873..dc72629 100644
--- a/sys/kern/kern_mib.c
+++ b/sys/kern/kern_mib.c
@@ -149,6 +149,32 @@ SYSCTL_INT(_hw, HW_BYTEORDER, byteorder, CTLFLAG_RD,
SYSCTL_INT(_hw, HW_PAGESIZE, pagesize, CTLFLAG_RD,
0, PAGE_SIZE, "System memory page size");
+static int
+sysctl_hw_physmem(SYSCTL_HANDLER_ARGS)
+{
+ u_long val;
+
+ val = ctob(physmem);
+ return (sysctl_handle_long(oidp, &val, 0, req));
+}
+
+SYSCTL_PROC(_hw, HW_PHYSMEM, physmem, CTLTYPE_ULONG | CTLFLAG_RD,
+ 0, 0, sysctl_hw_physmem, "LU", "");
+
+static int
+sysctl_hw_usermem(SYSCTL_HANDLER_ARGS)
+{
+ u_long val;
+
+ val = ctob(physmem - cnt.v_wire_count);
+ return (sysctl_handle_long(oidp, &val, 0, req));
+}
+
+SYSCTL_PROC(_hw, HW_USERMEM, usermem, CTLTYPE_ULONG | CTLFLAG_RD,
+ 0, 0, sysctl_hw_usermem, "LU", "");
+
+SYSCTL_ULONG(_hw, OID_AUTO, availpages, CTLFLAG_RD, &physmem, 0, "");
+
static char machine_arch[] = MACHINE_ARCH;
SYSCTL_STRING(_hw, HW_MACHINE_ARCH, machine_arch, CTLFLAG_RD,
machine_arch, 0, "System architecture");
OpenPOWER on IntegriCloud