[PATCH v3 05/16] Add LogMessageVerbSigSafe() for logging messages while in signal context
Alan Coopersmith
alan.coopersmith at oracle.com
Mon May 14 15:09:41 PDT 2012
On 05/14/12 12:32 PM, Chase Douglas wrote:
> On 05/10/2012 11:23 PM, Peter Hutterer wrote:
>> On Mon, Apr 16, 2012 at 11:14:22AM -0700, Chase Douglas wrote:
>
> [snip]
>
>>> void
>>> +LogWriteSigSafe(int verb, const char *f, log_param_t *args, int num_args)
>>> +{
>>> + static char tmpBuffer[1024];
>>> + int len = 0;
>>> + char number[20];
>>> + static Bool newline = TRUE;
>>> +
>>> + if (newline) {
>>> + CARD32 ms = GetTimeInMillis();
>>
>> GetTimeInMillis calls gettimeofday() which isn't signal-safe, afaict.
>
> Thanks for catching that. We could switch to clock_gettime(), but I'm
> not sure what differences, if any, there would be between it and
> gettimeofday(). For now, I've removed the timestamp printing. Someone
> else can come along and add the timestamp back in if they want.
GetTimeInMillis already calls clock_gettime on platforms that support
CLOCK_MONOTONIC* at an appropriate resolution, falling back to gettimeofday()
on others:
http://cgit.freedesktop.org/xorg/xserver/tree/os/utils.c#n409
--
-Alan Coopersmith- alan.coopersmith at oracle.com
Oracle Solaris Engineering - http://blogs.oracle.com/alanc
More information about the xorg-devel
mailing list