implement ptrace syscall wrapper (untested)
authorRich Felker <dalias@aerifal.cx>
Thu, 15 Sep 2011 17:03:13 +0000 (13:03 -0400)
committerRich Felker <dalias@aerifal.cx>
Thu, 15 Sep 2011 17:03:13 +0000 (13:03 -0400)
include/sys/ptrace.h
src/misc/ptrace.c [new file with mode: 0644]

index 0459d1b..d7e8c76 100644 (file)
@@ -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 (file)
index 0000000..1cc0016
--- /dev/null
@@ -0,0 +1,18 @@
+#include <sys/ptrace.h>
+#include <stdarg.h>
+#include <unistd.h>
+#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);
+}