diff options
-rw-r--r-- | src/cmd/rm.c | 2 | ||||
-rw-r--r-- | src/cmd/sam/sam.h | 1 | ||||
-rw-r--r-- | src/cmd/samterm/mkfile | 2 | ||||
-rw-r--r-- | src/cmd/samterm/plan9.c | 8 | ||||
-rw-r--r-- | src/cmd/venti/mkfile | 2 | ||||
-rw-r--r-- | src/lib9/await.c | 2 | ||||
-rw-r--r-- | src/lib9/dirread.c | 13 | ||||
-rw-r--r-- | src/lib9/ffork-pthread.c | 4 | ||||
-rw-r--r-- | src/lib9/mkfile | 1 | ||||
-rw-r--r-- | src/lib9/tas-PowerMacintosh.c | 4 | ||||
-rw-r--r-- | src/libdraw/mkfile | 4 | ||||
-rw-r--r-- | src/libthread/channel.c | 2 | ||||
-rw-r--r-- | src/libthread/exec-unix.c | 16 | ||||
-rw-r--r-- | src/libthread/rendez.c | 4 | ||||
-rw-r--r-- | src/libthread/sched.c | 2 | ||||
-rw-r--r-- | src/mkhdr | 1 | ||||
-rw-r--r-- | src/mksyslib | 4 |
17 files changed, 46 insertions, 26 deletions
diff --git a/src/cmd/rm.c b/src/cmd/rm.c index 6066543e..e76fdb0a 100644 --- a/src/cmd/rm.c +++ b/src/cmd/rm.c @@ -6,7 +6,7 @@ char errbuf[ERRMAX]; int ignerr = 0; -void +static void err(char *f) { if(!ignerr){ diff --git a/src/cmd/sam/sam.h b/src/cmd/sam/sam.h index 5ba8a614..7e824da1 100644 --- a/src/cmd/sam/sam.h +++ b/src/cmd/sam/sam.h @@ -16,6 +16,7 @@ #define TRUE 1 #define FALSE 0 +#undef INFINITY /* Darwin declares this as HUGE_VAL */ #define INFINITY 0x7FFFFFFFL #define INCR 25 #define STRSIZE (2*BLOCKSIZE) diff --git a/src/cmd/samterm/mkfile b/src/cmd/samterm/mkfile index a6b9a60e..ba64daf0 100644 --- a/src/cmd/samterm/mkfile +++ b/src/cmd/samterm/mkfile @@ -25,6 +25,6 @@ CFLAGS=$CFLAGS -I../sam LDFLAGS=$LDFLAGS -lframe -ldraw -lthread -l9 -lregexp9 \ -lbio -lfmt -lutf -L$X11/lib -lX11 -lm -o.samterm: $PLAN9/lib/libdraw.a +o.samterm: $PLAN9/lib/libframe.a $PLAN9/lib/libdraw.a $PLAN9/lib/libthread.a <$PLAN9/src/mkone diff --git a/src/cmd/samterm/plan9.c b/src/cmd/samterm/plan9.c index e459bcf3..f12f0850 100644 --- a/src/cmd/samterm/plan9.c +++ b/src/cmd/samterm/plan9.c @@ -15,6 +15,8 @@ static char *exname; +#define STACK 8192 + void getscreen(int argc, char **argv) { @@ -163,7 +165,7 @@ extstart(void) plumbc = chancreate(sizeof(int), 0); arg[0] = plumbc; arg[1] = (void*)fd; - proccreate(extproc, arg, 8192); + proccreate(extproc, arg, STACK); atexit(removeextern); } @@ -256,7 +258,7 @@ plumbstart(void) } arg[0] =plumbc; arg[1] = &fd; - proccreate(plumbproc, arg, 4096); + proccreate(plumbproc, arg, STACK); return 1; } #endif @@ -293,5 +295,5 @@ void hoststart(void) { hostc = chancreate(sizeof(int), 0); - proccreate(hostproc, hostc, 1024); + proccreate(hostproc, hostc, STACK); } diff --git a/src/cmd/venti/mkfile b/src/cmd/venti/mkfile index e899ef3f..7a3e9f2f 100644 --- a/src/cmd/venti/mkfile +++ b/src/cmd/venti/mkfile @@ -72,7 +72,7 @@ it:V: all <$PLAN9/src/mkmany $SLIB: $LIBOFILES - ar rvc $SLIB $LIBOFILES + $AR rvc $SLIB $LIBOFILES # xml.c:D: mkxml dat.h # ./mkxml dat.h > xml.c diff --git a/src/lib9/await.c b/src/lib9/await.c index 56d79b79..89c695ae 100644 --- a/src/lib9/await.c +++ b/src/lib9/await.c @@ -4,9 +4,9 @@ #include <signal.h> #include <sys/types.h> +#include <sys/time.h> #include <sys/resource.h> #include <sys/wait.h> -#include <sys/time.h> static struct { int sig; diff --git a/src/lib9/dirread.c b/src/lib9/dirread.c index 359b09ec..2e1ce886 100644 --- a/src/lib9/dirread.c +++ b/src/lib9/dirread.c @@ -11,12 +11,16 @@ extern int _p9dir(struct stat*, char*, Dir*, char**, char*); -#if !defined(_HAVEGETDENTS) && defined(_HAVEGETDIRENTRIES) +/* everyone has getdirentries, just use that */ static int -getdents(int fd, char *buf, int n) +mygetdents(int fd, char *buf, int n) { ssize_t nn; +#if _GETDIRENTRIES_TAKES_LONG + long off; +#else off_t off; +#endif off = seek(fd, 0, 1); nn = getdirentries(fd, buf, n, &off); @@ -24,7 +28,6 @@ getdents(int fd, char *buf, int n) seek(fd, off, 0); return nn; } -#endif static int countde(char *p, int n) @@ -123,7 +126,7 @@ dirread(int fd, Dir **dp) if(buf == nil) return -1; - n = getdents(fd, (void*)buf, st.st_blksize); + n = mygetdents(fd, (void*)buf, st.st_blksize); if(n < 0){ free(buf); return -1; @@ -156,7 +159,7 @@ dirreadall(int fd, Dir **d) return -1; } buf = nbuf; - n = getdents(fd, (void*)(buf+ts), st.st_blksize); + n = mygetdents(fd, (void*)(buf+ts), st.st_blksize); if(n <= 0) break; ts += n; diff --git a/src/lib9/ffork-pthread.c b/src/lib9/ffork-pthread.c index 189ac94f..397f8aa6 100644 --- a/src/lib9/ffork-pthread.c +++ b/src/lib9/ffork-pthread.c @@ -1,4 +1,6 @@ -#include <lib9.h> +#define NOPLAN9DEFINES +#include <u.h> +#include <libc.h> #include <pthread.h> extern int __isthreaded; diff --git a/src/lib9/mkfile b/src/lib9/mkfile index deb69249..a34cdc69 100644 --- a/src/lib9/mkfile +++ b/src/lib9/mkfile @@ -38,7 +38,6 @@ OFILES=\ getuser.$O\ getwd.$O\ jmp.$O\ - jmp-$SYSNAME.$O\ lock.$O\ main.$O\ malloctag.$O\ diff --git a/src/lib9/tas-PowerMacintosh.c b/src/lib9/tas-PowerMacintosh.c index 29928ce0..d7a8610c 100644 --- a/src/lib9/tas-PowerMacintosh.c +++ b/src/lib9/tas-PowerMacintosh.c @@ -6,7 +6,7 @@ * r3 contains return value upon return. */ int -_tas(void *x) +_tas(int *x) { int v; /* @@ -36,7 +36,7 @@ _tas(void *x) switch(v) { case 0: return 0; case 0xdeaddead: return 1; - default: print("tas: corrupted 0x%lux\n", v); + default: fprint(2, "tas: corrupted 0x%lux\n", v); } return 0; } diff --git a/src/libdraw/mkfile b/src/libdraw/mkfile index 7c5e9371..4dbe2d45 100644 --- a/src/libdraw/mkfile +++ b/src/libdraw/mkfile @@ -119,6 +119,6 @@ CFLAGS=$CFLAGS -I$X11/include <$PLAN9/src/mksyslib -test: test.o $LIB - gcc -o test test.o -L$PLAN9 -ldraw -l9 -lfmt -lutf -L$X11/lib -lX11 -lm +test: test.o $PLAN9/lib/$LIB + gcc -o test test.o -L$PLAN9/lib -ldraw -l9 -lfmt -lutf -L$X11/lib -lX11 -lm diff --git a/src/libthread/channel.c b/src/libthread/channel.c index 384f23fd..d1ec2985 100644 --- a/src/libthread/channel.c +++ b/src/libthread/channel.c @@ -359,7 +359,7 @@ enqueue(Alt *a, Channel **c) { int i; - _threaddebug(DBGCHAN, "Queuing alt %p on channel %p", a, a->c); + _threaddebug(DBGCHAN, "Queueing alt %p on channel %p", a, a->c); a->tag = c; i = emptyentry(a->c); a->c->qentry[i] = a; diff --git a/src/libthread/exec-unix.c b/src/libthread/exec-unix.c index 5a37e34c..ef50bf19 100644 --- a/src/libthread/exec-unix.c +++ b/src/libthread/exec-unix.c @@ -16,6 +16,7 @@ procexec(Channel *pidc, char *prog, char *args[]) if(p->threads.head != t || p->threads.head->nextt != nil){ werrstr("not only thread in proc"); Bad: + _threaddebug(DBGEXEC, "procexec bad %r"); if(pidc) sendul(pidc, ~0); return; @@ -35,6 +36,8 @@ procexec(Channel *pidc, char *prog, char *args[]) */ if(pipe(p->exec.fd) < 0) goto Bad; + if(fcntl(p->exec.fd[0], F_SETFD, 1) < 0) + goto Bad; if(fcntl(p->exec.fd[1], F_SETFD, 1) < 0) goto Bad; @@ -57,6 +60,7 @@ procexec(Channel *pidc, char *prog, char *args[]) if(pidc) sendul(pidc, t->ret); + _threaddebug(DBGEXEC, "procexec schedexecwait"); /* wait for exec'ed program, then exit */ _schedexecwait(); } @@ -105,8 +109,7 @@ efork(void *ve) Execargs *e; e = ve; - _threaddebug(DBGEXEC, "_schedexec %s", e->prog); - close(e->fd[0]); + _threaddebug(DBGEXEC, "_schedexec %s -- calling execv", e->prog); execv(e->prog, e->args); _threaddebug(DBGEXEC, "_schedexec failed: %r"); rerrstr(buf, sizeof buf); @@ -120,5 +123,12 @@ efork(void *ve) int _schedexec(Execargs *e) { - return ffork(RFFDG|RFPROC|RFMEM, efork, e); + int pid; + + pid = fork(); + if(pid == 0){ + efork(e); + _exit(1); + } + return pid; } diff --git a/src/libthread/rendez.c b/src/libthread/rendez.c index 62b825b5..70eb0ae8 100644 --- a/src/libthread/rendez.c +++ b/src/libthread/rendez.c @@ -52,12 +52,12 @@ _threadnrendez++; t->rendval = val; t->rendhash = *l; *l = t; - t->nextstate = Rendezvous; ++nrendez; if(nrendez > _threadhighnrendez) _threadhighnrendez = nrendez; - _threaddebug(DBGREND, "Rendezvous for tag %lud", t->rendtag); + _threaddebug(DBGREND, "Rendezvous for tag %lud (m=%d)", t->rendtag, t->moribund); unlock(&_threadrgrp.lock); + t->nextstate = Rendezvous; _sched(); t->inrendez = 0; _threaddebug(DBGREND, "Woke after rendezvous; val is %lud", t->rendval); diff --git a/src/libthread/sched.c b/src/libthread/sched.c index f1fde971..d33587fc 100644 --- a/src/libthread/sched.c +++ b/src/libthread/sched.c @@ -41,6 +41,8 @@ _schedinit(void *arg) if((t=p->thread) != nil){ p->thread = nil; if(t->moribund){ + if(t->moribund != 1) + fprint(2, "moribund %d\n", t->moribund); assert(t->moribund == 1); t->state = Dead; if(t->prevt) @@ -5,6 +5,7 @@ X11=/usr/X11R6 CC=9c LD=9l AS=9a +AR=9ar CFLAGS= LDFLAGS= AFLAGS= diff --git a/src/mksyslib b/src/mksyslib index 9f0b5df6..fab443d3 100644 --- a/src/mksyslib +++ b/src/mksyslib @@ -1,10 +1,10 @@ default:V: $PLAN9/lib/$LIB $PLAN9/lib/$LIB:V: $OFILES # force archive even when not needed - ar rvc $PLAN9/lib/$LIB $newprereq + $AR rvc $PLAN9/lib/$LIB $newprereq &:n: &.$O - ar rvc $LIB $stem.$O + $AR rvc $PLAN9/lib/$LIB $stem.$O all install:V: $PLAN9/lib/$LIB |