diff options
Diffstat (limited to '')
| -rw-r--r-- | src/regress/lib/libc/sys/macros.h | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/src/regress/lib/libc/sys/macros.h b/src/regress/lib/libc/sys/macros.h index 932f230c03..ef858d137a 100644 --- a/src/regress/lib/libc/sys/macros.h +++ b/src/regress/lib/libc/sys/macros.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: macros.h,v 1.1.1.1 2019/11/19 19:57:03 bluhm Exp $ */ | 1 | /* $OpenBSD: macros.h,v 1.2 2020/01/30 08:22:30 mpi Exp $ */ |
| 2 | /* Public domain - Moritz Buhl */ | 2 | /* Public domain - Moritz Buhl */ |
| 3 | 3 | ||
| 4 | #include <sys/param.h> | 4 | #include <sys/param.h> |
| @@ -9,6 +9,7 @@ | |||
| 9 | 9 | ||
| 10 | #include <stdbool.h> | 10 | #include <stdbool.h> |
| 11 | #include <string.h> | 11 | #include <string.h> |
| 12 | #include <stdio.h> | ||
| 12 | 13 | ||
| 13 | #define __RCSID(str) | 14 | #define __RCSID(str) |
| 14 | #define __COPYRIGHT(str) | 15 | #define __COPYRIGHT(str) |
| @@ -26,17 +27,26 @@ int sysctlbyname(char *, void *, size_t *, void *, size_t); | |||
| 26 | int | 27 | int |
| 27 | sysctlbyname(char* s, void *oldp, size_t *oldlenp, void *newp, size_t newlen) | 28 | sysctlbyname(char* s, void *oldp, size_t *oldlenp, void *newp, size_t newlen) |
| 28 | { | 29 | { |
| 29 | int ktc; | 30 | int mib[3], miblen; |
| 30 | if (strcmp(s, "kern.timecounter.hardware") == 0) | ||
| 31 | ktc = KERN_TIMECOUNTER_HARDWARE; | ||
| 32 | else if (strcmp(s, "kern.timecounter.choice") == 0) | ||
| 33 | ktc = KERN_TIMECOUNTER_CHOICE; | ||
| 34 | 31 | ||
| 35 | int mib[3]; | ||
| 36 | mib[0] = CTL_KERN; | 32 | mib[0] = CTL_KERN; |
| 37 | mib[1] = KERN_TIMECOUNTER; | 33 | if (strcmp(s, "kern.timecounter.hardware") == 0) { |
| 38 | mib[2] = ktc; | 34 | mib[1] = KERN_TIMECOUNTER; |
| 39 | return sysctl(mib, 3, oldp, oldlenp, newp, newlen); | 35 | mib[2] = KERN_TIMECOUNTER_HARDWARE; |
| 36 | miblen = 3; | ||
| 37 | } else if (strcmp(s, "kern.timecounter.choice") == 0) { | ||
| 38 | mib[1] = KERN_TIMECOUNTER; | ||
| 39 | mib[2] = KERN_TIMECOUNTER_CHOICE; | ||
| 40 | miblen = 3; | ||
| 41 | } else if (strcmp(s, "kern.securelevel") == 0) { | ||
| 42 | mib[1] = KERN_SECURELVL; | ||
| 43 | miblen = 2; | ||
| 44 | } else { | ||
| 45 | fprintf(stderr, "%s(): mib '%s' not supported\n", __func__, s); | ||
| 46 | return -42; | ||
| 47 | } | ||
| 48 | |||
| 49 | return sysctl(mib, miblen, oldp, oldlenp, newp, newlen); | ||
| 40 | } | 50 | } |
| 41 | 51 | ||
| 42 | /* t_mlock.c */ | 52 | /* t_mlock.c */ |
