diff options
| author | pooka <pooka@NetBSD.org> | 2014-12-16 20:05:54 +0000 |
|---|---|---|
| committer | pooka <pooka@NetBSD.org> | 2014-12-16 20:05:54 +0000 |
| commit | bc59b09d1a686ba7cf74307c2ff244ba6a094cf6 (patch) | |
| tree | fd43f80c26325ccf4590175694c5191500a08b39 /lib/libpthread/Makefile | |
| parent | b3ead97fcc4f83d232e3b3e669a4728a8d2ebc62 (diff) | |
Allow for arbitrary MI scheduler implementations.
A concrete result is enabling unpatched libpthread to run on the
rumprun stacks (e.g. Xen and bare metal) with a non-NetBSD scheduler.
Those schedulers hook into the existing _lwp_frobnitz() NetBSD syscall
interfaces (well, "syscall" interfaces in that scenario ;)
More specifically about the change itself:
1) instead of calling _lwp_makecontext() followed by _lwp_create()
and passing the entry point in ucontext_t (MD) through the calls, roll
the calls into pthread__makelwp() and allow alternate implementations
for that MI interface.
2) allow compile-time overriding of __lwp_gettcb_fast() or
__lwp_getprivate_fast, which are inline and leak MD scheduler/thread
details into libpthread
Additionally, two small nits:
I) define LIB=pthread before including mk.conf so that it's possible
to test for LIB==pthread in mk.conf
II) make it possible to leave out pthread_cancelstub.c. This is required
by the current implementation of rumprun-posix (i.e. rumprun on
POSIX hosts) due to symbol collisions. It needs to be fixed properly
some day, but for now allows an almost-correct libpthread to run.
I am sure @justin will be happy to explain the details ;)
no change to NetBSD
tested: anita+atf
Diffstat (limited to 'lib/libpthread/Makefile')
| -rw-r--r-- | lib/libpthread/Makefile | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/libpthread/Makefile b/lib/libpthread/Makefile index 42eacccaf72..94e537b6ee4 100644 --- a/lib/libpthread/Makefile +++ b/lib/libpthread/Makefile @@ -1,7 +1,8 @@ -# $NetBSD: Makefile,v 1.84 2014/08/10 23:25:49 matt Exp $ +# $NetBSD: Makefile,v 1.85 2014/12/16 20:05:54 pooka Exp $ # WARNS?= 5 +LIB= pthread .include <bsd.own.mk> @@ -35,7 +36,10 @@ CPPFLAGS+= -D__LIBPTHREAD_SOURCE__ -D__LIBC_THREAD_STUBS # XXX: This crappy poke at libc's internals needs to be fixed. CPPFLAGS+=-I${NETBSDSRCDIR}/sys -I${.CURDIR}/../libc -LIB= pthread +# providing alternative MI implementations for creating an lwp is +# possible by setting PTHREAD_MAKELWP. Currently, alternatives are +# set by the rumprun software stacks (see repo.rumpkernel.org) +PTHREAD_MAKELWP?= pthread_makelwp_netbsd.c # # NOTE: When you create a new file for libpthread, make sure that pthread.c @@ -45,9 +49,13 @@ LIB= pthread SRCS= pthread.c SRCS+= pthread_attr.c SRCS+= pthread_barrier.c +# used by rumprun-posix to work around symbol collisions +.if ${PTHREAD_CANCELSTUB:Uyes} != "no" SRCS+= pthread_cancelstub.c +.endif SRCS+= pthread_cond.c SRCS+= pthread_lock.c +SRCS+= ${PTHREAD_MAKELWP} SRCS+= pthread_misc.c SRCS+= pthread_mutex.c SRCS+= pthread_once.c |
