diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libGL/Makefile | 8 | ||||
-rw-r--r-- | lib/libX11/Makefile.bsd-wrapper | 4 | ||||
-rw-r--r-- | lib/libX11/src/UIThrStubs.c | 73 |
3 files changed, 76 insertions, 9 deletions
diff --git a/lib/libGL/Makefile b/lib/libGL/Makefile index 969310729..149db7ed5 100644 --- a/lib/libGL/Makefile +++ b/lib/libGL/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.10 2007/11/25 10:18:21 matthieu Exp $ +# $OpenBSD: Makefile,v 1.11 2007/11/26 15:10:19 matthieu Exp $ all: ${OBJS} LIB= GL @@ -35,9 +35,15 @@ CPPFLAGS+= \ -I${X11BASE}/include \ -I${X11BASE}/include/drm \ -DGLX_INDIRECT_RENDERING \ + -DPTHREADS \ -DHAVE_ALIAS \ -D_REENTRANT +.if ${XENOCARA_BUILD_DRI} == "y" +CPPFLAGS+= \ + -DGLX_DIRECT_RENDERING +.endif + .if ${MACHINE_ARCH} == "i386" CPPFLAGS += \ -DUSE_X86_ASM \ diff --git a/lib/libX11/Makefile.bsd-wrapper b/lib/libX11/Makefile.bsd-wrapper index b2369cecf..0a42e0f2d 100644 --- a/lib/libX11/Makefile.bsd-wrapper +++ b/lib/libX11/Makefile.bsd-wrapper @@ -1,6 +1,6 @@ -# $OpenBSD: Makefile.bsd-wrapper,v 1.4 2007/09/30 10:35:10 matthieu Exp $ +# $OpenBSD: Makefile.bsd-wrapper,v 1.5 2007/11/26 15:10:19 matthieu Exp $ -SHARED_LIBS= X11 11.0 +SHARED_LIBS= X11 11.1 CONFIGURE_ARGS= --without-xcb --enable-tcp-transport --enable-unix-transport --enable-IPv6 diff --git a/lib/libX11/src/UIThrStubs.c b/lib/libX11/src/UIThrStubs.c index 13df9e7ce..50da0e4c6 100644 --- a/lib/libX11/src/UIThrStubs.c +++ b/lib/libX11/src/UIThrStubs.c @@ -48,6 +48,11 @@ * distinguishing each of the drafts. */ +static int _Xthr_once_stub_(void *, void (*)(void)); +static int _Xthr_key_create_stub_(unsigned int *, void (*)(void *)); +static int _Xthr_setspecific_stub_(unsigned int, const void *); +static void *_Xthr_getspecific_stub_(unsigned int); + #ifdef CTHREADS #ifdef HAVE_CONFIG_H #include <config.h> @@ -113,9 +118,10 @@ int pthread_cond_destroy() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); int pthread_cond_wait() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); int pthread_cond_signal() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); int pthread_cond_broadcast() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); -int pthread_key_create() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); -void *pthread_getspecific() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); -int pthread_setspecific() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); +int pthread_key_create() __attribute__ ((weak, alias ("_Xthr_key_create_stub_"))); +void *pthread_getspecific() __attribute__ ((weak, alias ("_Xthr_getspecific_stub_"))); +int pthread_setspecific() __attribute__ ((weak, alias ("_Xthr_setspecific_stub_"))); +int pthread_once() __attribute__ ((weak, alias ("_Xthr_once_stub_"))); #else /* __GNUC__ */ #pragma weak pthread_self = _Xthr_self_stub_ #pragma weak pthread_mutex_init = _Xthr_zero_stub_ @@ -128,9 +134,10 @@ int pthread_setspecific() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); #pragma weak pthread_cond_signal = _Xthr_zero_stub_ #pragma weak pthread_cond_broadcast = _Xthr_zero_stub_ /* These are added for libGL */ -#pragma weak pthread_key_create = _Xthr_zero_stub_ -#pragma weak pthread_getspecific = _Xthr_zero_stub_ -#pragma weak pthread_setspecific = _Xthr_zero_stub_ +#pragma weak pthread_key_create = _Xthr_key_create_stub_ +#pragma weak pthread_getspecific = _Xthr_getspecific_stub_ +#pragma weak pthread_setspecific = _Xthr_setspecific_stub_ +#pragam weak pthread_once = _Xthr_once_stub_ #endif /* __GNUC__ */ #if defined(_DECTHREADS_) || defined(linux) #pragma weak pthread_equal = _Xthr_equal_stub_ /* See Xthreads.h! */ @@ -158,3 +165,57 @@ _Xthr_zero_stub_() { return(0); } + +static int +_Xthr_once_stub_(void *id, void (*routine)(void)) +{ + static int done = 0; + + if (!done) { + routine(); + done++; + } +} + +#include <errno.h> + +#define XTHR_KEYS_CHUNK 100 + +static void **_Xthr_keys_ = NULL; +static unsigned int _Xthr_last_key_ = 0; + +static int +_Xthr_key_create_stub_(unsigned int *key, void (*destructor)(void *)) +{ + void **tmp; + + if ((_Xthr_last_key_ % XTHR_KEYS_CHUNK) == 0) { + tmp = recalloc(_Xthr_keys_, 1, + _Xthr_last_key_ + XTHR_KEYS_CHUNK*sizeof(void *)); + if (tmp == NULL) { + free(_Xthr_keys_); + return ENOMEM; + } + _Xthr_keys_ = tmp; + } + *key = _Xthr_last_key_++; + return 0; +} + +static int +_Xthr_setspecific_stub_(unsigned int key, const void *value) +{ + if (_Xthr_last_key_ == 0 || key >= _Xthr_last_key_) + return EINVAL; + _Xthr_keys_[key] = value; + return 0; +} + +static void * +_Xthr_getspecific_stub_(unsigned int key) +{ + if (_Xthr_last_key_ == 0 || key >= _Xthr_last_key_) + return NULL; + return(_Xthr_keys_[key]); +} + |