diff options
Diffstat (limited to 'src/cmd/sam')
-rw-r--r-- | src/cmd/sam/sam.h | 3 | ||||
-rw-r--r-- | src/cmd/sam/unix.c | 20 |
2 files changed, 15 insertions, 8 deletions
diff --git a/src/cmd/sam/sam.h b/src/cmd/sam/sam.h index 1ab2b495..0641be81 100644 --- a/src/cmd/sam/sam.h +++ b/src/cmd/sam/sam.h @@ -3,6 +3,9 @@ #include <plumb.h> #include "errors.h" +#undef waitfor +#define waitfor samwaitfor + /* * BLOCKSIZE is relatively small to keep memory consumption down. */ diff --git a/src/cmd/sam/unix.c b/src/cmd/sam/unix.c index 162ba74f..2505f854 100644 --- a/src/cmd/sam/unix.c +++ b/src/cmd/sam/unix.c @@ -177,16 +177,20 @@ tempdisk(void) return fd; } -#undef wait +#undef waitfor int -waitfor(int pid) +samwaitfor(int pid) { - int wm; - int rpid; - - do; while((rpid = wait(&wm)) != pid && rpid != -1); - return (WEXITSTATUS(wm)); -} + int r; + Waitmsg *w; + + w = p9waitfor(pid); + if(w == nil) + return -1; + r = atoi(w->msg); + free(w); + return r; +} void samerr(char *buf) |