Calling malloc from a signal handler

Daniel Eischen deischen at
Fri Sep 19 16:40:30 UTC 2008

On Fri, 19 Sep 2008, Stephen Montgomery-Smith wrote:

> I notice that if you use "malloc" from within a signal handler on 
> FreeBSD-6.x, that you can potentially trigger a "recursive call" error.
> But this seems to have changed in FreeBSD-7.x.
> Is it now permissible to call "malloc" from within a signal handler in 
> FreeBSD-7.x?
> If so, should the man page of "sigaction(2)" be upgraded to say this?

You shouldn't call malloc() or any other function that
isn't async-signal-safe from a signal handler.  I don't
think we should say if it works or not, since it is
not portable and could change at any given time in
future versions of FreeBSD.


More information about the freebsd-stable mailing list