guenther@ has pointed out that we can now delete the kern.emul/KERN_EMUL
sysctl bits.
Index: etc/etc.i386/sysctl.conf
===================================================================
RCS file: /cvs/src/etc/etc.i386/sysctl.conf,v
retrieving revision 1.18
diff -u -p -r1.18 sysctl.conf
--- etc/etc.i386/sysctl.conf 16 Jun 2015 20:30:24 -0000 1.18
+++ etc/etc.i386/sysctl.conf 29 Feb 2016 14:53:47 -0000
@@ -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
Index: lib/libc/gen/sysctl.3
===================================================================
RCS file: /cvs/src/lib/libc/gen/sysctl.3,v
retrieving revision 1.253
diff -u -p -r1.253 sysctl.3
--- lib/libc/gen/sysctl.3 5 Nov 2015 12:52:26 -0000 1.253
+++ lib/libc/gen/sysctl.3 29 Feb 2016 14:55:57 -0000
@@ -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 si
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
Index: sbin/sysctl/sysctl.8
===================================================================
RCS file: /cvs/src/sbin/sysctl/sysctl.8,v
retrieving revision 1.190
diff -u -p -r1.190 sysctl.8
--- sbin/sysctl/sysctl.8 5 Nov 2015 12:50:53 -0000 1.190
+++ sbin/sysctl/sysctl.8 29 Feb 2016 15:04:40 -0000
@@ -187,8 +187,6 @@ and a few require a kernel compiled with
.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
Index: sbin/sysctl/sysctl.c
===================================================================
RCS file: /cvs/src/sbin/sysctl/sysctl.c,v
retrieving revision 1.211
diff -u -p -r1.211 sysctl.c
--- sbin/sysctl/sysctl.c 18 Apr 2015 18:28:37 -0000 1.211
+++ sbin/sysctl/sysctl.c 29 Feb 2016 15:00:41 -0000
@@ -211,7 +211,6 @@ int sysctl_tc(char *, char **, int *, in
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;
@@ -2641,183 +2637,6 @@ print_sensor(struct sensor *s)
ct[19] = '\0';
printf(", %s.%03ld", ct, s->tv.tv_usec / 1000);
}
-}
-
-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);
}
/*
Index: sys/kern/kern_sysctl.c
===================================================================
RCS file: /cvs/src/sys/kern/kern_sysctl.c,v
retrieving revision 1.299
diff -u -p -r1.299 kern_sysctl.c
--- sys/kern/kern_sysctl.c 5 Dec 2015 20:54:34 -0000 1.299
+++ sys/kern/kern_sysctl.c 29 Feb 2016 15:23:43 -0000
@@ -129,7 +129,6 @@ int sysctl_proc_nobroadcastkill(int *, u
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, vo
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, vo
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);
@@ -2330,41 +2325,6 @@ sysctl_sensors(int *name, u_int namelen,
sizeof(struct sensor));
free(us, M_TEMP, sizeof(*us));
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 */
Index: sys/sys/sysctl.h
===================================================================
RCS file: /cvs/src/sys/sys/sysctl.h,v
retrieving revision 1.157
diff -u -p -r1.157 sysctl.h
--- sys/sys/sysctl.h 23 Oct 2015 10:22:30 -0000 1.157
+++ sys/sys/sysctl.h 29 Feb 2016 15:41:27 -0000
@@ -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 }, \
@@ -270,15 +270,6 @@ struct ctlname {
{ "proc_vmmap", CTLTYPE_NODE }, \
{ "global_ptrace", CTLTYPE_INT }, \
}
-
-/*
- * 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
--
Christian "naddy" Weisgerber [email protected]