This is an automated email from the ASF dual-hosted git repository.
masaori pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 0019d04d38 traffic_crashlog: compile for FreeBSD (#12002)
0019d04d38 is described below
commit 0019d04d3896401fdc38879de5fb37647aeda844
Author: Yann Kerhervé <[email protected]>
AuthorDate: Tue Feb 4 20:40:42 2025 -0800
traffic_crashlog: compile for FreeBSD (#12002)
Update calls to conform to FreeBSD's ptrace(2).
Note that this depends on deprecated procfs(5) and has not been
tested beyond passing the build test. See #12001
---
src/traffic_crashlog/backtrace.cc | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/traffic_crashlog/backtrace.cc
b/src/traffic_crashlog/backtrace.cc
index 9967909bf5..ab0ae983b3 100644
--- a/src/traffic_crashlog/backtrace.cc
+++ b/src/traffic_crashlog/backtrace.cc
@@ -37,6 +37,15 @@
#include <string.h>
#include <libunwind.h>
#include <libunwind-ptrace.h>
+#if defined(__FreeBSD__)
+#include <sys/types.h>
+#define __WALL P_ALL
+#define PTRACE_ATTACH PT_ATTACH
+#define PTRACE_DETACH PT_DETACH
+#define DATA_NULL 0
+#else
+#define DATA_NULL NULL
+#endif
#include <sys/ptrace.h>
#include <cxxabi.h>
#include <vector>
@@ -158,7 +167,7 @@ done:
_UPT_destroy(ap);
}
- status = ptrace(PTRACE_DETACH, target, NULL, NULL);
+ status = ptrace(PTRACE_DETACH, target, NULL, DATA_NULL);
Dbg(dbg_ctl_backtrace, "ptrace(DETACH, %ld) -> %d (errno %d)\n",
(long)target, status, errno);
}
} // namespace