From 71f7a3c2ce7377a6c77f46524002505b9454861b Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Thu, 15 Sep 2011 13:03:13 -0400 Subject: [PATCH] implement ptrace syscall wrapper (untested) --- include/sys/ptrace.h | 2 +- src/misc/ptrace.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 src/misc/ptrace.c diff --git a/include/sys/ptrace.h b/include/sys/ptrace.h index 0459d1b6..d7e8c76e 100644 --- a/include/sys/ptrace.h +++ b/include/sys/ptrace.h @@ -69,7 +69,7 @@ extern "C" { #define PTRACE_EVENT_VFORK_DONE 5 #define PTRACE_EVENT_EXIT 6 -long int ptrace(int, ...); +long ptrace(int, ...); #ifdef __cplusplus } diff --git a/src/misc/ptrace.c b/src/misc/ptrace.c new file mode 100644 index 00000000..1cc00167 --- /dev/null +++ b/src/misc/ptrace.c @@ -0,0 +1,18 @@ +#include +#include +#include +#include "syscall.h" + +long ptrace(int req, ...) +{ + va_list ap; + pid_t pid; + void *addr, *data, *addr2; + va_start(ap, req); + pid = va_arg(ap, pid_t); + addr = va_arg(ap, void *); + data = va_arg(ap, void *); + addr2 = va_arg(ap, void *); + va_end(ap); + return syscall(SYS_ptrace, req, pid, addr, data, addr2); +} -- GitLab