From c46e3e7edf0b10fb4028cab867793c98c9481aa5 Mon Sep 17 00:00:00 2001 From: Christian Weisgerber Date: Mon, 29 Feb 2016 19:44:08 +0000 Subject: delete the kern.emul/KERN_EMUL sysctl bits since there are no emulations left; ok millert@ deraadt@, jmc@ (man pages) --- sbin/sysctl/sysctl.8 | 6 +- sbin/sysctl/sysctl.c | 183 +-------------------------------------------------- 2 files changed, 3 insertions(+), 186 deletions(-) (limited to 'sbin/sysctl') diff --git a/sbin/sysctl/sysctl.8 b/sbin/sysctl/sysctl.8 index 74c40411573..a8aa0fdcbbc 100644 --- a/sbin/sysctl/sysctl.8 +++ b/sbin/sysctl/sysctl.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: sysctl.8,v 1.190 2015/11/05 12:50:53 sthen Exp $ +.\" $OpenBSD: sysctl.8,v 1.191 2016/02/29 19:44:07 naddy Exp $ .\" $NetBSD: sysctl.8,v 1.4 1995/09/30 07:12:49 thorpej Exp $ .\" .\" Copyright (c) 1993 @@ -30,7 +30,7 @@ .\" .\" @(#)sysctl.8 8.2 (Berkeley) 5/9/95 .\" -.Dd $Mdocdate: November 5 2015 $ +.Dd $Mdocdate: February 29 2016 $ .Dt SYSCTL 8 .Os .Sh NAME @@ -187,8 +187,6 @@ and a few require a kernel compiled with non-standard .It kern.shminfo.shmall Ta integer Ta yes .It kern.watchdog.period Ta integer Ta yes .It kern.watchdog.auto Ta integer Ta yes -.It kern.emul.nemuls Ta integer Ta no -.It kern.emul.other Ta integer Ta yes .It kern.maxclusters Ta integer Ta yes .It kern.timecounter.tick Ta integer Ta no .It kern.timecounter.timestepwarnings Ta integer Ta yes diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c index 457c259300f..e2f62feb027 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sysctl.c,v 1.211 2015/04/18 18:28:37 deraadt Exp $ */ +/* $OpenBSD: sysctl.c,v 1.212 2016/02/29 19:44:07 naddy Exp $ */ /* $NetBSD: sysctl.c,v 1.9 1995/09/30 07:12:50 thorpej Exp $ */ /* @@ -211,7 +211,6 @@ int sysctl_tc(char *, char **, int *, int, int *); int sysctl_sensors(char *, char **, int *, int, int *); void print_sensordev(char *, int *, u_int, struct sensordev *); void print_sensor(struct sensor *); -int sysctl_emul(char *, char *, int); #ifdef CPU_CHIPSET int sysctl_chipset(char *, char **, int *, int, int *); #endif @@ -440,9 +439,6 @@ parse(char *string, int flags) if (len < 0) return; break; - case KERN_EMUL: - sysctl_emul(string, newval, flags); - return; case KERN_FILE: if (flags == 0) return; @@ -2643,183 +2639,6 @@ print_sensor(struct sensor *s) } } -struct emulname { - char *name; - int index; -} *emul_names; -int emul_num, nemuls; -int emul_init(void); - -int -sysctl_emul(char *string, char *newval, int flags) -{ - int mib[4], enabled, i, old, print, found = 0; - char *head, *target; - size_t len; - - if (emul_init() == -1) { - warnx("emul_init: out of memory"); - return (1); - } - - mib[0] = CTL_KERN; - mib[1] = KERN_EMUL; - mib[3] = KERN_EMUL_ENABLED; - head = "kern.emul."; - - if (aflag || strcmp(string, "kern.emul") == 0) { - if (newval) { - warnx("%s: specification is incomplete", string); - return (1); - } - if (nflag) - printf("%d\n", nemuls); - else - printf("%snemuls%s%d\n", head, equ, nemuls); - for (i = 0; i < emul_num; i++) { - if (emul_names[i].name == NULL) - break; - if (i > 0 && strcmp(emul_names[i].name, - emul_names[i-1].name) == 0) - continue; - mib[2] = emul_names[i].index; - len = sizeof(int); - if (sysctl(mib, 4, &enabled, &len, NULL, 0) == -1) { - warn("%s", string); - continue; - } - if (nflag) - printf("%d\n", enabled); - else - printf("%s%s%s%d\n", head, emul_names[i].name, - equ, enabled); - } - return (0); - } - /* User specified a third level name */ - target = strrchr(string, '.'); - target++; - if (strcmp(target, "nemuls") == 0) { - if (newval) { - warnx("Operation not permitted"); - return (1); - } - if (nflag) - printf("%d\n", nemuls); - else - printf("%snemuls = %d\n", head, nemuls); - return (0); - } - print = 1; - for (i = 0; i < emul_num; i++) { - if (!emul_names[i].name || (strcmp(target, emul_names[i].name))) - continue; - found = 1; - mib[2] = emul_names[i].index; - len = sizeof(int); - if (newval) { - const char *errstr; - - enabled = strtonum(newval, 0, INT_MAX, &errstr); - if (errstr) { - warnx("%s: %s is %s", string, newval, errstr); - print = 0; - continue; - } - if (sysctl(mib, 4, &old, &len, &enabled, len) == -1) { - warn("%s", string); - print = 0; - continue; - } - if (print) { - if (nflag) - printf("%d\n", enabled); - else - printf("%s%s: %d -> %d\n", head, - target, old, enabled); - } - } else { - if (sysctl(mib, 4, &enabled, &len, NULL, 0) == -1) { - warn("%s", string); - continue; - } - if (print) { - if (nflag) - printf("%d\n", enabled); - else - printf("%s%s = %d\n", head, target, - enabled); - } - } - print = 0; - } - if (!found) - warnx("third level name %s in kern.emul is invalid", - string); - return (0); - - -} - -static int -emulcmp(const void *m, const void *n) -{ - const struct emulname *a = m, *b = n; - - if (!a || !a->name) - return 1; - if (!b || !b->name) - return -1; - return (strcmp(a->name, b->name)); -} - -int -emul_init(void) -{ - static int done; - char string[16]; - int mib[4], i; - size_t len; - - if (done) - return (0); - done = 1; - - mib[0] = CTL_KERN; - mib[1] = KERN_EMUL; - mib[2] = KERN_EMUL_NUM; - len = sizeof(int); - if (sysctl(mib, 3, &emul_num, &len, NULL, 0) == -1) - return (-1); - - emul_names = calloc(emul_num, sizeof(*emul_names)); - if (emul_names == NULL) - return (-1); - - nemuls = emul_num; - for (i = 0; i < emul_num; i++) { - emul_names[i].index = mib[2] = i + 1; - mib[3] = KERN_EMUL_NAME; - len = sizeof(string); - if (sysctl(mib, 4, string, &len, NULL, 0) == -1) - continue; - if (strcmp(string, "native") == 0) - continue; - emul_names[i].name = strdup(string); - if (emul_names[i].name == NULL) { - free(emul_names); - return (-1); - } - } - qsort(emul_names, nemuls, sizeof(*emul_names), emulcmp); - for (i = 0; i < emul_num; i++) { - if (!emul_names[i].name || (i > 0 && - strcmp(emul_names[i].name, emul_names[i - 1].name) == 0)) - nemuls--; - } - return (0); -} - /* * Scan a list of names searching for a particular name. */ -- cgit v1.2.3