[PATCH v2 09/14] Print backtrace in a signal-safe manner
Chase Douglas
chase.douglas at canonical.com
Mon Apr 9 13:09:23 PDT 2012
On 04/09/2012 12:55 PM, Alan Coopersmith wrote:
> On 04/ 9/12 11:17 AM, Chase Douglas wrote:
>> Backtraces are often printed in signal context, such as when a segfault
>> occurs.
>
> There's no need to fix the Solaris versions of that function - Solaris
> documents sprintf & snprintf as signal-safe:
>
> http://docs.oracle.com/cd/E23824_01/html/821-1465/sprintf-3c.html#scrolltoc
There is one snprintf function in xorg_backtrace_frame() that has been
replaced, but I'm guessing you are referring more to all the changes in
the solaris backtrace routines.
The problem with ErrorF() isn't only *printf. It ends up calling
LogVWrite(), which uses FILE operations and potentially calls realloc(),
neither of which are likely signal safe in any operating system.
To be clear with regards to the snprintf that has been replaced, I think
the change stands on its own anyway. There's no need to save a header
string into a buffer when we could just print it out right then and be
done with it.
-- Chase
More information about the xorg-devel
mailing list