Shortcut tests for fork/exec syscalls

This change should speed up strace by a tiny bit.

More importantly, it makes it much more clear that
fork and exec fixups are not necessary for any reasonably
recent kernels. IOW: syscall_fixup_for_fork_exec() and its callees
are all dead code.

* defs.h: Declare new need_fork_exec_workarounds flag variable.
* strace.c: Define need_fork_exec_workarounds flag variable.
(test_ptrace_setoptions_followfork): Return 0/1 as success/fail indicator.
(test_ptrace_setoptions_for_all): Likewise.
(init): Set need_fork_exec_workarounds to TRUE if needed.
* syscall.c: Rename internal_syscall() to syscall_fixup_for_fork_exec().
(trace_syscall_entering): Call syscall_fixup_for_fork_exec() only if
need_fork_exec_workarounds == TRUE.
(trace_syscall_exiting): Likewise.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
diff --git a/syscall.c b/syscall.c
index ec588b1..0eb1fd1 100644
--- a/syscall.c
+++ b/syscall.c
@@ -1482,7 +1482,7 @@
 #endif
 
 static void
-internal_syscall(struct tcb *tcp)
+syscall_fixup_for_fork_exec(struct tcb *tcp)
 {
 	/*
 	 * We must always trace a few critical system calls in order to
@@ -1782,7 +1782,8 @@
 	}
 #endif /* SYS_socket_subcall || SYS_ipc_subcall */
 
-	internal_syscall(tcp);
+	if (need_fork_exec_workarounds)
+		syscall_fixup_for_fork_exec(tcp);
 
 	if ((SCNO_IN_RANGE(tcp->scno) &&
 	     !(qual_flags[tcp->scno] & QUAL_TRACE)) ||
@@ -2206,7 +2207,8 @@
 		syscall_fixup_on_sysexit(tcp); /* never fails */
 		res = get_error(tcp); /* returns 1 or -1 */
 		if (res == 1) {
-			internal_syscall(tcp);
+			if (need_fork_exec_workarounds)
+				syscall_fixup_for_fork_exec(tcp);
 			if (filtered(tcp)) {
 				goto ret;
 			}