This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] signal-safe fprintf?


On 7 March 2013 14:12, OndÅej BÃlka <neleai@seznam.cz> wrote:
> As threshold for mmap in malloc is 256k it would not make much
> difference.
>
> 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
> benefit.

That was meant to be a joke, directed at my previous patches to add
magic environment variables to 'resolve' differences in user
expectations.

Siddhesh
-- 
http://siddhesh.in


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]