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.)
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user