Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Mar 2019 19:53:15 +0000 (UTC)
From:      Ravi Pokala <rpokala@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r345457 - in head: lib/libc/gen sys/kern
Message-ID:  <201903231953.x2NJrFNc088946@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rpokala
Date: Sat Mar 23 19:53:15 2019
New Revision: 345457
URL: https://svnweb.freebsd.org/changeset/base/345457

Log:
  Add descriptions for sysctls in kern_mib.c and sysctl.3 which lack them.
  
  r343532 noted the difference between "hw.realmem" and "hw.physmem", which I
  was previously unaware of. I discovered that neither sysctl had a
  description visible via `sysctl -d', so I found where they were defined and
  added suitable descriptions. While in the file, I went ahead and added
  descriptions for all the others which lacked them. I also updated sysctl.3
  accordingly
  
  Reviewed by:	kib, bcr
  MFC after:	1 weeks
  Sponsored by:	Panasas
  Differential Revision:	https://reviews.freebsd.org/D19007

Modified:
  head/lib/libc/gen/sysctl.3
  head/sys/kern/kern_mib.c

Modified: head/lib/libc/gen/sysctl.3
==============================================================================
--- head/lib/libc/gen/sysctl.3	Sat Mar 23 18:32:28 2019	(r345456)
+++ head/lib/libc/gen/sysctl.3	Sat Mar 23 19:53:15 2019	(r345457)
@@ -28,7 +28,7 @@
 .\"	@(#)sysctl.3	8.4 (Berkeley) 5/9/95
 .\" $FreeBSD$
 .\"
-.Dd October 22, 2017
+.Dd March 22, 2019
 .Dt SYSCTL 3
 .Os
 .Sh NAME
@@ -284,6 +284,7 @@ privilege may change the value.
 .It Dv HW_FLOATINGPT Ta integer Ta no
 .It Dv HW_MACHINE_ARCH Ta string Ta no
 .It Dv HW_REALMEM Ta integer Ta no
+.It Dv HW_AVAILPAGES Ta integer Ta no
 .El
 .Bl -tag -width 6n
 .It Li HW_MACHINE
@@ -295,9 +296,10 @@ The number of cpus.
 .It Li HW_BYTEORDER
 The byteorder (4321 or 1234).
 .It Li HW_PHYSMEM
-The bytes of physical memory.
+Amount of physical memory (in bytes), minus the amount used by the kernel,
+pre-loaded modules, and (on x86) the dcons buffer.
 .It Li HW_USERMEM
-The bytes of non-kernel memory.
+Amount of memory (in bytes) which is not wired.
 .It Li HW_PAGESIZE
 The software page size.
 .\".It Fa HW_DISKNAMES
@@ -307,7 +309,13 @@ Nonzero if the floating point support is in hardware.
 .It Li HW_MACHINE_ARCH
 The machine dependent architecture type.
 .It Li HW_REALMEM
-The bytes of real memory.
+Amount of memory (in bytes) reported by the firmware.
+That value is sometimes not sane; in that case, the kernel reports the max
+memory address instead.
+.It Li HW_AVAILPAGES
+The same value as
+.Li HW_PHYSMEM ,
+measured in pages rather than bytes.
 .El
 .Ss CTL_KERN
 The string and integer information available for the CTL_KERN level

Modified: head/sys/kern/kern_mib.c
==============================================================================
--- head/sys/kern/kern_mib.c	Sat Mar 23 18:32:28 2019	(r345456)
+++ head/sys/kern/kern_mib.c	Sat Mar 23 19:53:15 2019	(r345457)
@@ -187,7 +187,8 @@ sysctl_hw_physmem(SYSCTL_HANDLER_ARGS)
 	return (sysctl_handle_long(oidp, &val, 0, req));
 }
 SYSCTL_PROC(_hw, HW_PHYSMEM, physmem, CTLTYPE_ULONG | CTLFLAG_RD,
-    0, 0, sysctl_hw_physmem, "LU", "");
+    0, 0, sysctl_hw_physmem, "LU",
+    "Amount of physical memory (in bytes)");
 
 static int
 sysctl_hw_realmem(SYSCTL_HANDLER_ARGS)
@@ -201,7 +202,8 @@ sysctl_hw_realmem(SYSCTL_HANDLER_ARGS)
 	return (sysctl_handle_long(oidp, &val, 0, req));
 }
 SYSCTL_PROC(_hw, HW_REALMEM, realmem, CTLTYPE_ULONG | CTLFLAG_RD,
-    0, 0, sysctl_hw_realmem, "LU", "");
+    0, 0, sysctl_hw_realmem, "LU",
+    "Amount of memory (in bytes) reported by the firmware");
 
 static int
 sysctl_hw_usermem(SYSCTL_HANDLER_ARGS)
@@ -216,9 +218,11 @@ sysctl_hw_usermem(SYSCTL_HANDLER_ARGS)
 	return (sysctl_handle_long(oidp, &val, 0, req));
 }
 SYSCTL_PROC(_hw, HW_USERMEM, usermem, CTLTYPE_ULONG | CTLFLAG_RD,
-    0, 0, sysctl_hw_usermem, "LU", "");
+    0, 0, sysctl_hw_usermem, "LU",
+    "Amount of memory (in bytes) which is not wired");
 
-SYSCTL_LONG(_hw, OID_AUTO, availpages, CTLFLAG_RD, &physmem, 0, "");
+SYSCTL_LONG(_hw, OID_AUTO, availpages, CTLFLAG_RD, &physmem, 0,
+    "Amount of physical memory (in pages)");
 
 u_long pagesizes[MAXPAGESIZES] = { PAGE_SIZE };
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201903231953.x2NJrFNc088946>