summaryrefslogtreecommitdiff
path: root/defs.h
diff options
context:
space:
mode:
authorDenys Vlasenko <dvlasenk@redhat.com>2011-08-17 11:30:56 +0200
committerDenys Vlasenko <dvlasenk@redhat.com>2011-08-17 11:30:56 +0200
commit833fb13cef3f1f05b71361b5002aa3c2faad9615 (patch)
tree05db531e7dbd772f703e091d425e92cb6bb96400 /defs.h
parent19cdada5b499b978ffd9c3367b4ef34ad6f8bf2b (diff)
downloadstrace-833fb13cef3f1f05b71361b5002aa3c2faad9615.tar.gz
strace-833fb13cef3f1f05b71361b5002aa3c2faad9615.tar.bz2
strace-833fb13cef3f1f05b71361b5002aa3c2faad9615.tar.xz
Remove TCB_SUSPENDED constant and related code.
Since we no longer suspend waitpid'ing tracees, we have only one case when we suspend tracee: when we pick up a new tracee created by clone/fork/vfork. Background: on some other OSes, attach to child is done this way: get fork's result (pid), loop ptrace(PTRACE_ATTACH) until you hook up new process/thread. This is ugly and not safe, but what matters for us is that it doesn't require suspending. Suspending is required on Linux only, because on Linux attach to child is done differently. On Linux, we use two methods of catching new tracee: adding CLONE_THREAD bit to syscall (if needed, we change [v]fork into clone before that), or using ptrace options. In both cases, it may be so that new tracee appears before one which created it returns from syscall. In this case, current code suspends new tracee until its creator returns. Only then strace can determine who is its parent (it needs child's pid for this, which is visible in parent's [v]fork/clone result). This is inherently racy. For example, what if SIGKILL kills creator after it succeeded creating child, but before it returns? Looks like we will have child suspended forever. But after previous commit, we DO NOT NEED parent<->child link for anything. Therefore we do not need suspending too. Bingo! This patch removes suspending code. Now new tracees will be continued right away. Next patch will remove tcp->parent member. * defs.h: Remove TCB_SUSPENDED constant * process.c (handle_new_child): Delete this function. (internal_fork): Do not call handle_new_child on syscall exit. * strace.c (handle_ptrace_event): Delete this function. (trace): Do not suspend new child; remove all handling of now impossible TCB_SUSPENDED condition. Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'defs.h')
-rw-r--r--defs.h1
1 files changed, 0 insertions, 1 deletions
diff --git a/defs.h b/defs.h
index bd793a1..7356fe5 100644
--- a/defs.h
+++ b/defs.h
@@ -411,7 +411,6 @@ struct tcb {
#define TCB_INUSE 00002 /* This table entry is in use */
#define TCB_INSYSCALL 00004 /* A system call is in progress */
#define TCB_ATTACHED 00010 /* Process is not our own child */
-#define TCB_SUSPENDED 00040 /* Process can not be allowed to resume just now */
#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 */