[PATCH v2 09/14] Print backtrace in a signal-safe manner

Alan Coopersmith alan.coopersmith at oracle.com
Mon Apr 9 13:12:11 PDT 2012


On 04/ 9/12 01:09 PM, Chase Douglas wrote:
> 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.

Ah, okay, never mind my comment then, I'd just remembered sprintf being
called out in the original message as the reason you started down this path.

-- 
	-Alan Coopersmith-              alan.coopersmith at oracle.com
	 Oracle Solaris Engineering - http://blogs.oracle.com/alanc


More information about the xorg-devel mailing list