summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2016-09-01 09:13:49 +0000
committerderaadt <deraadt@openbsd.org>2016-09-01 09:13:49 +0000
commitfeec8fe6cfef9d675d32e2593e6bfa1cc289ecc8 (patch)
treed1d9147e09e8755be2910fb088ac18e36d290170
parentopenbsd.randomdata became RO in userland due to the RELRO work. We should (diff)
downloadwireguard-openbsd-feec8fe6cfef9d675d32e2593e6bfa1cc289ecc8.tar.xz
wireguard-openbsd-feec8fe6cfef9d675d32e2593e6bfa1cc289ecc8.zip
Export machdep.cpufeature in hex, to avoid - values which made
yuo@ grumpy. ok tom guenther yuo
-rw-r--r--sbin/sysctl/sysctl.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c
index c15aea3006a..321a9ec6fb6 100644
--- a/sbin/sysctl/sysctl.c
+++ b/sbin/sysctl/sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysctl.c,v 1.218 2016/08/27 01:55:30 guenther Exp $ */
+/* $OpenBSD: sysctl.c,v 1.219 2016/09/01 09:13:49 deraadt Exp $ */
/* $NetBSD: sysctl.c,v 1.9 1995/09/30 07:12:50 thorpej Exp $ */
/*
@@ -178,6 +178,7 @@ int Aflag, aflag, nflag, qflag;
#define KMEMSTATS 0x00001000
#define SENSORS 0x00002000
#define SMALLBUF 0x00004000
+#define HEX 0x00008000
/* prototypes */
void debuginit(void);
@@ -610,6 +611,10 @@ parse(char *string, int flags)
if (mib[1] == CPU_CONSDEV)
special |= CHRDEV;
#endif
+#ifdef CPU_CPUFEATURE
+ if (mib[1] == CPU_CPUFEATURE)
+ special |= HEX;
+#endif
#ifdef CPU_BLK2CHR
if (mib[1] == CPU_BLK2CHR) {
if (bufp == NULL)
@@ -913,13 +918,19 @@ parse(char *string, int flags)
if (newsize == 0) {
if (!nflag)
(void)printf("%s%s", string, equ);
- (void)printf("%d\n", *(int *)buf);
+ if (special & HEX)
+ (void)printf("0x%x\n", *(int *)buf);
+ else
+ (void)printf("%d\n", *(int *)buf);
} else {
if (!qflag) {
if (!nflag)
(void)printf("%s: %d -> ", string,
*(int *)buf);
- (void)printf("%d\n", *(int *)newval);
+ if (special & HEX)
+ (void)printf("%d\n", *(int *)newval);
+ else
+ (void)printf("0x%x\n", *(int *)newval);
}
}
return;