Subject: Re: Pathname translation for emulations (Was: Re: Removing compat/aout)
To: Jaromir Dolecek <jdolecek@netbsd.org>
From: Bill Studenmund <wrstuden@netbsd.org>
List: tech-kern
Date: 03/08/2002 13:02:10
On Fri, 8 Mar 2002, Jaromir Dolecek wrote:

> Christoph Hellwig wrote:
> > In Linux every architecture has to define a hook, __emul_prefix that is
> > supposed to either return NULL for a native binary or a path prefix for
> > non-native binaries.  Architectures that do have any foreign personality
> > (like i386 without my Linux-ABI patch) can just define __emul_prefix to
> > NULL and have no additional cost, others just do a big switch() on the
> > available personalities.
>
> I just shriek in terror on this :)
> Hehe, __emul_prefix() as per-architecture thing (possibly with MD
> hooks for kmods?), that is quite insane way of doing system engineering.
> "Linux" ;-)

JD, could you please be nice? Christoph was, as best I could tell,
politely trying to share how other systems do things. That doesn't mean we
have to do it, or do it that way.

The best part of the idea I've heard is that emulations feed info to an MI
part of the kernel. And I think we should learn from that.

> On NetBSD, we have the path prefix as a part of struct emul, which
> is per-emulation. p->p_emul points to this structure, which contains
> also other emulation-specific stuff, like errno translation etc.
> Those CHEC_ALT_*() macros are merely readability wrappers
> around emul_find(), and use the path name prefix implicitly to
> do their work.
>
> FWIW, I prefer if all stuff related to any emulation is within
> emulation-specific code if at all possible.

In principle I agree with you. But if we have the same code in every
emulation except for the name, we should centralize it. And I think we can
do this w/o adding much impact to native code (testing for a null
pointer).

Take care,

Bill