Various tweaks to make things run on Mac OS.

The main change is the use of pthread to implement ffork.
This commit is contained in:
rsc 2003-10-01 02:50:57 +00:00
parent e182749a98
commit a995e477ff
12 changed files with 84 additions and 12 deletions

View file

@ -19,7 +19,7 @@ OFILES=\
nrand.$O\
qlock.$O\
readn.$O\
rendez.$O\
rendez-$(SYSNAME).$O\
strecpy.$O\
sysfatal.$O\
tas-$(OBJTYPE).$O\
@ -31,7 +31,7 @@ OFILES=\
werrstr.$O\
HFILES=\
lib9.h\
$(9SRC)/include/lib9.h\
include $(9SRC)/Makesyslib

View file

@ -2,3 +2,8 @@
char *argv0;
/*
* Mac OS can't deal with files that only declare data.
* ARGBEGIN mentions this function so that this file gets pulled in.
*/
void __fixargv0(void) { }

View file

@ -1,5 +1,6 @@
#include <signal.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/wait.h>
#include <sys/time.h>

View file

@ -31,3 +31,9 @@ _spinlock(spinlock_t *lk)
lock((Lock*)&lk->access_lock);
}
int
getfforkid(void)
{
return getpid();
}

View file

@ -37,3 +37,9 @@ ffork(int flags, void (*fn)(void*), void *arg)
return pid;
}
int
getfforkid(void)
{
return getpid();
}

View file

@ -8,12 +8,9 @@ _xtas(void *v)
{
int x;
_ntas++;
_ntas++;
x = _tas(v);
if(x == 0 || x == 0xCAFEBABE)
return x;
fprint(2, "%d: tas %p got %ux\n", getpid(), v, x);
abort();
return x;
}
int

View file

@ -14,6 +14,7 @@ sysfatal(char *fmt, ...)
vseprint(buf, buf+sizeof buf, fmt, arg);
va_end(arg);
__fixargv0();
fprint(2, "%s; %s\n", argv0 ? argv0 : "<prog>", buf);
exits("fatal");
}