6 #include <sys/ptrace.h>
8 int ptrace(int req
, pid_t pid
, void *addr
, int data
)
12 memset(&m
, 0, sizeof(m
));
13 m
.m_lc_pm_ptrace
.pid
= pid
;
14 m
.m_lc_pm_ptrace
.req
= req
;
15 m
.m_lc_pm_ptrace
.addr
= (vir_bytes
)addr
;
16 m
.m_lc_pm_ptrace
.data
= data
;
17 if (_syscall(PM_PROC_NR
, PM_PTRACE
, &m
) < 0) return(-1);
19 /* There was no error, but -1 is a legal return value. Clear errno if
20 * necessary to distinguish this case. _syscall has set errno to nonzero
23 if (m
.m_pm_lc_ptrace
.data
== -1) errno
= 0;
24 return(m
.m_pm_lc_ptrace
.data
);