Subject: Re: lwp_emuldata
To: Emmanuel Dreyfus <>
From: Matt Thomas <>
List: tech-kern
Date: 12/13/2003 08:34:07
On Dec 13, 2003, at 3:51 AM, Emmanuel Dreyfus wrote:

> So here is what we could do:
> - add l_emuldata in struct lwp
> - add void e_newlwp and e_lwp_exit hooks in struct emul:
> void e_newlwp(struct lwp *l1, struct lwp *l2);
> void e_lwp_exit(struct lwp *l);

I'd like to see a second int argument, 'const struct emul *newemul' 
can take will be either a pointer to new emul of the process if execing
or NULL if exiting.

> - call e_newlwp just before returning from newlwp

Wouldn't e_lwp_fork be a better name since it corresponds to

> - call e_lwp_exit at the very beginning of lwp_exit (after the DPRINTF)

There should also be a call to e_lwp_exit with the emulation before exec
commits to execing a new program.  (assume you run the OSX sh and then
exec a NetBSD program, shouldn't the OSX emul data be removed?)

> As far as COMPAT_MACH is concerned, e_newlwp does not need the parent
> thread l1. Should we have it anyway?

Yes.  It doesn't hurt to have it.