Subject: Re: emuldata addition
To: None <sommerfeld@orchard.arlington.ma.us>
From: Jaromír Dolecek <dolecek@ibis.cz>
List: tech-kern
Date: 10/30/2000 22:58:38
Bill Sommerfeld wrote:
> one additional comment: an emulation may want to put data which may
> need cleanup. how about adding a destructor function to the emualtion
> ops structure?
>
> void *(*e_free_emuldata) __P((struct proc *));
Probably yes - I think that what Chris said makes sense, so I'm thinking
about adding three new members (I'm open to suggestions on better names):
/*
* Called on exec - commonly, allocates new p_emuldata structure
* if appropriate for given emulation.
*/
void *(*e_proc_exec) __P((struct proc *newproc));
/*
* Called on fork1() - either copies the emuldata from parent,
* creates new, or does anything appropriate.
*/
void *(*e_proc_fork) __P((struct proc *child, struct proc *parent));
/*
* Called when process exits - commonly, frees any per-process
* emulation-specific resources.
*/
void *(*e_proc_exit) __P((struct proc *));
sys_exec() should handle special case where the process would be replaced
by process of different emulation - in that case, e_proc_exit() of
previous emulation is called before e_proc_exec() of new emulation
would be called. Or maybe separate e_proc_free() should be added for this
case, too ?
Hmm, it's getting a bit more complicated than I originally though :(
Some more changes to the emulation subsystem would need to happen
to make emulations loadable via LKM in future - it should not be too hard,
even. But I personally don't feel doing that right now, though
it would save me lot of debugging time.
Jaromir
--
Jaromir Dolecek <jdolecek@NetBSD.org> http://www.ics.muni.cz/~dolecek/
@@@@ Wanna a real operating system ? Go and get NetBSD, damn! @@@@