Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/sys/compat/linux/common



Christos Zoulas wrote:

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.
linux_sys_uname (linux_misc.c) returns the value of linux_machine which
is now defined
in linux_sysctl.c as:

 char linux_machine[128] = "";

so if you move your "#if 0" 4 lines down just before the sysctl but
after the strlcpy,
linux_machine contains a useful value, so yes, the sysctl itself is not
necessary
but the strlcpy.

linux_machine was added to linux_sysctl.c by mrg in version 1.26, I did
not find where
it was defined before.

Joachim






Home | Main Index | Thread Index | Old Index