sys/ctrace: use waitstop for command started with -c (since they imply hang)
This commit is contained in:
parent
8b3be08c21
commit
d9345701c5
|
@ -11,6 +11,7 @@ Channel *quit;
|
||||||
Channel *forkc;
|
Channel *forkc;
|
||||||
int readers = 1;
|
int readers = 1;
|
||||||
int output;
|
int output;
|
||||||
|
int hanging = 0;
|
||||||
|
|
||||||
typedef struct Msg Msg;
|
typedef struct Msg Msg;
|
||||||
struct Msg {
|
struct Msg {
|
||||||
|
@ -70,7 +71,10 @@ reader(void *v)
|
||||||
if ((r.tfd = open(s->buf, OREAD)) < 0)
|
if ((r.tfd = open(s->buf, OREAD)) < 0)
|
||||||
die(&r);
|
die(&r);
|
||||||
|
|
||||||
cwrite(&r, "stop");
|
if(hanging)
|
||||||
|
cwrite(&r, "waitstop");
|
||||||
|
else
|
||||||
|
cwrite(&r, "stop");
|
||||||
cwrite(&r, "startsyscall");
|
cwrite(&r, "startsyscall");
|
||||||
|
|
||||||
while(pread(r.tfd, s->buf, sizeof(s->buf)-1, 0) > 0){
|
while(pread(r.tfd, s->buf, sizeof(s->buf)-1, 0) > 0){
|
||||||
|
@ -198,6 +202,7 @@ ParseArguments:
|
||||||
|
|
||||||
/* run a command? */
|
/* run a command? */
|
||||||
if(cmd) {
|
if(cmd) {
|
||||||
|
hanging = 1;
|
||||||
pid = fork();
|
pid = fork();
|
||||||
if (pid < 0)
|
if (pid < 0)
|
||||||
sysfatal("fork failed: %r");
|
sysfatal("fork failed: %r");
|
||||||
|
|
Loading…
Reference in New Issue