Subject: Re: CVS commit: src/sys/compat/linux/common
To: David Laight <david@l8s.co.uk>
From: Christos Zoulas <christos@zoulas.com>
List: source-changes
Date: 05/09/2007 12:53:15
On May 9,  7:53am, david@l8s.co.uk (David Laight) wrote:
-- Subject: Re: CVS commit: src/sys/compat/linux/common

| On Sun, May 06, 2007 at 11:25:26PM +0000, Christos Zoulas wrote:
| > 
| > Module Name:	src
| > Committed By:	christos
| > Date:		Sun May  6 23:25:26 UTC 2007
| > 
| > Modified Files:
| > 	src/sys/compat/linux/common: linux_sysctl.c
| > 
| > Log Message:
| > Remove change that obviously was not tested (since it uses LINUX_KERN_VERSION
| > again, producing EEXIST). There is no machine sysctl in linux that corresponds
| > to this (at least on my i386 suse box)
| 
| This breaks the linux emulation because 'uname -m' had been modified
| to rely on the sysctl code.
| 

Here's the actual code:

        sysctl_createv(clog, 0, &node, NULL,
                       CTLFLAG_PERMANENT,
                       CTLTYPE_STRING, "version", NULL,
                       NULL, 0, linux_version, sizeof(linux_version),
                       LINUX_KERN_VERSION, CTL_EOL);
	               ^^^^^^^^^^^^^^^^^^

#if 0
#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);
	               ^^^^^^^^^^^^^^^^^^
#endif

The second sysctl_createv (which I commented out) always fails with EEXIST
so I don't see how it could be making a difference. The minimal fix is
to change LINUX_KERN_VERSION on the second create call to something else
(or allocate it dynamically). I did not see a "machine" sysctl in my linux
box.

christos