Subject: Re: hardcoding uname
To: Frank van der Linden <fvdl@vaasje.org>
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
List: tech-kern
Date: 01/02/2001 21:03:43
On Mon, Jan 01, 2001 at 05:07:53AM +0100, Frank van der Linden wrote:
> On Sun, Dec 31, 2000 at 12:10:49AM -0500, Todd Vierling wrote:
> > 	syssrc/sys/compat/linux/common: linux_misc.c linux_oldolduname.c
> > 	    linux_olduname.c linux_types.h
> > 
> > Log Message:
> > Hardcode what the linux uname() calls return (Linux 2.2.5 is the current
> > value). A few major applications check for this (like VMware), and
> > there is no other way to trick them. Needs a more generic solution
> > eventually.
> > 
> > =====
> > 
> > This doesn't seem right, even in the short term.  (Particularly, this
> > shouldn't persist to the 1.6 branch.)
> 
> There is currently no better solution. Several applications check for this,
> and to provide good emulation, uname() should provide these values.
> I don't give a flying f*ck about the argument "but I want netscape
> to return 'NetBSD'". If you want something cosmetic rather than having
> some binaries actually *work at all*, you're out of your mind.
> 
> A generic solution isn't that easy, because:
> 
> 	1) If you make it a sysctl, it arguably belongs in the Linux
> 	   emulation bits. However, the Linux emulation can be an LKM,
> 	   and we don't have a way to register sysctls for LKMs.
> 	2) Another option is to use p_emuldata (which would be a good
> 	   place for it), but to set this, you need a new exec() system
> 	   call. Something like execvee(argp, envp, emuldata). And
> 	   a 'linuxrun' program to go along with it. And even in that
> 	   case, returning linux values by default is the best way.

No, this can be a per-process attribute changed with a sysctl in the
proc.curproc hierarchy. All you have to do is a sysctl -w before
running your binary in a subshell.

--
Manuel Bouyer <bouyer@antioche.eu.org>
--