commit - 38c10d1abcab399ce3735ccf54672a5b6787165e
commit + 7a2c88509bea849196ed4b77cf10512c4ff40cce
blob - 209436a807e4697838711173f45079f517af891c
blob + 9a641aefa037927578b95f021d925261c72f8b7a
--- INSTALL
+++ INSTALL
PLAN9=`pwd` export PLAN9
PATH=$PLAN9/bin:$PATH export PATH
+echo "Resetting $PLAN9/config"
+rm -f $PLAN9/config
+
(
+if [ `uname` = Linux ]; then
+ # On Linux, we use the kernel version to decide whether
+ # to use pthreads or not. On 2.6 versions that aren't
+ # linking with NPTL by default, pretend to be an older kernel.
+ echo "Running on Linux: checking for NPTL..."
+ gcc lib/linux-isnptl.c
+ if ./a.out
+ then
+ echo " NPTL found."
+ echo "SYSVERSION=2.6" >$PLAN9/config
+ else
+ echo " NPTL not found."
+ echo "SYSVERSION=2.4" >$PLAN9/config
+ fi
+fi
echo "Building mk..."
cd src
make
blob - dbeda7e44f239978228d27c90b1d1c6c65e1f663
blob + 31cc12e1ecaea60f5adfa0ae51cffd628b4bdcf5
--- src/libthread/pthread.c
+++ src/libthread/pthread.c
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);
}
blob - 802faf7686870866b1f80fd9386a45d984befc55
blob + a7af0f5ba39c9a134a69a0cdf60cfd7c30178b6d
--- src/libthread/sysofiles.sh
+++ src/libthread/sysofiles.sh
#!/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
blob - 842b81d87596768c64251c9e136e23559d34b861
blob + cb5b0168cc7fe978fd07ef63442b5c36ac85c8d5
--- src/libthread/threadimpl.h
+++ src/libthread/threadimpl.h
#include <sched.h>
#include <signal.h>
#include <ucontext.h>
+#include <sys/utsname.h>
#include "libc.h"
#include "thread.h"
blob - 6456aece2cf02eb744811445e1109971ec58466c
blob + 38ea8145778c67f08d788d1d5cfa5737f48f928a
--- src/mkhdr
+++ src/mkhdr
s;ppc64;power;g;
s;ppc;power;g'`
-SYSVERSION=`uname -r`
-
BIN=$PLAN9/bin
LIBDIR=$PLAN9/lib