implement ptrace syscall wrapper (untested)

This commit is contained in:
Rich Felker 2011-09-15 13:03:13 -04:00
parent d1d141c5f1
commit 71f7a3c2ce
2 changed files with 19 additions and 1 deletions

View 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
}

18
src/misc/ptrace.c Normal file
View File

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