tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[PATCH] Re: sharing mutex between libc stub and libpthread



Emmanuel Dreyfus <manu%netbsd.org@localhost> wrote:

> Fixing this can be done in two way (and we can go incremental here)
> - we may decide that sharing mutex (and condvar and rwlock) between libc
> stubs and libpthread is not supported. Is we do this, the minimal libc
> stubs should not bother filling mutex fields, it can just set a magic
> different than  libpthread one, and return an error if it is given the
> libpthread magic.
> 
> - supporting the libc to libpthread handover means the implementation
> should completely move to libc. libc will have to be aware of struct
> __pthread_st, which makes me wonder if there will be much code left in
> libpthread.

Here is a third approach: if program is not linked with -lpthread, the
libpthread implementation falls back to libc stubs:
http://ftp.espci.fr/shadow/manu/uselibcstub.patch

This patch passes my ATF tests. It is not complete yet:
- it only does mutex. condvar and rwlock need to be done too
- we need to include a .h file with libc stub definitions instead of
redefining them

The advantage of this approach is that it is not an intrusive change and
it should not have a big performance impact. On the negative side, it
just cannot support calling pthread_create(), but I now beleive this
cannot be addresses without moving almost all libpthread into libc. This
could be a goal for netbsd-7 if it is decided desirable, but the present
patch would be a nice fix for netbsd-6, IMO.

Opinions?

-- 
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
manu%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index