This is the mail archive of the
mailing list for the glibc project.
Re: [RFC] signal-safe fprintf?
On 7 March 2013 14:12, OndÅej BÃlka <email@example.com> wrote:
> As threshold for mmap in malloc is 256k it would not make much
> Timewise it is dominated by printf printing 65537 characters or more.
> Problem with this approach is that it only shifts signal safety of mmap
> which can be also overriden.
Right, mmap is not guaranteed by the standard to be signal safe
either, but it tends to work in practice compared to malloc.
In fact, I just had a quick look at the vfprintf code and I think the
malloc is not the only problem you'll have to work around. The
vfprintf code locks the FILE, which can cause a deadlock if a signal
handler was called with that lock held.
>> We could also have a magic environment variable that allows the code
>> to use malloc instead, reverting to old behaviour ;)
> I do not see how this could be useful except for small performance
That was meant to be a joke, directed at my previous patches to add
magic environment variables to 'resolve' differences in user