Porting NPTL to GNU/kFreeBSD?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Porting NPTL to GNU/kFreeBSD?

Brian M. Carlson
Some Debian developers and users are creating a new (but as of yet unincluded
in unstable) Debian port that uses the FreeBSD kernel as well as the GNU
userland (glibc, coreutils, etc.).  We call this port GNU/kFreeBSD, and so
far, it runs on i386-style machines only (i486-i686 inclusive).  In order to
do this, we have ported glibc 2.3 to the FreeBSD kernel, based mostly off the
work of Bruno Haible.  We have a (mostly) working threads implementation with
LinuxThreads (e.g. KDE works).  However, I have seen in the CVS repository
that glibc 2.4 will not support LinuxThreads any longer [0].  As a
consequence, I feel it is essential to port NPTL to the FreeBSD kernel for
the port's continued health.  

We are currently using FreeBSD 5.4 as the basis; when we figure out why the
FreeBSD 6.0 kernel/glibc combination doesn't like sshd anymore and fix it, we
will likely move to that.

I am not asking for people to do this task; I will do it, but I have some
questions:

Are there any portability traps of which I need to be aware (other than the
obvious)?
FreeBSD's libpthread/libkse is M:N, while libthr is 1:1.  I am unsure whether
libthr's kernel support works on i386, so I'd like to get NPTL to
conditionally support M:N if possible.  Is this a silly idea?
Is there anything else important that I need to know?

I am subscribed; no need to Cc: me.

[0]
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/NEWS?rev=1.156&content-type=text/x-cvsweb-markup&cvsroot=glibc

--
Brian M. Carlson <[hidden email]>
Running on GNU/kFreeBSD.
Support alternative kernels in Debian!
Reply | Threaded
Open this post in threaded view
|

Re: Porting NPTL to GNU/kFreeBSD?

Daniel Jacobowitz-2
On Sat, Nov 12, 2005 at 01:38:38AM +0000, Brian M. Carlson wrote:
> Are there any portability traps of which I need to be aware (other than the
> obvious)?

Like that the library is fundamentally designed around Linux process
assumption, ELF TLS, and the futex system?

A fully POSIX thread library for your port is a good idea, which LinuxThreads
isn't.  However, I am skeptical about how much mileage you'll be able
to get from NPTL without duplicating some of its interfaces in FreeBSD.

> FreeBSD's libpthread/libkse is M:N, while libthr is 1:1.  I am unsure whether
> libthr's kernel support works on i386, so I'd like to get NPTL to
> conditionally support M:N if possible.  Is this a silly idea?

Yes, this is a silly idea.  NPTL is built on the assumption that kernel
processes are extremely lightweight.

--
Daniel Jacobowitz
CodeSourcery, LLC