summaryrefslogtreecommitdiffstats
path: root/freebsd/sbin
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-08-07 14:56:50 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-09-21 10:29:37 +0200
commitc37f9fba70085fedc8eede7559489d2321393005 (patch)
tree042455ebf1fa89a277a825f72e1ed805d0b4d296 /freebsd/sbin
parentUpdate to FreeBSD head 2017-06-01 (diff)
downloadrtems-libbsd-c37f9fba70085fedc8eede7559489d2321393005.tar.bz2
Update to FreeBSD head 2017-08-01
Git mirror commit f5002f5e5f78cae9f0269d812dc0aedb0339312c. Update #3472.
Diffstat (limited to 'freebsd/sbin')
-rw-r--r--freebsd/sbin/sysctl/sysctl.c52
1 files changed, 30 insertions, 22 deletions
diff --git a/freebsd/sbin/sysctl/sysctl.c b/freebsd/sbin/sysctl/sysctl.c
index 8de24190..c6907afe 100644
--- a/freebsd/sbin/sysctl/sysctl.c
+++ b/freebsd/sbin/sysctl/sysctl.c
@@ -974,6 +974,36 @@ show_var(int *oid, int nlen)
printf("%s", buf);
return (0);
}
+
+ /* don't fetch opaques that we don't know how to print */
+ if (ctltype == CTLTYPE_OPAQUE) {
+ if (strcmp(fmt, "S,clockinfo") == 0)
+#ifndef __rtems__
+ func = S_clockinfo;
+#else /* __rtems__ */
+ func = NULL;
+#endif /* __rtems__ */
+ else if (strcmp(fmt, "S,timeval") == 0)
+ func = S_timeval;
+ else if (strcmp(fmt, "S,loadavg") == 0)
+ func = S_loadavg;
+ else if (strcmp(fmt, "S,vmtotal") == 0)
+ func = S_vmtotal;
+#ifdef __amd64__
+ else if (strcmp(fmt, "S,efi_map_header") == 0)
+ func = S_efi_map;
+#endif
+#if defined(__amd64__) || defined(__i386__)
+ else if (strcmp(fmt, "S,bios_smap_xattr") == 0)
+ func = S_bios_smap_xattr;
+#endif
+ else {
+ func = NULL;
+ if (!bflag && !oflag && !xflag)
+ return (1);
+ }
+ }
+
/* find an estimate of how much we need for this var */
if (Bflag)
j = Bflag;
@@ -1094,28 +1124,6 @@ show_var(int *oid, int nlen)
case CTLTYPE_OPAQUE:
i = 0;
- if (strcmp(fmt, "S,clockinfo") == 0)
-#ifndef __rtems__
- func = S_clockinfo;
-#else /* __rtems__ */
- func = NULL;
-#endif /* __rtems__ */
- else if (strcmp(fmt, "S,timeval") == 0)
- func = S_timeval;
- else if (strcmp(fmt, "S,loadavg") == 0)
- func = S_loadavg;
- else if (strcmp(fmt, "S,vmtotal") == 0)
- func = S_vmtotal;
-#ifdef __amd64__
- else if (strcmp(fmt, "S,efi_map_header") == 0)
- func = S_efi_map;
-#endif
-#if defined(__amd64__) || defined(__i386__)
- else if (strcmp(fmt, "S,bios_smap_xattr") == 0)
- func = S_bios_smap_xattr;
-#endif
- else
- func = NULL;
if (func) {
if (!nflag)
printf("%s%s", name, sep);