diff options
author | rsc <devnull@localhost> | 2003-12-11 17:48:38 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2003-12-11 17:48:38 +0000 |
commit | 32f69c36e0eec1227934bbd34854bfebd88686f2 (patch) | |
tree | 1587e9de84816b77168afa81c1594cc686809910 /src/libthread/exec.c | |
parent | ac244f8d287a6119155ea672c8fd13c487c5e4c7 (diff) | |
download | plan9port-32f69c36e0eec1227934bbd34854bfebd88686f2.tar.gz plan9port-32f69c36e0eec1227934bbd34854bfebd88686f2.tar.bz2 plan9port-32f69c36e0eec1227934bbd34854bfebd88686f2.zip |
Add support for user-level 9P servers/clients and various bug fixes to go with them.
Diffstat (limited to 'src/libthread/exec.c')
-rw-r--r-- | src/libthread/exec.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/libthread/exec.c b/src/libthread/exec.c index bcf20802..0fb68111 100644 --- a/src/libthread/exec.c +++ b/src/libthread/exec.c @@ -3,7 +3,7 @@ #define PIPEMNT "/mnt/temp" void -procexec(Channel *pidc, char *prog, char *args[]) +procexec(Channel *pidc, int fd[3], char *prog, char *args[]) { int n; Proc *p; @@ -50,6 +50,7 @@ procexec(Channel *pidc, char *prog, char *args[]) assert(p->needexec==0); p->exec.prog = prog; p->exec.args = args; + p->exec.stdfd = fd; p->needexec = 1; _sched(); @@ -61,7 +62,11 @@ procexec(Channel *pidc, char *prog, char *args[]) goto Bad; } close(p->exec.fd[0]); - + close(fd[0]); + if(fd[1] != fd[0]) + close(fd[1]); + if(fd[2] != fd[1] && fd[2] != fd[0]) + close(fd[2]); if(pidc) sendul(pidc, t->ret); @@ -70,8 +75,8 @@ procexec(Channel *pidc, char *prog, char *args[]) } void -procexecl(Channel *pidc, char *f, ...) +procexecl(Channel *pidc, int fd[3], char *f, ...) { - procexec(pidc, f, &f+1); + procexec(pidc, fd, f, &f+1); } |