diff options
Diffstat (limited to 'src/cmd/rc/wait.c')
-rw-r--r-- | src/cmd/rc/wait.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/cmd/rc/wait.c b/src/cmd/rc/wait.c index 911601c..295cc57 100644 --- a/src/cmd/rc/wait.c +++ b/src/cmd/rc/wait.c @@ -10,7 +10,11 @@ struct WaitMsg int pid; int type; ulong time[3]; - int status; + struct{ + int code; + char *str; + }status; + char *str; }; // ----------------------------------------------------------------------- @@ -44,9 +48,11 @@ await(int pid4, int opt, struct WaitMsg *msg) msg->time[0] = u; msg->time[1] = s; msg->time[2] = u+s; - msg->status = WEXITSTATUS(status); msg->type = Pdone; + msg->status.code = WEXITSTATUS(status); + msg->status.str = nil; + return 1; } @@ -55,9 +61,11 @@ await(int pid4, int opt, struct WaitMsg *msg) msg->time[0] = u; msg->time[1] = s; msg->time[2] = u+s; - msg->status = WTERMSIG(status); msg->type = Psig; + msg->status.code = WTERMSIG(status); + msg->status.str = nil; + return 1; } @@ -66,7 +74,8 @@ await(int pid4, int opt, struct WaitMsg *msg) msg->time[0] = u; msg->time[1] = s; msg->time[2] = u+s; - msg->status = WSTOPSIG(status); + msg->status.code = WSTOPSIG(status); + msg->status.str = nil; msg->type = Pstop; return 1; @@ -88,22 +97,23 @@ shouldwait(Thread *job) return 0; } -static inline -void +static inline void notify(Thread *job, struct WaitMsg msg) { int i; for(i=0; i < job->wait.len; i++){ if(job->wait.on[i].pid == msg.pid){ - job->status = msg.status; + job->status = msg.status.code; switch(msg.type){ case Pstop: + /* NOTE: this needs to have an interactive check */ print(shell.err, "%d: suspended\n", msg.pid); job->wait.status = Pstop; job->wait.on[i].status = Pstop; break; case Psig: + /* NOTE: this needs to have an interactive check */ print(shell.err, "%d: terminated by signal %d\n", msg.pid, msg.status); /* fallthrough */ case Pdone: @@ -114,6 +124,7 @@ notify(Thread *job, struct WaitMsg msg) break; default: + /* NOTE: this needs to have an interactive check */ fatal("%d: unrecognized message type %d\n", msg.pid, msg.type); } break; |