summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Denis-Courmont <remi@remlab.net>2010-12-14 04:12:40 +0200
committerPeter Harris <pharris@opentext.com>2010-12-23 12:36:50 -0500
commit79b3c3831b49c3fd39d84584d93d93dd818508dd (patch)
tree147c80a4ef3e23985d49e6e1ba5d0c7923a46b88
parent28693b4713eb50a395557a1cc1673f8f07579d4d (diff)
downloadxcb-pthread-stubs-79b3c3831b49c3fd39d84584d93d93dd818508dd.tar.gz
pthread_self(): do not assume pthread_t and int are compatible
POSIX does not warrant much about pthread_t. It is not necessarily the same convertible to int as far as the calling conventions are concerned. Reviewed-by: Julien Cristau <jcristau@debian.org> Signed-off-by: Peter Harris <pharris@opentext.com>
-rw-r--r--list.m42
-rw-r--r--stubs.c.m411
2 files changed, 12 insertions, 1 deletions
diff --git a/list.m4 b/list.m4
index 7d23c3c..79b5b59 100644
--- a/list.m4
+++ b/list.m4
@@ -1,4 +1,4 @@
-alias(zero, int, pthread_self)
+alias(self, pthread_t, pthread_self)
alias(zero, int, pthread_mutex_init)
alias(zero, int, pthread_mutex_destroy)
alias(zero, int, pthread_mutex_lock)
diff --git a/stubs.c.m4 b/stubs.c.m4
index 1616c0a..8e51745 100644
--- a/stubs.c.m4
+++ b/stubs.c.m4
@@ -47,6 +47,7 @@ m4_divert(0)m4_dnl
#include <pthread.h>
#include <stdlib.h>
+#include <string.h>
#include "config.h"
m4_include([list.m4])
@@ -65,6 +66,16 @@ static int __pthread_abort_stub()
}
#endif
+#ifdef NEED_SELF_STUB
+static pthread_t __pthread_self_stub(void)
+{
+ pthread_t th;
+
+ memset(&th, 0, sizeof (th));
+ return th;
+}
+#endif
+
#ifdef NEED_EQUAL_STUB
static int __pthread_equal_stub(pthread_t t1, pthread_t t2)
{