I have this simple C program on MacOS:
#include <stdlib.h>
#include <sys/wait.h>
#include <stdio.h>
#include <sys/ptrace.h>
int main(int argc, char *argv[]) {
pid_t pid = atoi(argv[1]);
printf("pid = %jd\n", (intmax_t) pid);
return ptrace(PT_ATTACHEXC, pid, 0, 0);
}
when I compile with gcc / cc, I get this error:
In file included from my-waiter.c:4: /usr/include/sys/ptrace.h:99:38: error: unknown type name 'caddr_t' int ptrace(int _request, pid_t _pid, caddr_t _addr, int _data); ^ 1 error generated.
does anyone know how to use ptrace() on OSX? I can't figure out how to get this to compile.