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.The malloc implementation is completely new in FreeBSD 7, so not all of the internal error checking code is the same.> Is it now permissible to call "malloc" from within a signal handler in > FreeBSD-7.x?Calling malloc from within a signal handler can cause application deadlock, so although you won't see an error message printed, you are unlikely to be happy with the results. Jason
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? Thanks, Stephen
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. -- DE