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); +}