From owner-freebsd-hackers Tue Oct 2 12: 2:23 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from InterJet.elischer.org (c421509-a.pinol1.sfba.home.com [24.7.86.9]) by hub.freebsd.org (Postfix) with ESMTP id EAD1237B401; Tue, 2 Oct 2001 12:02:19 -0700 (PDT) Received: from localhost (localhost.elischer.org [127.0.0.1]) by InterJet.elischer.org (8.9.1a/8.9.1) with ESMTP id MAA92550; Tue, 2 Oct 2001 12:43:55 -0700 (PDT) Date: Tue, 2 Oct 2001 12:43:54 -0700 (PDT) From: Julian Elischer To: Peter Pentchev Cc: Greg Lehey , Gersh , Bernd Walter , Anjali Kulkarni , freebsd-hackers@FreeBSD.ORG Subject: Re: setjmp/longjmp In-Reply-To: <20011002160414.B10919@ringworld.oblivion.bg> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Tue, 2 Oct 2001, Peter Pentchev wrote: > On Mon, Oct 01, 2001 at 10:56:24AM +0930, Greg Lehey wrote: > > [Format recovered--see http://www.lemis.com/email/email-format.html] > > > > On Friday, 28 September 2001 at 10:12:14 -0700, Julian Elischer wrote: > > > On Fri, 28 Sep 2001, Gersh wrote: > > >> On Fri, 28 Sep 2001, Bernd Walter wrote: > > >>> On Fri, Sep 28, 2001 at 07:03:51PM +0530, Anjali Kulkarni wrote: > > >>>> Does anyone know whether it is advisable or not to use > > >>>> setjmp/longjmp within kernel code? I could not see any > > >>>> setjmp/longjmp in kernel source code. Is there a good reason for > > >>>> this or can it be used? > > >>> > > >>> You need to look again, it's used in several places in the kernel. > > >> > > >> Look at sys/i386/i386/db_interface.c > > > > > > Yeah but it would probably be a pretty bad idea to use it without > > > very careful thought. Especialy with the kernel becoming > > > pre-emptable in the future.. > > > > Can you think of a scenario where it wouldn't work? Preemption > > doesn't tear stacks apart, right? > > How about a case of a longjmp() back from under an acquired lock/mutex? > Like function A sets up a jump buffer, calls function B, B acquires > a lock, B calls C, C longjmp()'s back to A; what happens to the lock? > > It would work if A were aware of B's lock and the possibility of a code > path that would end up with it still being held; I presume that this is > what Julian meant by 'very careful thought'. pretty much... > > G'luck, > Peter > > -- > Do you think anybody has ever had *precisely this thought* before? > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message