Last active
August 29, 2015 13:56
-
-
Save justincormack/9197099 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: ./sys/kern/init_sysctl_base.c | |
=================================================================== | |
RCS file: /cvsroot/src/sys/kern/init_sysctl_base.c,v | |
retrieving revision 1.1 | |
diff -u -r1.1 init_sysctl_base.c | |
--- ./sys/kern/init_sysctl_base.c 16 Sep 2009 15:03:56 -0000 1.1 | |
+++ ./sys/kern/init_sysctl_base.c 24 Feb 2014 22:02:19 -0000 | |
@@ -34,6 +34,9 @@ | |
#include <sys/param.h> | |
#include <sys/sysctl.h> | |
+#include <sys/kernel.h> | |
+ | |
+static int sysctl_setlen(SYSCTLFN_PROTO); | |
/* | |
* sets up the base nodes... | |
@@ -124,3 +127,79 @@ | |
NULL, 0, NULL, 0, | |
CTL_SECURITY, CTL_EOL); | |
} | |
+ | |
+/* | |
+ * now add some nodes which both rump kernel and standard | |
+ * NetBSD both need, as rump cannot use sys/kern/init_sysctl.c | |
+ */ | |
+SYSCTL_SETUP(sysctl_kernbase_setup, "sysctl kern subtree base setup") | |
+{ | |
+ sysctl_createv(clog, 0, NULL, NULL, | |
+ CTLFLAG_PERMANENT, | |
+ CTLTYPE_NODE, "kern", NULL, | |
+ NULL, 0, NULL, 0, | |
+ CTL_KERN, CTL_EOL); | |
+ | |
+ sysctl_createv(clog, 0, NULL, NULL, | |
+ CTLFLAG_PERMANENT, | |
+ CTLTYPE_STRING, "ostype", | |
+ SYSCTL_DESCR("Operating system type"), | |
+ NULL, 0, __UNCONST(&ostype), 0, | |
+ CTL_KERN, KERN_OSTYPE, CTL_EOL); | |
+ sysctl_createv(clog, 0, NULL, NULL, | |
+ CTLFLAG_PERMANENT, | |
+ CTLTYPE_STRING, "osrelease", | |
+ SYSCTL_DESCR("Operating system release"), | |
+ NULL, 0, __UNCONST(&osrelease), 0, | |
+ CTL_KERN, KERN_OSRELEASE, CTL_EOL); | |
+ sysctl_createv(clog, 0, NULL, NULL, | |
+ CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE, | |
+ CTLTYPE_INT, "osrevision", | |
+ SYSCTL_DESCR("Operating system revision"), | |
+ NULL, __NetBSD_Version__, NULL, 0, | |
+ CTL_KERN, KERN_OSREV, CTL_EOL); | |
+ sysctl_createv(clog, 0, NULL, NULL, | |
+ CTLFLAG_PERMANENT, | |
+ CTLTYPE_STRING, "version", | |
+ SYSCTL_DESCR("Kernel version"), | |
+ NULL, 0, __UNCONST(&version), 0, | |
+ CTL_KERN, KERN_VERSION, CTL_EOL); | |
+ sysctl_createv(clog, 0, NULL, NULL, | |
+ CTLFLAG_PERMANENT|CTLFLAG_READWRITE, | |
+ CTLTYPE_STRING, "hostname", | |
+ SYSCTL_DESCR("System hostname"), | |
+ sysctl_setlen, 0, hostname, MAXHOSTNAMELEN, | |
+ CTL_KERN, KERN_HOSTNAME, CTL_EOL); | |
+ sysctl_createv(clog, 0, NULL, NULL, | |
+ CTLFLAG_PERMANENT|CTLFLAG_READWRITE, | |
+ CTLTYPE_STRING, "domainname", | |
+ SYSCTL_DESCR("YP domain name"), | |
+ sysctl_setlen, 0, domainname, MAXHOSTNAMELEN, | |
+ CTL_KERN, KERN_DOMAINNAME, CTL_EOL); | |
+} | |
+ | |
+/* | |
+ * sysctl helper function for kern.hostname and kern.domainnname. | |
+ * resets the relevant recorded length when the underlying name is | |
+ * changed. | |
+ */ | |
+static int | |
+sysctl_setlen(SYSCTLFN_ARGS) | |
+{ | |
+ int error; | |
+ | |
+ error = sysctl_lookup(SYSCTLFN_CALL(rnode)); | |
+ if (error || newp == NULL) | |
+ return (error); | |
+ | |
+ switch (rnode->sysctl_num) { | |
+ case KERN_HOSTNAME: | |
+ hostnamelen = strlen((const char*)rnode->sysctl_data); | |
+ break; | |
+ case KERN_DOMAINNAME: | |
+ domainnamelen = strlen((const char*)rnode->sysctl_data); | |
+ break; | |
+ } | |
+ | |
+ return (0); | |
+} | |
Index: ./sys/kern/init_sysctl.c | |
=================================================================== | |
RCS file: /cvsroot/src/sys/kern/init_sysctl.c,v | |
retrieving revision 1.199 | |
diff -u -r1.199 init_sysctl.c | |
--- ./sys/kern/init_sysctl.c 17 Jan 2014 02:12:48 -0000 1.199 | |
+++ ./sys/kern/init_sysctl.c 24 Feb 2014 22:02:19 -0000 | |
@@ -105,7 +105,6 @@ | |
static int sysctl_kern_rtc_offset(SYSCTLFN_PROTO); | |
static int sysctl_kern_maxproc(SYSCTLFN_PROTO); | |
static int sysctl_kern_hostid(SYSCTLFN_PROTO); | |
-static int sysctl_setlen(SYSCTLFN_PROTO); | |
static int sysctl_kern_clockrate(SYSCTLFN_PROTO); | |
static int sysctl_msgbuf(SYSCTLFN_PROTO); | |
static int sysctl_kern_defcorename(SYSCTLFN_PROTO); | |
@@ -151,30 +150,6 @@ | |
CTL_KERN, CTL_EOL); | |
sysctl_createv(clog, 0, NULL, NULL, | |
- CTLFLAG_PERMANENT, | |
- CTLTYPE_STRING, "ostype", | |
- SYSCTL_DESCR("Operating system type"), | |
- NULL, 0, __UNCONST(&ostype), 0, | |
- CTL_KERN, KERN_OSTYPE, CTL_EOL); | |
- sysctl_createv(clog, 0, NULL, NULL, | |
- CTLFLAG_PERMANENT, | |
- CTLTYPE_STRING, "osrelease", | |
- SYSCTL_DESCR("Operating system release"), | |
- NULL, 0, __UNCONST(&osrelease), 0, | |
- CTL_KERN, KERN_OSRELEASE, CTL_EOL); | |
- sysctl_createv(clog, 0, NULL, NULL, | |
- CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE, | |
- CTLTYPE_INT, "osrevision", | |
- SYSCTL_DESCR("Operating system revision"), | |
- NULL, __NetBSD_Version__, NULL, 0, | |
- CTL_KERN, KERN_OSREV, CTL_EOL); | |
- sysctl_createv(clog, 0, NULL, NULL, | |
- CTLFLAG_PERMANENT, | |
- CTLTYPE_STRING, "version", | |
- SYSCTL_DESCR("Kernel version"), | |
- NULL, 0, __UNCONST(&version), 0, | |
- CTL_KERN, KERN_VERSION, CTL_EOL); | |
- sysctl_createv(clog, 0, NULL, NULL, | |
CTLFLAG_PERMANENT|CTLFLAG_READWRITE, | |
CTLTYPE_INT, "maxvnodes", | |
SYSCTL_DESCR("Maximum number of vnodes"), | |
@@ -200,12 +175,6 @@ | |
NULL, ARG_MAX, NULL, 0, | |
CTL_KERN, KERN_ARGMAX, CTL_EOL); | |
sysctl_createv(clog, 0, NULL, NULL, | |
- CTLFLAG_PERMANENT|CTLFLAG_READWRITE, | |
- CTLTYPE_STRING, "hostname", | |
- SYSCTL_DESCR("System hostname"), | |
- sysctl_setlen, 0, hostname, MAXHOSTNAMELEN, | |
- CTL_KERN, KERN_HOSTNAME, CTL_EOL); | |
- sysctl_createv(clog, 0, NULL, NULL, | |
CTLFLAG_PERMANENT|CTLFLAG_READWRITE|CTLFLAG_HEX, | |
CTLTYPE_INT, "hostid", | |
SYSCTL_DESCR("System host ID number"), | |
@@ -282,12 +251,6 @@ | |
NULL, 0, &boottime, sizeof(boottime), | |
CTL_KERN, KERN_BOOTTIME, CTL_EOL); | |
sysctl_createv(clog, 0, NULL, NULL, | |
- CTLFLAG_PERMANENT|CTLFLAG_READWRITE, | |
- CTLTYPE_STRING, "domainname", | |
- SYSCTL_DESCR("YP domain name"), | |
- sysctl_setlen, 0, domainname, MAXHOSTNAMELEN, | |
- CTL_KERN, KERN_DOMAINNAME, CTL_EOL); | |
- sysctl_createv(clog, 0, NULL, NULL, | |
CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE, | |
CTLTYPE_INT, "maxpartitions", | |
SYSCTL_DESCR("Maximum number of partitions allowed per " | |
@@ -1011,32 +974,6 @@ | |
} | |
/* | |
- * sysctl helper function for kern.hostname and kern.domainnname. | |
- * resets the relevant recorded length when the underlying name is | |
- * changed. | |
- */ | |
-static int | |
-sysctl_setlen(SYSCTLFN_ARGS) | |
-{ | |
- int error; | |
- | |
- error = sysctl_lookup(SYSCTLFN_CALL(rnode)); | |
- if (error || newp == NULL) | |
- return (error); | |
- | |
- switch (rnode->sysctl_num) { | |
- case KERN_HOSTNAME: | |
- hostnamelen = strlen((const char*)rnode->sysctl_data); | |
- break; | |
- case KERN_DOMAINNAME: | |
- domainnamelen = strlen((const char*)rnode->sysctl_data); | |
- break; | |
- } | |
- | |
- return (0); | |
-} | |
- | |
-/* | |
* sysctl helper routine for kern.clockrate. Assembles a struct on | |
* the fly to be returned to the caller. | |
*/ | |
Index: ./sys/rump/librump/rumpkern/rump.c | |
=================================================================== | |
RCS file: /cvsroot/src/sys/rump/librump/rumpkern/rump.c,v | |
retrieving revision 1.284 | |
diff -u -r1.284 rump.c | |
--- ./sys/rump/librump/rumpkern/rump.c 29 Jan 2014 18:42:14 -0000 1.284 | |
+++ ./sys/rump/librump/rumpkern/rump.c 24 Feb 2014 22:02:19 -0000 | |
@@ -168,16 +168,6 @@ | |
mksysctls(void) | |
{ | |
- /* kern.hostname */ | |
- sysctl_createv(NULL, 0, NULL, NULL, | |
- CTLFLAG_PERMANENT, CTLTYPE_NODE, "kern", NULL, | |
- NULL, 0, NULL, 0, CTL_KERN, CTL_EOL); | |
- /* XXX: setting hostnamelen is missing */ | |
- sysctl_createv(NULL, 0, NULL, NULL, | |
- CTLFLAG_PERMANENT|CTLFLAG_READWRITE, CTLTYPE_STRING, "hostname", | |
- SYSCTL_DESCR("System hostname"), NULL, 0, | |
- hostname, MAXHOSTNAMELEN, CTL_KERN, KERN_HOSTNAME, CTL_EOL); | |
- | |
/* hw.pagesize */ | |
sysctl_createv(NULL, 0, NULL, NULL, | |
CTLFLAG_PERMANENT, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment