Subject: Re: Pathname translation for emulations (Was: Re: Removing compat/aout)
To: Christoph Hellwig <hch@caldera.de>
From: Jaromir Dolecek <jdolecek@netbsd.org>
List: tech-kern
Date: 03/08/2002 20:25:30
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" ;-)

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. 
 
Jaromir
-- 
Jaromir Dolecek <jdolecek@NetBSD.org> http://www.NetBSD.org/Ports/i386/ps2.html
-=- We should be mindful of the potential goal, but as the tantric    -=-
-=- Buddhist masters say, ``You may notice during meditation that you -=-
-=- sometimes levitate or glow.   Do not let this distract you.''     -=-