diff options
author | rsc <devnull@localhost> | 2003-10-01 02:50:57 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2003-10-01 02:50:57 +0000 |
commit | a995e477ffb4dd1184da87e9e46a9e57f3178c63 (patch) | |
tree | 5b2260becdfb1aaf8b67fd91223b7d214b7e9451 /src/libthread | |
parent | e182749a982e415fba755bc1035c35da5c4fe606 (diff) | |
download | plan9port-a995e477ffb4dd1184da87e9e46a9e57f3178c63.tar.gz plan9port-a995e477ffb4dd1184da87e9e46a9e57f3178c63.tar.bz2 plan9port-a995e477ffb4dd1184da87e9e46a9e57f3178c63.zip |
Various tweaks to make things run on Mac OS.
The main change is the use of pthread to implement ffork.
Diffstat (limited to 'src/libthread')
-rw-r--r-- | src/libthread/getpid.c | 5 | ||||
-rw-r--r-- | src/libthread/label.h | 15 | ||||
-rw-r--r-- | src/libthread/trend.c | 2 |
3 files changed, 18 insertions, 4 deletions
diff --git a/src/libthread/getpid.c b/src/libthread/getpid.c index da03bd3f..c4d23dad 100644 --- a/src/libthread/getpid.c +++ b/src/libthread/getpid.c @@ -1,8 +1,7 @@ #include "threadimpl.h" -#include <unistd.h> - +extern int getfforkid(void); int _threadgetpid(void) { - return getpid(); + return getfforkid(); } diff --git a/src/libthread/label.h b/src/libthread/label.h index 0c9f3030..a1f6fa5a 100644 --- a/src/libthread/label.h +++ b/src/libthread/label.h @@ -17,6 +17,21 @@ struct Label ulong si; ulong di; }; +#elif defined(__APPLE__) +struct Label +{ + ulong pc; /* lr */ + ulong cr; /* mfcr */ + ulong ctr; /* mfcr */ + ulong xer; /* mfcr */ + ulong sp; /* callee saved: r1 */ + ulong toc; /* callee saved: r2 */ + ulong gpr[19]; /* callee saved: r13-r31 */ +// XXX: currently do not save vector registers or floating-point state +// ulong pad; +// uvlong fpr[18]; /* callee saved: f14-f31 */ +// ulong vr[4*12]; /* callee saved: v20-v31, 256-bits each */ +}; #else #error "Unknown or unsupported architecture" #endif diff --git a/src/libthread/trend.c b/src/libthread/trend.c index 6f8adcd5..1ccf1a79 100644 --- a/src/libthread/trend.c +++ b/src/libthread/trend.c @@ -25,7 +25,7 @@ threadmain(int argc, char **argv) c[1] = chancreate(sizeof(ulong), 1); c[2] = c[0]; - threadcreate(pingpong, c, 16384); + proccreate(pingpong, c, 16384); threadcreate(pingpong, c+1, 16384); sendul(c[0], atoi(argv[1])); } |