Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 03 Oct 2002 10:33:35 +1000
From:      Gregory Bond <gnb@itga.com.au>
To:        "Jin Guojun [DSD]" <j_guojun@lbl.gov>
Cc:        freebsd-bugs@FreeBSD.ORG
Subject:   Re: kern/43599: Balloc did not check mallocated pointer in libc/stdlib/strtod.c 
Message-ID:  <200210030033.KAA01121@lightning.itga.com.au>
In-Reply-To: Your message of Wed, 02 Oct 2002 16:10:04 -0700.

next in thread | raw e-mail | index | archive | help
> "man stdio" does not say this. Is this BSD specific?

No, signal handlers have always had very limited capability.  IIUC, under the
broader ANSI C standards, all they can reliably and portably do is set a
variable of type "volatile sig_atomic_t" and return.  Most real systems are
more forgiving, but not limitless.

[One of the real pains in the first ANSI C standardisation process was dealing
with the then-common practice of calling longjmp() from a signal handler.
There is simply no way to make this work anything like reliably or portably, so
it is not required by the standard, even tho many C libraries jump through ugly
hoops to try and make it work.]

For FreeBSD, signal(3) contains the sentence:

     See sigaction(2) for a list of functions that are considered safe for use
     in signal handlers.

And sigaction(2)  has a list of 40-50 system calls and functions [notably _not_
including any STDIO ones, or longjmp()] and the comment:

     All functions not in the above lists are considered to be unsafe with
     respect to signals.  That is to say, the behaviour of such functions when
     called from a signal handler is undefined.




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200210030033.KAA01121>