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/exec-unix.c | |
| parent | 2db9e4821d8ae4889e63e5bb205b04eccb7af405 (diff) | |
| download | plan9port-912fba95e74c7631352bc5007249d75e720bbcdf.tar.gz 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/exec-unix.c')
| -rw-r--r-- | src/libthread/exec-unix.c | 16 |
1 files changed, 13 insertions, 3 deletions
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; } |
