diff options
author | rsc <devnull@localhost> | 2003-11-24 22:39:06 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2003-11-24 22:39:06 +0000 |
commit | 912fba95e74c7631352bc5007249d75e720bbcdf (patch) | |
tree | b9c86c0c38c71d742ffd3990706f380f8263fd8d /src/libthread | |
parent | 2db9e4821d8ae4889e63e5bb205b04eccb7af405 (diff) | |
download | plan9port-912fba95e74c7631352bc5007249d75e720bbcdf.tar.gz plan9port-912fba95e74c7631352bc5007249d75e720bbcdf.tar.bz2 plan9port-912fba95e74c7631352bc5007249d75e720bbcdf.zip |
Changes for Mac OS X. Most important is stack sizes in samterm,
which were completely bogus. (Libthread used to ignore them but
not anymore. Maybe we really should ignore them, but that breaks
Venti, which needs *really* big stacks.)
Diffstat (limited to 'src/libthread')
-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 |
4 files changed, 18 insertions, 6 deletions
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) |