aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libthread/pthread.c17
-rw-r--r--src/libthread/sysofiles.sh4
-rw-r--r--src/libthread/threadimpl.h1
-rw-r--r--src/mkhdr2
4 files changed, 21 insertions, 3 deletions
diff --git a/src/libthread/pthread.c b/src/libthread/pthread.c
index dbeda7e4..31cc12e1 100644
--- a/src/libthread/pthread.c
+++ b/src/libthread/pthread.c
@@ -133,6 +133,23 @@ _threadsetproc(Proc *p)
void
_pthreadinit(void)
{
+ static struct utsname un;
+ pthread_t id;
+
+ if(uname(&un) < 0){
+ fprint(2, "warning: uname failed: %r\n");
+ goto Okay;
+ }
+ if(strcmp(un.sysname, "Linux") == 0){
+ /*
+ * Want to distinguish between the old LinuxThreads pthreads
+ * and the new NPTL implementation. NPTL uses much bigger
+ * thread IDs.
+ */
+ id = pthread_self();
+ if(*(ulong*)&id < 1024*1024)
+ sysfatal("cannot use LinuxThreads as pthread library; see %s/src/libthread/README.Linux", get9root());
+ }
pthread_key_create(&prockey, 0);
}
diff --git a/src/libthread/sysofiles.sh b/src/libthread/sysofiles.sh
index 802faf76..a7af0f5b 100644
--- a/src/libthread/sysofiles.sh
+++ b/src/libthread/sysofiles.sh
@@ -1,6 +1,8 @@
#!/bin/sh
-tag="$OBJTYPE-$SYSNAME-`uname -r`-${CC9:-cc}"
+test -f $PLAN9/config && . $PLAN9/config
+
+tag="$OBJTYPE-$SYSNAME-${SYSVERSION:-`uname -r`}-${CC9:-cc}"
case "$tag" in
*-Linux-2.6.*)
echo pthread.o
diff --git a/src/libthread/threadimpl.h b/src/libthread/threadimpl.h
index 842b81d8..cb5b0168 100644
--- a/src/libthread/threadimpl.h
+++ b/src/libthread/threadimpl.h
@@ -6,6 +6,7 @@
#include <sched.h>
#include <signal.h>
#include <ucontext.h>
+#include <sys/utsname.h>
#include "libc.h"
#include "thread.h"
diff --git a/src/mkhdr b/src/mkhdr
index 6456aece..38ea8145 100644
--- a/src/mkhdr
+++ b/src/mkhdr
@@ -7,8 +7,6 @@ OBJTYPE=`uname -m | sed '
s;ppc64;power;g;
s;ppc;power;g'`
-SYSVERSION=`uname -r`
-
BIN=$PLAN9/bin
LIBDIR=$PLAN9/lib