On Fri, Oct 10, 2014 at 01:10:10PM -0500, Quentin Barnes wrote: > On Thu, Oct 09, 2014 at 08:53:20PM -0400, David Korn wrote: > > I tried to preallocate a number of siginfo_t's but it is possible to still > > require malloc(). > > > > One way of avoiding this is to use a /tmp fiile. With sftmp() you can > > specify a size that will allow it to use memory and only create a file if > > it overflows. > > Use of malloc() in a signal handler must be avoided at all costs. It > is illegal under POSIX since it is not an async-signal-safe function > (see at the end of section 2.4.3 for a list of the legal functions that > can be called while in signal handling context > http://pubs.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html) > > Using malloc() in a signal handler, even rarely, will still lead to random > deadlocks on many systems. > > Quentin
Indeed this is what I see here. An option could be an array which includes the siginfo_t type together with signal safe (b)locking using sigsetmask() to avoid an overrun of the array. Even the handler its self could be part of the array to be able to delay the execution but this requires a perfect house holding of the actual depth of the (b)locking depth. Werner -- "Having a smoking section in a restaurant is like having a peeing section in a swimming pool." -- Edward Burr
pgpITIIaKfeg8.pgp
Description: PGP signature
_______________________________________________ ast-users mailing list ast-users@lists.research.att.com http://lists.research.att.com/mailman/listinfo/ast-users