[Xcb] Bug#496715: libpthread-stubs: Should provide more pthread_* functions

Samuel Thibault sthibault at debian.org
Wed Aug 19 16:50:48 PDT 2009


Tags 496715 + patch
thanks

Hello,

Here is a patch to implement it.  Sources need to be re-autoconfed of
course.

Samuel
-------------- next part --------------
diff -ur libpthread-stubs-0.1.backup/configure.ac libpthread-stubs-0.1/configure.ac
--- libpthread-stubs-0.1.backup/configure.ac	2006-11-22 08:51:21.000000000 +0100
+++ libpthread-stubs-0.1/configure.ac	2009-08-20 01:49:57.000000000 +0200
@@ -31,7 +31,7 @@
 
 
 PKG_CONFIG_LIBS=
-AC_CHECK_FUNCS([pthread_self pthread_mutex_init pthread_mutex_destroy pthread_mutex_lock pthread_mutex_unlock pthread_cond_init pthread_cond_destroy pthread_cond_wait pthread_cond_signal pthread_cond_broadcast pthread_equal],
+AC_CHECK_FUNCS([pthread_self pthread_attr_init pthread_attr_destroy pthread_attr_getdetachstate pthread_attr_setdetachstate pthread_attr_getinheritsched pthread_attr_setinheritsched pthread_attr_getschedparam pthread_attr_setschedparam pthread_attr_getschedpolicy pthread_attr_setschedpolicy pthread_attr_getscope pthread_attr_setscope pthread_mutex_init pthread_mutex_destroy pthread_mutex_lock pthread_mutex_unlock pthread_cond_init pthread_cond_destroy pthread_condattr_init pthread_condattr_destroy pthread_cond_wait pthread_cond_timedwait pthread_cond_signal pthread_cond_broadcast pthread_equal pthread_exit pthread_getschedparam pthread_setschedparam pthread_setcancelstate pthread_setcanceltype],
 	       [], [PKG_CONFIG_LIBS='-L${libdir} -lpthread-stubs'])
 AC_SUBST([PKG_CONFIG_LIBS])
 AM_CONDITIONAL(BUILD_LIB, test "x$PKG_CONFIG_LIBS" != x)
diff -ur libpthread-stubs-0.1.backup/stubs.c libpthread-stubs-0.1/stubs.c
--- libpthread-stubs-0.1.backup/stubs.c	2006-11-22 08:20:35.000000000 +0100
+++ libpthread-stubs-0.1/stubs.c	2009-08-20 01:44:02.000000000 +0200
@@ -36,6 +36,114 @@
 # endif
 #endif
 
+#ifndef HAVE_PTHREAD_ATTR_INIT
+#define NEED_ZERO_STUB
+# ifdef SUPPORT_ATTRIBUTE_ALIAS
+int pthread_attr_init() __attribute__ ((weak, alias ("__pthread_zero_stub")));
+# else
+#  pragma weak pthread_attr_init = __pthread_zero_stub
+# endif
+#endif
+
+#ifndef HAVE_PTHREAD_ATTR_DESTROY
+#define NEED_ZERO_STUB
+# ifdef SUPPORT_ATTRIBUTE_ALIAS
+int pthread_attr_destroy() __attribute__ ((weak, alias ("__pthread_zero_stub")));
+# else
+#  pragma weak pthread_attr_destroy = __pthread_zero_stub
+# endif
+#endif
+
+#ifndef HAVE_PTHREAD_ATTR_GETDETACHSTATE
+#define NEED_ZERO_STUB
+# ifdef SUPPORT_ATTRIBUTE_ALIAS
+int pthread_attr_getdetachstate() __attribute__ ((weak, alias ("__pthread_zero_stub")));
+# else
+#  pragma weak pthread_attr_getdetachstate = __pthread_zero_stub
+# endif
+#endif
+
+#ifndef HAVE_PTHREAD_ATTR_SETDETACHSTATE
+#define NEED_ZERO_STUB
+# ifdef SUPPORT_ATTRIBUTE_ALIAS
+int pthread_attr_setdetachstate() __attribute__ ((weak, alias ("__pthread_zero_stub")));
+# else
+#  pragma weak pthread_attr_setdetachstate = __pthread_zero_stub
+# endif
+#endif
+
+#ifndef HAVE_PTHREAD_ATTR_GETINHERITSCHED
+#define NEED_ZERO_STUB
+# ifdef SUPPORT_ATTRIBUTE_ALIAS
+int pthread_attr_getinheritsched() __attribute__ ((weak, alias ("__pthread_zero_stub")));
+# else
+#  pragma weak pthread_attr_getinheritsched = __pthread_zero_stub
+# endif
+#endif
+
+#ifndef HAVE_PTHREAD_ATTR_SETINHERITSCHED
+#define NEED_ZERO_STUB
+# ifdef SUPPORT_ATTRIBUTE_ALIAS
+int pthread_attr_setinheritsched() __attribute__ ((weak, alias ("__pthread_zero_stub")));
+# else
+#  pragma weak pthread_attr_setinheritsched = __pthread_zero_stub
+# endif
+#endif
+
+#ifndef HAVE_PTHREAD_ATTR_GETSCHEDPARAM
+#define NEED_ZERO_STUB
+# ifdef SUPPORT_ATTRIBUTE_ALIAS
+int pthread_attr_getschedparam() __attribute__ ((weak, alias ("__pthread_zero_stub")));
+# else
+#  pragma weak pthread_attr_getschedparam = __pthread_zero_stub
+# endif
+#endif
+
+#ifndef HAVE_PTHREAD_ATTR_SETSCHEDPARAM
+#define NEED_ZERO_STUB
+# ifdef SUPPORT_ATTRIBUTE_ALIAS
+int pthread_attr_setschedparam() __attribute__ ((weak, alias ("__pthread_zero_stub")));
+# else
+#  pragma weak pthread_attr_setschedparam = __pthread_zero_stub
+# endif
+#endif
+
+#ifndef HAVE_PTHREAD_ATTR_GETSCHEDPOLICY
+#define NEED_ZERO_STUB
+# ifdef SUPPORT_ATTRIBUTE_ALIAS
+int pthread_attr_getschedpolicy() __attribute__ ((weak, alias ("__pthread_zero_stub")));
+# else
+#  pragma weak pthread_attr_getschedpolicy = __pthread_zero_stub
+# endif
+#endif
+
+#ifndef HAVE_PTHREAD_ATTR_SETSCHEDPOLICY
+#define NEED_ZERO_STUB
+# ifdef SUPPORT_ATTRIBUTE_ALIAS
+int pthread_attr_setschedpolicy() __attribute__ ((weak, alias ("__pthread_zero_stub")));
+# else
+#  pragma weak pthread_attr_setschedpolicy = __pthread_zero_stub
+# endif
+#endif
+
+#ifndef HAVE_PTHREAD_ATTR_GETSCOPE
+#define NEED_ZERO_STUB
+# ifdef SUPPORT_ATTRIBUTE_ALIAS
+int pthread_attr_getscope() __attribute__ ((weak, alias ("__pthread_zero_stub")));
+# else
+#  pragma weak pthread_attr_getscope = __pthread_zero_stub
+# endif
+#endif
+
+#ifndef HAVE_PTHREAD_ATTR_SETSCOPE
+#define NEED_ZERO_STUB
+# ifdef SUPPORT_ATTRIBUTE_ALIAS
+int pthread_attr_setscope() __attribute__ ((weak, alias ("__pthread_zero_stub")));
+# else
+#  pragma weak pthread_attr_setscope = __pthread_zero_stub
+# endif
+#endif
+
 #ifndef HAVE_PTHREAD_MUTEX_INIT
 #define NEED_ZERO_STUB
 # ifdef SUPPORT_ATTRIBUTE_ALIAS
@@ -90,6 +198,24 @@
 # endif
 #endif
 
+#ifndef HAVE_PTHREAD_CONDATTR_INIT
+#define NEED_ZERO_STUB
+# ifdef SUPPORT_ATTRIBUTE_ALIAS
+int pthread_condattr_init() __attribute__ ((weak, alias ("__pthread_zero_stub")));
+# else
+#  pragma weak pthread_condattr_init = __pthread_zero_stub
+# endif
+#endif
+
+#ifndef HAVE_PTHREAD_CONDATTR_DESTROY
+#define NEED_ZERO_STUB
+# ifdef SUPPORT_ATTRIBUTE_ALIAS
+int pthread_condattr_destroy() __attribute__ ((weak, alias ("__pthread_zero_stub")));
+# else
+#  pragma weak pthread_condattr_destroy = __pthread_zero_stub
+# endif
+#endif
+
 #ifndef HAVE_PTHREAD_COND_WAIT
 #define NEED_ZERO_STUB
 # ifdef SUPPORT_ATTRIBUTE_ALIAS
@@ -99,6 +225,15 @@
 # endif
 #endif
 
+#ifndef HAVE_PTHREAD_COND_TIMEDWAIT
+#define NEED_ZERO_STUB
+# ifdef SUPPORT_ATTRIBUTE_ALIAS
+int pthread_cond_timedwait() __attribute__ ((weak, alias ("__pthread_zero_stub")));
+# else
+#  pragma weak pthread_cond_timedwait = __pthread_zero_stub
+# endif
+#endif
+
 #ifndef HAVE_PTHREAD_COND_SIGNAL
 #define NEED_ZERO_STUB
 # ifdef SUPPORT_ATTRIBUTE_ALIAS
@@ -126,6 +261,51 @@
 # endif
 #endif
 
+#ifndef HAVE_PTHREAD_EXIT
+#define NEED_EXIT_STUB
+# ifdef SUPPORT_ATTRIBUTE_ALIAS
+int pthread_exit() __attribute__ ((weak, alias ("__pthread_exit_stub")));
+# else
+#  pragma weak pthread_exit = __pthread_exit_stub
+# endif
+#endif
+
+#ifndef HAVE_PTHREAD_GETSCHEDPARAM
+#define NEED_ZERO_STUB
+# ifdef SUPPORT_ATTRIBUTE_ALIAS
+int pthread_getschedparam() __attribute__ ((weak, alias ("__pthread_zero_stub")));
+# else
+#  pragma weak pthread_getschedparam = __pthread_zero_stub
+# endif
+#endif
+
+#ifndef HAVE_PTHREAD_SETSCHEDPARAM
+#define NEED_ZERO_STUB
+# ifdef SUPPORT_ATTRIBUTE_ALIAS
+int pthread_setschedparam() __attribute__ ((weak, alias ("__pthread_zero_stub")));
+# else
+#  pragma weak pthread_setschedparam = __pthread_zero_stub
+# endif
+#endif
+
+#ifndef HAVE_PTHREAD_SETCANCELSTATE
+#define NEED_ZERO_STUB
+# ifdef SUPPORT_ATTRIBUTE_ALIAS
+int pthread_setcancelstate() __attribute__ ((weak, alias ("__pthread_zero_stub")));
+# else
+#  pragma weak pthread_setcancelstate = __pthread_zero_stub
+# endif
+#endif
+
+#ifndef HAVE_PTHREAD_SETCANCELTYPE
+#define NEED_ZERO_STUB
+# ifdef SUPPORT_ATTRIBUTE_ALIAS
+int pthread_setcanceltype() __attribute__ ((weak, alias ("__pthread_zero_stub")));
+# else
+#  pragma weak pthread_setcanceltype = __pthread_zero_stub
+# endif
+#endif
+
 #ifdef NEED_ZERO_STUB
 static int __pthread_zero_stub()
 {
@@ -139,3 +319,10 @@
     return (t1 == t2);
 }
 #endif
+
+#ifdef NEED_EXIT_STUB
+static void __pthread_exit_stub(void *ret)
+{
+    exit(EXIT_SUCCESS);
+}
+#endif


More information about the Xcb mailing list