Subject: Re: two historical question about kern_ktrace.c
To: None <tech-kern@netbsd.org>
From: Christos Zoulas <christos@zoulas.com>
List: tech-kern
Date: 02/26/2004 23:27:34
In article <200402262314.i1QNE2q13977@bicky-holiday.enami.but-b.or.jp>,
enami tsugutomo <enami@but-b.or.jp> wrote:
>Can someone can remember why?
>
>1) Following code is added in rev. 1.42.  What was the possible
>   deadlocks?  I'd like to know if there is some sample scinario.
>
>+	/*
>+	 * Mark fp non-blocking, to avoid problems from possible deadlocks.
>+	 */
>+
>+	fp->f_flag |= FNONBLOCK;
>+	(*fp->f_ops->fo_ioctl)(fp, FIONBIO, (caddr_t)&one, curp);
>
>2) In rev. 1.39, struct ktrace_header was changed to allocated on
>   stack rather than malloc.  Is this just for efficiency, or is there
>   any other reason?

My guess is to prevent it from blocking/sleeping because we are careless
and we are calling ktrace functions from points where sleeping is not allowed?

christos