From: Keith Owens <kaos@ocs.com.au>
To: linux-kernel@vger.kernel.org
Subject: longjmp/setjmp in kernel
Date: Sun, 20 Oct 2002 21:07:20 +1000 [thread overview]
Message-ID: <23470.1035112040@ocs3.intra.ocs.com.au> (raw)
In-Reply-To: Your message of "Sun, 20 Oct 2002 11:31:35 +0100." <20021020113135.A25278@flint.arm.linux.org.uk>
On Sun, 20 Oct 2002 11:31:35 +0100,
Russell King <rmk@arm.linux.org.uk> wrote:
>For instance, one of my patches - the rdunzip one. It would be _really_
>nice to get some feedback on it; it isn't perfect, because the behaviour
>of gunzip is inherently undeterministic when given bad input data. The
>only real solution IMHO is setjmp/longjmp, which I think would suck in
>the kernel. I would have expected _this_ to attract some comments from
>people like you. Maybe you feel that setjmp/longjmp is an approprate
>solution. Unfortunately, I don't know that because no one has replied
>to tell me so.
Why should setjmp/longjmp suck in kernel? I use it in kdb to recover
from debugging errors and to quit large amounts of output without
overloading every bit of debugging code with checks for "has the user
typed q?". It meant I had to write/modify setjmp/longjmp code to work in
the kernel for i386 and ia64, no big deal.
Given the kernel model, there are few places where setjmp/longjmp make
sense. If the code takes locks, disables interrupts etc. then forget
setjmp, cleanup after longjmp is too messy. But if you want to recover
from unexpected events in a large body of code which does not take
locks then it is a valid use for longjmp, especially if the code
requires several levels of function calls and you want to bail out from
a low level function.
next prev parent reply other threads:[~2002-10-20 11:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-20 9:35 [PATCH] ext2/3 updates for 2.5.44 (1/11): Default mount options in superblock tytso
2002-10-20 10:09 ` [LARGE patch 23/124] sets sent over and over again " Arjan van de Ven
2002-10-20 10:13 ` Jens Axboe
2002-10-20 10:31 ` Russell King
2002-10-20 10:35 ` Arjan van de Ven
2002-10-20 11:07 ` Keith Owens [this message]
2002-10-20 12:39 ` Nicholas Wourms
2002-10-20 16:44 ` Richard Gooch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=23470.1035112040@ocs3.intra.ocs.com.au \
--to=kaos@ocs.com.au \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®