From owner-freebsd-hackers Tue Jan 11 10:35:34 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from canonware.com (canonware.com [207.20.242.18]) by hub.freebsd.org (Postfix) with SMTP id 2201F15453 for ; Tue, 11 Jan 2000 10:35:32 -0800 (PST) (envelope-from jasone@canonware.com) Received: (qmail 2721 invoked by uid 1001); 11 Jan 2000 18:35:27 -0000 Date: Tue, 11 Jan 2000 10:35:27 -0800 From: Jason Evans To: "Richard Seaman, Jr." Cc: freebsd-hackers@FreeBSD.ORG Subject: Adding alternate entry points to libc (was Re: Possible libc changes to support LinuxThreads) Message-ID: <20000111103527.A302@sturm.canonware.com> References: <19991209003517.E73529@sturm.canonware.com> <19991209064256.B34152@tar.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <19991209064256.B34152@tar.com>; from dick@tar.com on Thu, Dec 09, 1999 at 06:42:56AM -0600 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Thu, Dec 09, 1999 at 06:42:56AM -0600, Richard Seaman, Jr. wrote: > It's my impression that glibc uses a three (four?) tiered naming > convention. The "pure" syscall (in our case, eg. _write()). Then > there is the version used internally in glibc (eg. _libc_write(). > And finally, the version exported from glibc (eg. write()). > > The merit to the three tiered system is that you might need to rewrite > the version used internally to libc for threads, but still have this > be different from the version exported from the library (eg. to > implement cancallation points without propagating them throughout > libc). > > In this case, you'd want, for example, an _lseek(), _libc_lseek(), > and _seek(). > > The problem with cancellation points, libc and linuxthreads has been > that you need to wade through libc and replace instances of, for > example, write() with either _write() or _libc_write() in order to > avoid propagating cancellation points where they don't belong. I'm working on adding alternate entry points to libc now. The naming approach I'm taking is: fwrite() <-- Alternate entry point that is used externally unless another library overrides it. _libc_fwrite() <-- `_libc_' prefix. Alternate entry point for internal library use. __fwrite() <-- `__' prefix. Actual name. The reason for a prefix of `__' instead of `_' in the actual name case is that using only one underscore would be ambiguous at least in the cases of setjmp()/_setjmp() and longjmp()/_longjmp(). One issue I'm not sure on is whether *every* libc interface should have alternate entry points added. Doing so would be more consistent, but it probably isn't necessary, since POSIX very clearly defines the set of functions that may act as cancellation points. There end up being a few other functions that need wrapped by threads libraries as well. Of course, doing only the necessary ones is easier for me. =) If only adding alternate entry points for the necessary libc interfaces, there's a good chance I can get this done for 4.0, which will mean compliant thread cancellation for both libc_r and linuxthreads. A genuine libpthread is just a hop, skip, and a jump from there. Jason To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message