Subject: Re: Sane exit from a program on receipt of a signal
To: NetBSD User-Level Technical Discussion List <>
From: Greg A. Woods <>
List: tech-userlevel
Date: 07/26/2007 13:24:15
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

At Wed, 25 Jul 2007 16:46:15 +1000, Luke Mewburn wrote:
Subject: Re: Sane exit from a program on receipt of a signal
> Here's a minor rewrite of my 2nd attempt, based on some
> feedback I received privately from a friend.
> Changes:
>  * Highlight that memset() isn't technically async safe per signal(7).
>    I thought about removing it entirely, but as you & I chatted
>    privately, memset() should be safe. (why wouldn't it be??)
>    I want to avoid C99 features to zero it.
>    The function should be portable to other platforms,
>    which means we shouldn't assume BSD extensions like
>    sigaction.sa_sigaction are present to explicitly zero.
>    OTOH, autoconf can solve that problem :)
>  * (Temporarily) block the signal whilst we set the default handler.
>  * Raise the signal and then unblock it.
> I've also renamed it to 'raise_default_signal()'

I never liked the name "raise" to be used in conjunction with Unix-like
signals for some reason.....  (maybe I just don't like the gratuitous
API changes and inventions that ANSI C took it upon itself to foist upon
the world)

In any case as a very minor suggestions I think it would be better
(cleaner, clearer, and a tiny bit more efficient) to use kill() directly
instead of wrapping it with raise().

						Greg A. Woods

H:+1 416 218-0098 W:+1 416 489-5852 x122 VE3TCP RoboHack <>
Planix, Inc. <>       Secrets of the Weird <>

Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit

Version: PGPfreeware 5.0i for non-commercial use
MessageID: jhGtVdDpFg4tD3q5BqSBy+lIK0vNCt+K