pthreads-hackers
[Top][All Lists]
Advanced

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

[Pthreads-hackers] Re: those weak_alias things in pthreads


From: Jeroen Dekkers
Subject: [Pthreads-hackers] Re: those weak_alias things in pthreads
Date: Fri, 25 Jan 2002 16:48:22 +0100
User-agent: Mutt/1.3.25i

On Fri, Jan 25, 2002 at 04:13:08PM +0100, Marcus Brinkmann wrote:
> On Fri, Jan 25, 2002 at 03:54:26PM +0100, Jeroen Dekkers wrote:
> > Are you thinking that *all* functions have a weak_alias and __
> > prepended just for fun? It has a reason, namely that the user can
> > override the functions. Glibc itself will still call the internal
> > function, because it calls the functions with __ prepended.
> 
> I have asked Roland about __foo vs. foo, and this is what he said:
> 
> > > when do you use __foo and set a weak alias, and when not?
> >
> > In general you can match what the linuxthreads code does for this.  The
> > reason for the __foo names is so those internal can be used by some other
> > function from a standard that does not define foo.  For example, ISO C does
> > not define "open", so fopen has to call "__open".  So in general, anything
> > used by the internals of standard other functions usually has to have __.
> 
> I read it this way:  "If the implementation of bar is using foo, but foo is
> not defined in the same standard as bar, then bar _must_ _not_ be affected
> by a user overriding foo, so bar must use __foo and not foo, so it always
> gets the internal version.
> 
> I am not yet sure, and have asked Roland for clarification, if the converse
> is also true, that is, if foo is in the same standard as bar, should bar
> then always use foo, or should it sometimes use __foo instead (one
> particular example is __pthread_self).  But for now, I am taking what he
> said literally, and look at what linuxthread does, and it does not use the
> __ form with the weak alias.
> 
> It might be that we need to put some functions in the __ form again when
> they are used by other functions in glibc.  That is easy enough to do, but
> we should do it on purpose.  For example, the __pthread_mutex_* functions
> seem to belong to this group, so I will not change them.

I thought just all functions should use the __ form. This is nowhere
documented however, just like a lot of other stuff. Generally I don't
do what linuxthreads does, because I really don't like it and rather
don't read the code as IMHO it's ugly (It has linux in its name, that
might be the reason :-)). Anyway let's wait what Roland says.

Jeroen Dekkers
-- 
Jabber supporter - http://www.jabber.org Jabber ID: address@hidden
Debian GNU supporter - http://www.debian.org http://www.gnu.org
IRC: address@hidden

Attachment: pgp3n9uy3zHVU.pgp
Description: PGP signature


reply via email to

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