From owner-freebsd-hackers Thu Jan 9 8: 3:49 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 2222837B401 for ; Thu, 9 Jan 2003 08:03:48 -0800 (PST) Received: from k6.locore.ca (k6.locore.ca [198.96.117.170]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0D6F843F18 for ; Thu, 9 Jan 2003 08:03:47 -0800 (PST) (envelope-from jake@k6.locore.ca) Received: from k6.locore.ca (jake@localhost.locore.ca [127.0.0.1]) by k6.locore.ca (8.12.6/8.12.6) with ESMTP id h09G3tGb006581; Thu, 9 Jan 2003 11:03:55 -0500 (EST) (envelope-from jake@k6.locore.ca) Received: (from jake@localhost) by k6.locore.ca (8.12.6/8.12.6/Submit) id h09G3tGW006580; Thu, 9 Jan 2003 11:03:55 -0500 (EST) Date: Thu, 9 Jan 2003 11:03:55 -0500 From: Jake Burkholder To: Pawel Jakub Dawidek Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Exceptions via setjmp/longjmp in kernel. Message-ID: <20030109110355.C4032@locore.ca> References: <20030109143059.GC47263@prioris.mini.pw.edu.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20030109143059.GC47263@prioris.mini.pw.edu.pl>; from P.Dawidek@prioris.mini.pw.edu.pl on Thu, Jan 09, 2003 at 03:30:59PM +0100 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 Apparently, On Thu, Jan 09, 2003 at 03:30:59PM +0100, Pawel Jakub Dawidek said words to the effect of; > 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(). The kernel longjmp only ever seems to return 1. See i386/i386/support.s. Jake To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message