From: Denys Vlasenko Date: Mon, 5 Sep 2011 12:01:33 +0000 (+0200) Subject: Get rid of TCB_ATTACH_DONE X-Git-Tag: v4.7~257 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d116a7338645af45090aecc331701e999148d284;p=strace Get rid of TCB_ATTACH_DONE * defs.h: Remove TCB_ATTACH_DONE constant. * strace.c (startup_attach): Use TCB_STARTUP instead of TCB_ATTACH_DONE to distinquish attached from not-yet-attached threads. Signed-off-by: Denys Vlasenko --- diff --git a/defs.h b/defs.h index dd8fc648..9c0d340a 100644 --- a/defs.h +++ b/defs.h @@ -458,9 +458,6 @@ struct tcb { */ #define TCB_INSYSCALL 00004 #define TCB_ATTACHED 00010 /* Process is not our own child */ -#ifdef LINUX -#define TCB_ATTACH_DONE 00020 /* PTRACE_ATTACH was done on this tcb->pid */ -#endif #define TCB_BPTSET 00100 /* "Breakpoint" set after fork(2) */ #define TCB_SIGTRAPPED 00200 /* Process wanted to block SIGTRAP */ #define TCB_REPRINT 01000 /* We should reprint this syscall on exit */ diff --git a/strace.c b/strace.c index e95ff5ce..c911ae41 100644 --- a/strace.c +++ b/strace.c @@ -444,13 +444,11 @@ startup_attach(void) for (tcbi = 0; tcbi < tcbtabsize; tcbi++) { tcp = tcbtab[tcbi]; - if (!(tcp->flags & TCB_INUSE) || !(tcp->flags & TCB_ATTACHED)) - continue; -#ifdef LINUX - if (tcp->flags & TCB_ATTACH_DONE) - continue; -#endif - /* Reinitialize the output since it may have changed. */ + /* Is this a process we should attach to, but not yet attached? */ + if ((tcp->flags & (TCB_ATTACHED | TCB_STARTUP)) != TCB_ATTACHED) + continue; /* no */ + + /* Reinitialize the output since it may have changed */ tcp->outf = outf; newoutf(tcp); @@ -493,7 +491,7 @@ startup_attach(void) cur_tcp = tcp; if (tid != tcp->pid) cur_tcp = alloctcb(tid); - cur_tcp->flags |= TCB_ATTACHED|TCB_ATTACH_DONE|TCB_STARTUP; + cur_tcp->flags |= TCB_ATTACHED | TCB_STARTUP; } closedir(dir); if (interactive) { @@ -548,14 +546,6 @@ startup_attach(void) } /* for each tcbtab[] */ ret: -#ifdef LINUX - /* TCB_ATTACH_DONE flag is used only in this function */ - for (tcbi = 0; tcbi < tcbtabsize; tcbi++) { - tcp = tcbtab[tcbi]; - tcp->flags &= ~TCB_ATTACH_DONE; - } -#endif - if (interactive) sigprocmask(SIG_SETMASK, &empty_set, NULL); }