Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Aug 1996 07:54:10 +1000 (EST)
From:      John Birrell <cimaxp1!jb@werple.net.au>
To:        lambert.org!terry@melb.werple.net.au (Terry Lambert)
Cc:        fgate.flevel.co.uk!dev@melb.werple.net.au, lambert.org!terry@melb.werple.net.au, india.hp.com!koshy@melb.werple.net.au, FreeBSD.ORG!freebsd-hackers@melb.werple.net.au
Subject:   Re: FreeBSD vs. NT Stability
Message-ID:  <199608142153.HAA00843@melb.werple.net.au>
In-Reply-To: <199608141659.JAA29213@phaeton.artisoft.com> from "Terry Lambert" at Aug 14, 96 09:59:57 am

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> libc_r.  build libc_r, and you will have a reentrant (hence the "_r")
> libc.  The POSIX threading is build into the library (under uthread or
> something, I think; you will need to look at the sources to be sure).

No. libc_r builds like libc. The directories below /usr/src/lib/libc_r
should _not_ be built on their own. Do this....

cd /usr/src/lib/libc_r
make depend && make all && make install

The resulting libc_r includes all the libc functions, _plus_ the POSIX
thread functions. As Amancio said, link to -lc_r (and use -nostdlib to
leave out libc).

FWIW, libc_r is not fully reentrant (yet) -- the code in libc needs a
*lot* of work for this. The commonly used functions are OK (i.e. all
the file, memory allocation, socket ones). Things that aren't reentrant
are those (like gethostbyname) that don't have arguments that allow them
to be made reentrant. For these, *_r functions need to be added to libc_r,
but this is best done by rewriting the underlying functions (in libc) so
that they do not use static storage and making the traditional function
a wrapper with static storage.

[I still hold out hope that this work could be shared between FreeBSD
and NetBSD (& OpenBSD?) -- I don't see why the libc implementations have
to differ. And before Terry (8-)>) starts a whole new thread, the standard
libc really should have thread stubs (with weak symbols) to avoid having
much of libc mapped into memory a second time in the form of libc_r. Then a
standard program would just link against libc as normal. A threaded
program would link against libc and then against libpthread which would
contain just POSIX thread functions that are linked instead of the stubs.
AFAIK, FreeBSD doesn't support weak symbols.]

> 
> 
> 					Terry Lambert
> 					terry@lambert.org

Regards,

-- 
John Birrell                                CIMlogic Pty Ltd
jb@cimlogic.com.au                          119 Cecil Street
Ph  +61  3 9690 6900                        South Melbourne Vic 3205
Fax +61  3 9690 6650                        Australia
Mob +61 18  353  137



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