Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Oct 2002 10:00:03 -0800 (PST)
From:      Archie Cobbs <archie@dellroad.org>
To:        John Polstra <jdp@polstra.com>
Cc:        current@FreeBSD.org, dfr@nlsystems.com
Subject:   Re: gnome on current
Message-ID:  <200210291800.g9TI036f008080@arch20m.dellroad.org>
In-Reply-To: <200210291647.g9TGlVM5049992@vashon.polstra.com> "from John Polstra at Oct 29, 2002 08:47:31 am"

next in thread | previous in thread | raw e-mail | index | archive | help
John Polstra writes:
> > > I think it would work if the symbol were defined strongly in libc_r.
> > 
> > I think so too. I was trying to work out why this wasn't how things were
> > done already. FWIW, linux's libpthread appears to be defining the
> > pthread_* symbols strongly.
> 
> I think the weak symbols have something to do with support for thread
> cancellation.  I didn't pay much attention at the time, so I don't
> know the details.  Here's the relevant commit message, I think (this
> one taken from lib/libc_r/uthread/uthread_pause.c):
> 
>   date: 2001/01/24 13:03:34;  author: deischen;  state: Exp;  lines: +4 -4
>   Add weak definitions for wrapped system calls.  In general:
> 
> 	  _foo - wrapped system call
> 	  foo - weak definition to _foo
> 
>   and for cancellation points:
> 
> 	  _foo - wrapped system call
> 	  __foo - enter cancellation point, call _foo(), leave
> 		  cancellation point
> 	  foo - weak definition to __foo

To me it appears that weak symbols are not related to thread cancellation
other than by coincidence. All this commit is saying is that the functionality
of the libc_r version of "foo()" is split into two functions, one of
which is a public entry point (__foo()) and the other of which is for
internal use by libc_r (_foo()). The public entry point just calls the
internal version after satisfying the requirement that the function
be a cancellation point.

In other words, weak symbol are used for non-cancellation point functions
as well, and are not required for implemention cancellation points.

It might have been slightly clearer if the _foo and __foo names had been
reversed, so that "foo" always weakly referenced "_foo" whether or not
the function was a cancellation point. But that would have probably
caused a lot of changes in existing code (?).

-Archie

__________________________________________________________________________
Archie Cobbs     *     Packet Design     *     http://www.packetdesign.com

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200210291800.g9TI036f008080>