gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gpsd-dev] PPS and privilege-dropping


From: Gary E. Miller
Subject: Re: [gpsd-dev] PPS and privilege-dropping
Date: Fri, 18 Oct 2013 15:08:33 -0700

Yo Eric!

On Fri, 18 Oct 2013 15:54:50 -0400
"Eric S. Raymond" <address@hidden> wrote:

> Gary E. Miller <address@hidden>:
> > But that is the bug, you can not have a JSON emitter in the PPS
> > thread!
> 
> I've fixed the problem.  The right thing to do is to put a mutex
> exclusion around the one socket send(2) that's used for all JSON
> writes to clients; the function is throttled_write() in gpsd.c.  Now,
> no matter how control arrives there, no two of those sends while be
> able to fire at once.  No more garbled output.

Yeah, that looks good.

I was looking at the GNU libc doc and notice that glibc is NOT thread
safe unless one of these macros are declared:
        #define _REENTRANT
        #define _THREAD_SAFE

http://www.delorie.com/gnu/docs/glibc/libc_13.html

It seems that things like errno are a simple static int (shared by all
threads) unless one of those is declared.  In thread safe mode there is
an errno for each thread.  You can see how this works in the
include: /usr/include/bits/errno.h

I grepped and could not find that in gpsd.  Maybe _EENTRANT is enabled
another way?

RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97701
        address@hidden  Tel:+1(541)382-8588

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]