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 <dvlasenk@redhat.com>
diff --git a/strace.c b/strace.c
index e95ff5c..c911ae4 100644
--- a/strace.c
+++ b/strace.c
@@ -444,13 +444,11 @@
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 @@
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 @@
} /* 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);
}