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 17:00:53 -0700

Yo Greg!

On Fri, 18 Oct 2013 19:46:11 -0400
Greg Troxel <address@hidden> wrote:

> > I grepped and could not find that in gpsd.  Maybe _EENTRANT is
> > enabled another way?
> 
> This is curious; I don't immediately see how defining something in
> one's .c file changes the behavior of the compiled library.

Check out the errno example I gave:
        /usr/include/bits/errno.h

If _REENTRANT is not defined, then errno is a simple static.  
If _REENTRANT is defined, then each thread has its own copy of errno.

Given that errno is so important to C programing it should be obvious that
is needed to make a program thread safe.

> Also, gpsd has to be written to the C99/POSIX libc specs, not glibc,

And there is an equivalent POSIX define that does the same thing.  No
reason this can not be POSIX compliant.  Clearly it is not POSIX thread
compliant now.

> That sais, I'm not
> really clear what POSIX says about errno (it kind of seems like it
> has to be thread-local to be sane).

From what I can tell the POSIX and glibc rules are very similar.

See the explanatin here:
        http://www.unix.org/whitepapers/reentrant.html

So it looks to me you need _REENTRANT to make GNU libc POSIX complient.

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]