Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 09 Dec 1999 18:00:46 +0800
From:      Peter Wemm <peter@netplex.com.au>
To:        Jason Evans <jasone@canonware.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Possible libc changes to support LinuxThreads 
Message-ID:  <19991209100046.C77CC1CA0@overcee.netplex.com.au>
In-Reply-To: Message from Jason Evans <jasone@canonware.com>  of "Thu, 09 Dec 1999 00:35:17 PST." <19991209003517.E73529@sturm.canonware.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
Jason Evans wrote:
> I've got a port of the most recent LinuxThreads (glibc-linuxthreads-2.1.2)
> running, but ran into a couple of minor problems integrating with our libc.
> LinuxThreads redefines a number of functions in order to make them either
> support thread cancellation or work correctly.
> 
> The following functions need an alternative name, just as, for example,
> write() is actually _write():
> 
> lseek()
> pause()
> system()
> tcdrain()
> wait()
> waitpid()
> recv()
> send()
> 
> This would allow implementing cancellation points for these functions.  All
> in all, I won't lose much sleep over this, but if it's easy to do and
> doesn't violate some rule of symbol naming, it would be nice.

You know about weak symbol redirection, right?  It basically allows runtime
resolution of symbols instead of link time.  So, you could have a weak
pointer from lseek to _lseek and provide a _lseek function in libc.  When
programs link against "lseek" (including within libc itself), they hold a
pointer to the non-redirected name.  If you *also* provide a "lseek" in
libpthreads from linuxthreads, then at runtime everything (including libc) will
use the lseek() in the thread library and not _lseek().

Look for __weak_reference() etc, there are some examples in libc/net/* (but
those are for different problems).

Cheers,
-Peter
--
Peter Wemm - peter@FreeBSD.org; peter@yahoo-inc.com; peter@netplex.com.au



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




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