Subject: Re: emuldata addition
To: =?iso-8859-1?Q?Jarom=EDr_Dolecek?= <dolecek@ibis.cz>
From: Jason R Thorpe <thorpej@zembu.com>
List: tech-kern
Date: 10/29/2000 08:34:05
On Sun, Oct 29, 2000 at 01:09:39PM +0100, Jaromír Dolecek wrote:

 > Do you have any comments on this ? 

Looks good, just one comment:

 > Index: kern/kern_exec.c
 > ===================================================================
 > RCS file: /cvsroot/syssrc/sys/kern/kern_exec.c,v
 > retrieving revision 1.121
 > diff -u -r1.121 kern_exec.c
 > --- kern/kern_exec.c	2000/09/28 19:05:07	1.121
 > +++ kern/kern_exec.c	2000/10/29 12:03:54
 > @@ -523,6 +523,10 @@
 >  	/* setup new registers and do misc. setup. */
 >  	(*pack.ep_emul->e_setregs)(p, &pack, (u_long) stack);
 >  
 > +	/* allocate per-process emulation data, if given emulation needs it */
 > +	if (pack.ep_emul->e_alloc_emuldata)
 > +		p->p_emuldata = (*pack.ep_emul->e_alloc_emuldata)(p);
 > +

This should probably be:

	/*
	 * Free any per-process emulation data we may already have,
	 * and then allocate new emulation data if our new emulation
	 * requires it.
	 */
	if (p->p_emuldata)
		free(p->p_emuldata)
	if (pack.ep_emul->e_alloc_emuldata)
		p->p_emuldata = (*pack.ep_emul->e_alloc_emuldata)(p);
	else
		p->p_emuldata = NULL;

-- 
        -- Jason R. Thorpe <thorpej@zembu.com>