]> granicus.if.org Git - strace/commitdiff
Use PTRACE_SUNDETACH everywhere on SPARC and SPARC64
authorJames Clarke <jrtc27@jrtc27.com>
Mon, 29 Aug 2016 23:50:33 +0000 (00:50 +0100)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 30 Aug 2016 00:48:36 +0000 (00:48 +0000)
SPARC has a different PTRACE_DETACH value correctly defined in
sys/ptrace.h, but linux/ptrace.h clobbers it with the standard one.
PTRACE_SUNDETACH is also defined to the correct value by sys/ptrace.h,
so use that instead.

* strace.c (detach) [SPARC]: Move redefinition of PTRACE_DETACH
to PTRACE_SUNDETACH ...
* ptrace.h [SPARC || SPARC64]: ... here.

ptrace.h
strace.c

index 0f3b022061f91aaf0b64c6e75cd7d497cd7bb5d0..ddb46cb4010e2d7ec733c9d99825fdc6286c3cb1 100644 (file)
--- a/ptrace.h
+++ b/ptrace.h
@@ -67,6 +67,16 @@ extern long ptrace(int, int, char *, long);
 # undef ptrace_peeksiginfo_args
 #endif
 
+#if defined(SPARC) || defined(SPARC64)
+/*
+ * SPARC has a different PTRACE_DETACH value correctly defined in sys/ptrace.h,
+ * but linux/ptrace.h clobbers it with the standard one.  PTRACE_SUNDETACH is
+ * also defined to the correct value by sys/ptrace.h, so use that instead.
+ */
+# undef PTRACE_DETACH
+# define PTRACE_DETACH PTRACE_SUNDETACH
+#endif
+
 #ifndef PTRACE_EVENT_FORK
 # define PTRACE_EVENT_FORK     1
 #endif
index 0ee43cff06107c783d3b84caab9805a8e0a2c5ee..a4b999e1269e0582249d470a985720c0dc1c586d 100644 (file)
--- a/strace.c
+++ b/strace.c
@@ -836,10 +836,6 @@ detach(struct tcb *tcp)
         * before detaching.  Arghh.  We go through hoops
         * to make a clean break of things.
         */
-#if defined(SPARC)
-# undef PTRACE_DETACH
-# define PTRACE_DETACH PTRACE_SUNDETACH
-#endif
 
        if (!(tcp->flags & TCB_ATTACHED))
                goto drop;