summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--etc/etc.i386/sysctl.conf1
-rw-r--r--lib/libc/gen/sysctl.329
-rw-r--r--sbin/sysctl/sysctl.86
-rw-r--r--sbin/sysctl/sysctl.c183
-rw-r--r--sys/kern/kern_sysctl.c42
-rw-r--r--sys/sys/sysctl.h15
6 files changed, 9 insertions, 267 deletions
diff --git a/etc/etc.i386/sysctl.conf b/etc/etc.i386/sysctl.conf
index 8d6b6c411a9..2051fd7f06a 100644
--- a/etc/etc.i386/sysctl.conf
+++ b/etc/etc.i386/sysctl.conf
@@ -4,4 +4,3 @@
#machdep.lidsuspend=0 # do not suspend laptop upon lid closing
#machdep.userldt=1 # allow userland programs to play with ldt,
# required by some ports
-#kern.emul.linux=1 # enable running Linux binaries
diff --git a/lib/libc/gen/sysctl.3 b/lib/libc/gen/sysctl.3
index ccf70992bc4..e74bcb34413 100644
--- a/lib/libc/gen/sysctl.3
+++ b/lib/libc/gen/sysctl.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: sysctl.3,v 1.253 2015/11/05 12:52:26 sthen Exp $
+.\" $OpenBSD: sysctl.3,v 1.254 2016/02/29 19:44:07 naddy Exp $
.\"
.\" Copyright (c) 1993
.\" The Regents of the University of California. All rights reserved.
@@ -27,7 +27,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd $Mdocdate: November 5 2015 $
+.Dd $Mdocdate: February 29 2016 $
.Dt SYSCTL 3
.Os
.Sh NAME
@@ -418,7 +418,6 @@ information.
.It Dv KERN_CPTIME Ta "long[CPUSTATES]" Ta "no"
.It Dv KERN_CPTIME2 Ta "u_int64_t[CPUSTATES]" Ta "no"
.It Dv KERN_DOMAINNAME Ta "string" Ta "yes"
-.It Dv KERN_EMUL Ta "node" Ta "not applicable"
.It Dv KERN_FILE Ta "struct kinfo_file" Ta "no"
.It Dv KERN_FORKSTAT Ta "struct forkstat" Ta "no"
.It Dv KERN_FSCALE Ta "integer" Ta "no"
@@ -526,30 +525,6 @@ but obtains information from only the single CPU specified by the
third level name given.
.It Dv KERN_DOMAINNAME
Get or set the YP domain name.
-.It Dv KERN_EMUL
-Enable binary emulation.
-.Bl -column "KERN_EMUL_ENABLED" "integer" "Changeable" -offset indent
-.It Sy "Third level name" Ta Sy "Type" Ta Sy Changeable
-.It Dv KERN_EMUL_ENABLED Ta "integer" Ta "yes"
-.It Dv KERN_EMUL_NAME Ta "string" Ta "no"
-.It Dv KERN_EMUL_NEMULS Ta "integer" Ta "no"
-.El
-.Pp
-Third level names in
-.Dv KERN_EMUL
-other than
-.Dv KERN_EMUL_NEMULS
-refer to a specific emulation available in the kernel.
-Valid values range from 1 to the return value of
-.Dv KERN_EMUL_NEMULS .
-The fourth level names available are
-.Dv KERN_EMUL_NAME ,
-which returns a string with the emulation name, and
-.Dv KERN_EMUL_ENABLED ,
-which is an adjustable integer.
-.Pp
-Note that using this interface exposes duplicate entries which are
-consolidated by the userland frontend.
.It Dv KERN_FILE
Return the entire file table, or a subset of it.
An array of
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.
*/
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index cda2922f9b8..a7a16b8c1ec 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sysctl.c,v 1.299 2015/12/05 20:54:34 kettenis Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.300 2016/02/29 19:44:07 naddy Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@@ -129,7 +129,6 @@ int sysctl_proc_nobroadcastkill(int *, u_int, void *, size_t, void *, size_t *,
int sysctl_proc_vmmap(int *, u_int, void *, size_t *, struct proc *);
int sysctl_intrcnt(int *, u_int, void *, size_t *);
int sysctl_sensors(int *, u_int, void *, size_t *, void *, size_t);
-int sysctl_emul(int *, u_int, void *, size_t *, void *, size_t);
int sysctl_cptime2(int *, u_int, void *, size_t *, void *, size_t);
void fill_file(struct kinfo_file *, struct file *, struct filedesc *, int,
@@ -298,7 +297,6 @@ kern_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
case KERN_SHMINFO:
case KERN_INTRCNT:
case KERN_WATCHDOG:
- case KERN_EMUL:
case KERN_EVCOUNT:
case KERN_TIMECOUNTER:
case KERN_CPTIME2:
@@ -557,9 +555,6 @@ kern_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
case KERN_WATCHDOG:
return (sysctl_wdog(name + 1, namelen - 1, oldp, oldlenp,
newp, newlen));
- case KERN_EMUL:
- return (sysctl_emul(name + 1, namelen - 1, oldp, oldlenp,
- newp, newlen));
#endif
case KERN_MAXCLUSTERS:
error = sysctl_int(oldp, oldlenp, newp, newlen, &nmbclust);
@@ -2332,41 +2327,6 @@ sysctl_sensors(int *name, u_int namelen, void *oldp, size_t *oldlenp,
return (ret);
}
-int
-sysctl_emul(int *name, u_int namelen, void *oldp, size_t *oldlenp,
- void *newp, size_t newlen)
-{
- int enabled, error;
- struct emul *e;
-
- if (name[0] == KERN_EMUL_NUM) {
- if (namelen != 1)
- return (ENOTDIR);
- return (sysctl_rdint(oldp, oldlenp, newp, nexecs));
- }
-
- if (namelen != 2)
- return (ENOTDIR);
- if (name[0] > nexecs || name[0] < 0)
- return (EINVAL);
- e = execsw[name[0] - 1].es_emul;
- if (e == NULL)
- return (EINVAL);
-
- switch (name[1]) {
- case KERN_EMUL_NAME:
- return (sysctl_rdstring(oldp, oldlenp, newp, e->e_name));
- case KERN_EMUL_ENABLED:
- enabled = (e->e_flags & EMUL_ENABLED);
- error = sysctl_int(oldp, oldlenp, newp, newlen,
- &enabled);
- e->e_flags = (enabled & EMUL_ENABLED);
- return (error);
- default:
- return (EINVAL);
- }
-}
-
#endif /* SMALL_KERNEL */
int
diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h
index 8a6d6047fcb..915d262e000 100644
--- a/sys/sys/sysctl.h
+++ b/sys/sys/sysctl.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysctl.h,v 1.157 2015/10/23 10:22:30 claudio Exp $ */
+/* $OpenBSD: sysctl.h,v 1.158 2016/02/29 19:44:07 naddy Exp $ */
/* $NetBSD: sysctl.h,v 1.16 1996/04/09 20:55:36 cgd Exp $ */
/*
@@ -165,7 +165,7 @@ struct ctlname {
#define KERN_SHMINFO 62 /* struct: SysV struct shminfo */
#define KERN_INTRCNT 63 /* node: interrupt counters */
#define KERN_WATCHDOG 64 /* node: watchdog */
-#define KERN_EMUL 65 /* node: emuls */
+/* was KERN_EMUL 65 */
#define KERN_PROC 66 /* struct: process entries */
#define KERN_MAXCLUSTERS 67 /* number of mclusters */
#define KERN_EVCOUNT 68 /* node: event counters */
@@ -252,7 +252,7 @@ struct ctlname {
{ "shminfo", CTLTYPE_STRUCT }, \
{ "intrcnt", CTLTYPE_NODE }, \
{ "watchdog", CTLTYPE_NODE }, \
- { "emul", CTLTYPE_NODE }, \
+ { "gap", 0 }, \
{ "proc", CTLTYPE_STRUCT }, \
{ "maxclusters", CTLTYPE_INT }, \
{ "evcount", CTLTYPE_NODE }, \
@@ -272,15 +272,6 @@ struct ctlname {
}
/*
- * KERN_EMUL subtypes.
- */
-#define KERN_EMUL_NUM 0
-/* Fourth level sysctl names */
-#define KERN_EMUL_NAME 0
-#define KERN_EMUL_ENABLED 1
-
-
-/*
* KERN_PROC subtypes
*/
#define KERN_PROC_ALL 0 /* everything but kernel threads */