bug-gnulib
[Top][All Lists]
Advanced

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

Re: lock module question


From: Yoann Vandoorselaere
Subject: Re: lock module question
Date: Wed, 05 Mar 2008 18:07:28 +0100

Le mercredi 05 mars 2008 à 17:55 +0100, Simon Josefsson a écrit :
> Yoann Vandoorselaere <address@hidden> writes:
> 
> > Le mercredi 05 mars 2008 à 16:34 +0100, Simon Josefsson a écrit :
> >> Yoann Vandoorselaere <address@hidden> writes:
> >> 
> >> > Using -pthread allow option like -D_REENTRANT to be defined when
> >> > compiling Gnulib, which sound like a requirement if the program using
> >> > Gnulib is multithreaded.
> >> 
> >> Why do you feel a need to use -D_REENTRANT?  When I looked into it
> >> recently, I decided to remove -D_REENTRANT from gnutls because it didn't
> >> seem like it was needed anymore.  glibc manual:
> >
> > [...]
> >
> >> Looking into my /usr/include, I could only find that it matters for
> >> getlogin_r*.
> >> 
> >> I know debian has a policy to add _REENTRANT but their justification
> >> seem to have been linux-threads.  I don't know if it is needed any more.
> >> 
> >> If someone could shred any light why you really would want to use
> >> _REENTRANT, that would be helpful.
> >
> > One reason to use _REENTRANT is per thread localized errno:
> >
> > #  if !defined _LIBC || defined _LIBC_REENTRANT
> > /* When using threads, errno is a per-thread value.  */
> > #   define errno (*__errno_location ())
> > #  endif
> 
> That uses _LIBC_REENTRANT, and as far as I can see, its value isn't
> influenced by _REENTRANT through any header file at least.
> 
> > Additionally, although there might be no problem under popular
> > architecture, are we certain that not using the appropriate CFLAGS won't
> > give undefined results under other architectures?
> 
> No, but we'll never find out if we keep on using it.

I wouldn't like to go for it that way. Years ago, when looking through
similar issues, I recall experiencing memory corruption bug when not
compiling library/program with the appropriate pthread cflags. 

Admittedly, theses issues might be gone, but if they are not, especially
on old systems, I would rather prevent potential problem now.

-- 
Yoann Vandoorselaere | Responsable R&D / CTO | PreludeIDS Technologies
Tel: +33 (0)8 70 70 21 58                  Fax: +33(0)4 78 42 21 58
http://www.prelude-ids.com





reply via email to

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