aboutsummaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2020-09-02 18:17:08 +0000
committerMark Johnston <markj@FreeBSD.org>2020-09-02 18:17:08 +0000
commita0efcf6400788d856b8b89dfff7ef63007896d90 (patch)
tree2741f94edd39480c8feef4e9fd502d8b3b01c889 /sbin
parent847ab36bf22766020077f06f6a8d278f8b081655 (diff)
downloadsrc-a0efcf6400788d856b8b89dfff7ef63007896d90.tar.gz
src-a0efcf6400788d856b8b89dfff7ef63007896d90.zip
Notes
Diffstat (limited to 'sbin')
-rw-r--r--sbin/sysctl/sysctl.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c
index bc6dd360f70c..f83508d216cf 100644
--- a/sbin/sysctl/sysctl.c
+++ b/sbin/sysctl/sysctl.c
@@ -697,6 +697,29 @@ S_input_id(size_t l2, void *p)
return (0);
}
+static int
+S_pagesizes(size_t l2, void *p)
+{
+ char buf[256];
+ u_long *ps;
+ size_t l;
+ int i;
+
+ l = snprintf(buf, sizeof(buf), "{ ");
+ ps = p;
+ for (i = 0; i * sizeof(*ps) < l2 && ps[i] != 0 && l < sizeof(buf);
+ i++) {
+ l += snprintf(&buf[l], sizeof(buf) - l,
+ "%s%lu", i == 0 ? "" : ", ", ps[i]);
+ }
+ if (l < sizeof(buf))
+ (void)snprintf(&buf[l], sizeof(buf) - l, " }");
+
+ printf("%s", buf);
+
+ return (0);
+}
+
#ifdef __amd64__
static int
S_efi_map(size_t l2, void *p)
@@ -1002,6 +1025,8 @@ show_var(int *oid, int nlen)
func = S_vmtotal;
else if (strcmp(fmt, "S,input_id") == 0)
func = S_input_id;
+ else if (strcmp(fmt, "S,pagesizes") == 0)
+ func = S_pagesizes;
#ifdef __amd64__
else if (strcmp(fmt, "S,efi_map_header") == 0)
func = S_efi_map;