about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-09-15 13:03:13 -0400
committerRich Felker <dalias@aerifal.cx>2011-09-15 13:03:13 -0400
commit71f7a3c2ce7377a6c77f46524002505b9454861b (patch)
treee82f10fc18d71481d8c11014b362910994192985
parentd1d141c5f128d2ea6efa0e5aad25c3f8af41cadc (diff)
downloadmusl-71f7a3c2ce7377a6c77f46524002505b9454861b.tar.gz
musl-71f7a3c2ce7377a6c77f46524002505b9454861b.tar.xz
musl-71f7a3c2ce7377a6c77f46524002505b9454861b.zip
implement ptrace syscall wrapper (untested)
-rw-r--r--include/sys/ptrace.h2
-rw-r--r--src/misc/ptrace.c18
2 files changed, 19 insertions, 1 deletions
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 <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);
+}