mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-24 11:41:58 +00:00
allow config to override kernel version
This commit is contained in:
parent
38c10d1abc
commit
7a2c88509b
5 changed files with 39 additions and 3 deletions
18
INSTALL
18
INSTALL
|
@ -3,7 +3,25 @@
|
||||||
PLAN9=`pwd` export PLAN9
|
PLAN9=`pwd` export PLAN9
|
||||||
PATH=$PLAN9/bin:$PATH export PATH
|
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..."
|
echo "Building mk..."
|
||||||
cd src
|
cd src
|
||||||
make
|
make
|
||||||
|
|
|
@ -133,6 +133,23 @@ _threadsetproc(Proc *p)
|
||||||
void
|
void
|
||||||
_pthreadinit(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);
|
pthread_key_create(&prockey, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#!/bin/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
|
case "$tag" in
|
||||||
*-Linux-2.6.*)
|
*-Linux-2.6.*)
|
||||||
echo pthread.o
|
echo pthread.o
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <ucontext.h>
|
#include <ucontext.h>
|
||||||
|
#include <sys/utsname.h>
|
||||||
#include "libc.h"
|
#include "libc.h"
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,6 @@ OBJTYPE=`uname -m | sed '
|
||||||
s;ppc64;power;g;
|
s;ppc64;power;g;
|
||||||
s;ppc;power;g'`
|
s;ppc;power;g'`
|
||||||
|
|
||||||
SYSVERSION=`uname -r`
|
|
||||||
|
|
||||||
BIN=$PLAN9/bin
|
BIN=$PLAN9/bin
|
||||||
LIBDIR=$PLAN9/lib
|
LIBDIR=$PLAN9/lib
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue