Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F150662255
D26239.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D26239.id.diff
View Options
Index: head/sbin/sysctl/sysctl.c
===================================================================
--- head/sbin/sysctl/sysctl.c
+++ head/sbin/sysctl/sysctl.c
@@ -697,6 +697,29 @@
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 @@
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;
Index: head/sys/kern/kern_mib.c
===================================================================
--- head/sys/kern/kern_mib.c
+++ head/sys/kern/kern_mib.c
@@ -246,22 +246,22 @@
pagesizes32[i] = (uint32_t)pagesizes[i];
len = sizeof(pagesizes32);
- if (len > req->oldlen)
+ if (len > req->oldlen && req->oldptr != NULL)
len = req->oldlen;
error = SYSCTL_OUT(req, pagesizes32, len);
} else
#endif
{
len = sizeof(pagesizes);
- if (len > req->oldlen)
+ if (len > req->oldlen && req->oldptr != NULL)
len = req->oldlen;
error = SYSCTL_OUT(req, pagesizes, len);
}
return (error);
}
SYSCTL_PROC(_hw, OID_AUTO, pagesizes,
- CTLTYPE_ULONG | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0,
- sysctl_hw_pagesizes, "LU",
+ CTLTYPE_OPAQUE | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0,
+ sysctl_hw_pagesizes, "S,pagesizes",
"Supported page sizes");
int adaptive_machine_arch = 1;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 4, 4:43 AM (19 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30799061
Default Alt Text
D26239.id.diff (1 KB)
Attached To
Mode
D26239: Add sysctl(8) formatting for hw.pagesizes.
Attached
Detach File
Event Timeline
Log In to Comment