diff options
author | rsc <devnull@localhost> | 2004-09-17 22:09:31 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2004-09-17 22:09:31 +0000 |
commit | 282c88f9de897056f7a2461216dbfdb51ab655f3 (patch) | |
tree | 41352a8f97673c4475b54a1a6ffbef82ff363685 /src/lib9 | |
parent | b4c842f139b47e1c999eb395f348c236af83143b (diff) | |
download | plan9port-282c88f9de897056f7a2461216dbfdb51ab655f3.tar.gz plan9port-282c88f9de897056f7a2461216dbfdb51ab655f3.tar.bz2 plan9port-282c88f9de897056f7a2461216dbfdb51ab655f3.zip |
Bite the bullet. Have to use different
binaries on 2.4 and 2.6.
Diffstat (limited to 'src/lib9')
-rw-r--r-- | src/lib9/ffork-Linux.c | 35 | ||||
-rw-r--r-- | src/lib9/rendez-Linux.c | 63 |
2 files changed, 8 insertions, 90 deletions
diff --git a/src/lib9/ffork-Linux.c b/src/lib9/ffork-Linux.c index 5dbd75cf..b433ec4a 100644 --- a/src/lib9/ffork-Linux.c +++ b/src/lib9/ffork-Linux.c @@ -1,32 +1,5 @@ -#define ffork ffork_clone -#define getfforkid getfforkid_clone -#include "ffork-Linux-clone.c" -#undef ffork -#undef getfforkid - -#define ffork ffork_pthread -#define getfforkid getfforkid_pthread +#ifdef __Linux26__ #include "ffork-pthread.c" -#undef ffork -#undef getfforkid - -extern int _islinuxnptl(void); - -int -ffork(int flags, void (*fn)(void*), void *arg) -{ - if(_islinuxnptl()) - return ffork_pthread(flags, fn, arg); - else - return ffork_clone(flags, fn, arg); -} - -int -getfforkid(void) -{ - if(_islinuxnptl()) - return getfforkid_pthread(); - else - return getfforkid_clone(); -} - +#else +#include "ffork-Linux-clone.c" +#endif diff --git a/src/lib9/rendez-Linux.c b/src/lib9/rendez-Linux.c index 6d479310..c86fb5b5 100644 --- a/src/lib9/rendez-Linux.c +++ b/src/lib9/rendez-Linux.c @@ -1,60 +1,5 @@ -/* - * On Linux 2.6 and later, we can use pthreads (in fact, we must), - * but on earlier Linux, pthreads are incompatible with using our - * own coroutines in libthread. In order to make binaries that work - * on either system, we detect the pthread library in use and call - * the appropriate functions. - */ - -#include <u.h> -#include <signal.h> -#include <pthread.h> -#include <libc.h> - -#define _procsleep _procsleep_signal -#define _procwakeup _procwakeup_signal -#include "rendez-signal.c" - -#undef _procsleep -#undef _procwakeup -#define _procsleep _procsleep_pthread -#define _procwakeup _procwakeup_pthread +#ifdef __Linux26__ #include "rendez-pthread.c" - -#undef _procsleep -#undef _procwakeup - -int -_islinuxnptl(void) -{ - static char buf[100]; - static int isnptl = -1; - - if(isnptl == -1){ - if(confstr(_CS_GNU_LIBPTHREAD_VERSION, buf, sizeof buf) > 0 - && strncmp(buf, "NPTL", 4) == 0) - isnptl = 1; - else - isnptl = 0; - } - return isnptl; -} - -void -_procsleep(_Procrend *r) -{ - if(_islinuxnptl()) - return _procsleep_pthread(r); - else - return _procsleep_signal(r); -} - -void -_procwakeup(_Procrend *r) -{ - if(_islinuxnptl()) - return _procwakeup_pthread(r); - else - return _procwakeup_signal(r); -} - +#else +#include "rendez-signal.c" +#endif |