From 0349f7ecdc346a71900c1cd496e709d6622af585 Mon Sep 17 00:00:00 2001
From: "Christopher J. Morrone" <morrone2@llnl.gov>
Date: Thu, 28 Apr 2005 19:13:47 +0000
Subject: [PATCH] The AIX uses "PT_DETACH" for "PTRACE_DETACH".  For some odd
 reason PTRACE_DETRACE is defined on AIX, but it is the incorrect value.
 PT_DETACH is correct.

---
 src/slurmd/smgr.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/slurmd/smgr.c b/src/slurmd/smgr.c
index 074d2101460..af416242691 100644
--- a/src/slurmd/smgr.c
+++ b/src/slurmd/smgr.c
@@ -634,7 +634,11 @@ _pdebug_trace_process(slurmd_job_t *job, pid_t pid)
 		waitpid(pid, &status, WUNTRACED);
 		if ((pid > (pid_t) 0) && (kill(pid, SIGSTOP) < 0))
 			error("kill(%lu): %m", (unsigned long) pid);
+#ifdef HAVE_AIX
+		if (_PTRACE(PT_DETACH, pid, NULL, 0))
+#else
 		if (_PTRACE(PTRACE_DETACH, pid, NULL, 0))
+#endif
 			error("ptrace(%lu): %m", (unsigned long) pid);
 	}
 }
@@ -649,6 +653,10 @@ _pdebug_stop_current(slurmd_job_t *job)
 	 * Stop the task on exec for TotalView to connect 
 	 */
 	if ( (job->task_flags & TASK_PARALLEL_DEBUG)
+#ifdef HAVE_AIX
+	     && (_PTRACE(PT_TRACE_ME, 0, NULL, 0) < 0) )
+#else
 	     && (_PTRACE(PTRACE_TRACEME, 0, NULL, 0) < 0) )
+#endif
 		error("ptrace: %m");
 }
-- 
GitLab