[libc-commits] [libc] [libc] Support for argument-taking ptrace requests (PR #201830)
Pavel Labath via libc-commits
libc-commits at lists.llvm.org
Fri Jun 5 05:51:22 PDT 2026
================
@@ -22,8 +23,11 @@
namespace LIBC_NAMESPACE_DECL {
namespace linux_syscalls {
-LIBC_INLINE ErrorOr<long> ptrace(int request) {
- return syscall_checked<long>(SYS_ptrace, request);
+// NB: This function follows the kernel ABI, which means the result of
+// PTRACE_PEEK requests is returned through the fourth argument.
+LIBC_INLINE ErrorOr<long> ptrace(int request, pid_t pid, void *addr,
+ void *data) {
----------------
labath wrote:
This interface makes for the shortest amount of code. We could make it more user friendly by making it a template (the entry point uses `...` to let the users call it without casts), and handling the PTRACE_PEEK conversions inside this function, but I *really* hope we won't have any users of this function internally...
https://github.com/llvm/llvm-project/pull/201830
More information about the libc-commits
mailing list