From owner-freebsd-hackers Thu Jan 9 10:51:19 2003 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D34E037B401 for ; Thu, 9 Jan 2003 10:51:17 -0800 (PST) Received: from sccrmhc02.attbi.com (sccrmhc02.attbi.com [204.127.202.62]) by mx1.FreeBSD.org (Postfix) with ESMTP id 39E5F43F13 for ; Thu, 9 Jan 2003 10:51:17 -0800 (PST) (envelope-from julian@elischer.org) Received: from InterJet.elischer.org (12-232-168-4.client.attbi.com[12.232.168.4]) by sccrmhc02.attbi.com (sccrmhc02) with ESMTP id <20030109185116002000h84ve>; Thu, 9 Jan 2003 18:51:16 +0000 Received: from localhost (localhost.elischer.org [127.0.0.1]) by InterJet.elischer.org (8.9.1a/8.9.1) with ESMTP id KAA34297; Thu, 9 Jan 2003 10:51:15 -0800 (PST) Date: Thu, 9 Jan 2003 10:51:13 -0800 (PST) From: Julian Elischer To: Pawel Jakub Dawidek Cc: freebsd-hackers@freebsd.org Subject: Re: Exceptions via setjmp/longjmp in kernel. In-Reply-To: <20030109143059.GC47263@prioris.mini.pw.edu.pl> 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 how do you ensure that the thread doesn't own any locks when it does the longjmp? On Thu, 9 Jan 2003, Pawel Jakub Dawidek wrote: > Hello hackers... > > I got strange problem when trying to implement something like exceptions > with setjmp()/longjmp() functions. > > [...] > int ret; > jmpbuf buf; > [...] > ret = setjmp(buf); > KASSERT(ret != 1, ("I never return 1 with longjmp().")); > [...] > longjmp(buf, value_diffrent_than_1); > [...] > > And setjmp() returns only 0 or 1 (when longjmp() is called), but never > returns value that I've put in longjmp() call. > > There could be some other problems in using setjmp()/longjmp() > in kernel? I'm paying attention on memory leaks and locks that are > done before longjmp(). > > -- > Pawel Jakub Dawidek > UNIX Systems Administrator > http://garage.freebsd.pl > Am I Evil? Yes, I Am. > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-hackers" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message