Subject: Re: CVS commit: src/sys/compat/linux/common (emul.linux.kern.machine)
To: None <source-changes@netbsd.org>
From: Geoff Wing <mason@primenet.com.au>
List: source-changes
Date: 03/29/2007 05:55:03
matthew green <mrg@netbsd.org> typed:
: Module Name:	src
: Committed By:	mrg
: Date:		Fri Mar 23 04:16:14 UTC 2007
: Modified Files:
: 	src/sys/compat/linux/common: linux_misc.c linux_oldolduname.c
: 	    linux_olduname.c linux_sysctl.c linux_types.h
: Log Message:
: implement emul.linux.kern.machine, which can be set to "i686", like
: some applications seem to want.

You missed some stuff and tried to reuse a node.

Regards,
Geoff

--- sys/compat/linux/common/linux_exec.h.~1~	2007-03-29 15:53:31.000000000 +1000
+++ sys/compat/linux/common/linux_exec.h	2007-03-29 15:53:32.000000000 +1000
@@ -116,13 +116,15 @@
 #define EMUL_LINUX_KERN_OSTYPE		1
 #define EMUL_LINUX_KERN_OSRELEASE	2
 #define EMUL_LINUX_KERN_VERSION		3
-#define EMUL_LINUX_KERN_MAXID		4
+#define EMUL_LINUX_KERN_MACHINE		4
+#define EMUL_LINUX_KERN_MAXID		5
 
 #define EMUL_LINUX_KERN_NAMES { \
 	{ 0, 0 }, \
 	{ "ostype", CTLTYPE_STRING }, \
 	{ "osrelease", CTLTYPE_STRING }, \
 	{ "osversion", CTLTYPE_STRING }, \
+	{ "machine", CTLTYPE_STRING }, \
 }
 
 #ifdef _KERNEL
--- sys/compat/linux/common/linux_sysctl.h.~1~	2007-03-29 15:53:31.000000000 +1000
+++ sys/compat/linux/common/linux_sysctl.h	2007-03-29 15:53:32.000000000 +1000
@@ -95,6 +95,7 @@
 #define	LINUX_KERN_IEEE_EMULATION_WARNINGS			50
 #define	LINUX_KERN_S390_USER_DEBUG_LOGGING			51
 #define	LINUX_KERN_PROF_PID					52
+#define	LINUX_KERN_MACHINE					53
 
 #define	LINUX_VM_SWAPCTL					1
 #define	LINUX_VM_SWAPOUT					2
--- sys/compat/linux/common/linux_sysctl.c.~1~	2007-03-29 15:53:31.000000000 +1000
+++ sys/compat/linux/common/linux_sysctl.c	2007-03-29 15:53:59.000000000 +1000
@@ -114,16 +114,11 @@
 		       CTLTYPE_STRING, "version", NULL,
 		       NULL, 0, linux_version, sizeof(linux_version),
 		       LINUX_KERN_VERSION, CTL_EOL);
-
-#ifndef LINUX_UNAME_ARCH
-#define LINUX_UNAME_ARCH machine
-#endif
-	strlcpy(linux_machine, LINUX_UNAME_ARCH, sizeof(linux_machine));
 	sysctl_createv(clog, 0, &node, NULL,
 		       CTLFLAG_PERMANENT,
 		       CTLTYPE_STRING, "machine", NULL,
 		       NULL, 0, linux_machine, sizeof(linux_machine),
-		       LINUX_KERN_VERSION, CTL_EOL);
+		       LINUX_KERN_MACHINE, CTL_EOL);
 
 	linux_sysctl_root.sysctl_flags &= ~CTLFLAG_READWRITE;
 }
@@ -255,4 +250,15 @@
 		       NULL, 0, linux_version, sizeof(linux_version),
 		       CTL_EMUL, EMUL_LINUX, EMUL_LINUX_KERN,
 		       EMUL_LINUX_KERN_VERSION, CTL_EOL);
+#ifndef LINUX_UNAME_ARCH
+#define LINUX_UNAME_ARCH machine
+#endif
+	strlcpy(linux_machine, LINUX_UNAME_ARCH, sizeof(linux_machine));
+	sysctl_createv(clog, 0, NULL, NULL,
+		       CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
+		       CTLTYPE_STRING, "machine",
+		       SYSCTL_DESCR("Linux operating system machine class"),
+		       NULL, 0, linux_machine, sizeof(linux_machine),
+		       CTL_EMUL, EMUL_LINUX, EMUL_LINUX_KERN,
+		       EMUL_LINUX_KERN_MACHINE, CTL_EOL);
 }