Subject: Re: Emulation: selecting emulation root at runtime?
To: John Nemeth <jnemeth@victoria.tc.ca>
From: Eric Haszlakiewicz <erh@nimenees.com>
List: current-users
Date: 08/24/2007 11:23:50
On Fri, Aug 24, 2007 at 02:06:14AM -0700, John Nemeth wrote:
> On Jan 14,  4:24am, =?ISO-8859-15?Q?Joachim_K=F6nig?= wrote:
> } 
> } Now that pkgsrc has a powerful emulation handling infrastructure
> } I'd like to know if it is possible to have different emulation roots
> } installed in parallel (for a given emulation, e.g. linux) and select
> } the emulation root for running a foreign binary at runtime, e.g.
...
> } Would be easy to add such a functionality or is the fixed emulation root
> }  hardwired in many places?
> 
>      Inside the kernel...  The kernel looks in /emul/<emulated OS>, so
> you would have to somehow convince the kernel to have a per binary
> emulation root.

That wouldn't be that hard to do in a limited way, with a few hard coded
paths.  You'd need an alternate linux_elf32_probe in compat/linux/common/
(linux_exec_elf32.c), an additional struct emul in linux_exec.c, and
add that emul structure to the list in exec_conf.c.
	Alternatly you could change emul_find_root in compat_util.c, but
letting an arbitrary root be specified has some security implications,
similar to LD_LIBRARY_PATH but worse.

eric