Don't perform TCB_WAITEXECVE wait if not needed.
* defs.h (ptrace_setoptions_for_all): Expose this variable.
* strace.c (ptrace_setoptions_for_all): Remove "static".
* process.c (internal_exec): Don't set TCB_WAITEXECVE bit
if we know that post-execve SIGTRAP is not going to happen.
diff --git a/process.c b/process.c
index 36ac5ab..9a767d3 100644
--- a/process.c
+++ b/process.c
@@ -1775,8 +1775,7 @@
#endif
int
-internal_exec(tcp)
-struct tcb *tcp;
+internal_exec(struct tcb *tcp)
{
#ifdef SUNOS4
if (exiting(tcp) && !syserror(tcp) && followfork)
@@ -1785,8 +1784,11 @@
#if defined LINUX && defined TCB_WAITEXECVE
if (exiting(tcp) && syserror(tcp))
tcp->flags &= ~TCB_WAITEXECVE;
- else
- tcp->flags |= TCB_WAITEXECVE;
+ else {
+ /* Maybe we have post-execve SIGTRAP suppressed? */
+ if (!(ptrace_setoptions_for_all & PTRACE_O_TRACEEXEC))
+ tcp->flags |= TCB_WAITEXECVE; /* no */
+ }
#endif /* LINUX && TCB_WAITEXECVE */
return 0;
}