Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 03 Sep 2019 14:06:29 -0000
From:      Ravi Pokala <rpokala@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r345826 - in stable/12: lib/libc/gen sys/kern
Message-ID:  <201904030330.x333UFK8019250@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rpokala
Date: Wed Apr  3 03:30:14 2019
New Revision: 345826
URL: https://svnweb.freebsd.org/changeset/base/345826

Log:
  MFC r345457:
  
  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.

Modified:
  stable/12/lib/libc/gen/sysctl.3
  stable/12/sys/kern/kern_mib.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libc/gen/sysctl.3
==============================================================================
--- stable/12/lib/libc/gen/sysctl.3	Wed Apr  3 03:23:45 2019	(r345825)
+++ stable/12/lib/libc/gen/sysctl.3	Wed Apr  3 03:30:14 2019	(r345826)
@@ -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: stable/12/sys/kern/kern_mib.c
==============================================================================
--- stable/12/sys/kern/kern_mib.c	Wed Apr  3 03:23:45 2019	(r345825)
+++ stable/12/sys/kern/kern_mib.c	Wed Apr  3 03:30:14 2019	(r345826)
@@ -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?201904030330.x333UFK8019250>