some coverity fixes.
[minix.git] / lib / libc / sys-minix / ptrace.c
blob859f736f25c0c1065f64baaf207a8e9309738b1b
1 #include <sys/cdefs.h>
2 #include "namespace.h"
3 #include <lib.h>
5 #include <sys/ptrace.h>
7 #ifdef __weak_alias
8 __weak_alias(ptrace, _ptrace)
9 #endif
11 long ptrace(int req, pid_t pid, long addr, long data)
13 message m;
15 m.m2_i1 = pid;
16 m.m2_i2 = req;
17 m.PMTRACE_ADDR = addr;
18 m.m2_l2 = data;
19 if (_syscall(PM_PROC_NR, PTRACE, &m) < 0) return(-1);
21 /* There was no error, but -1 is a legal return value. Clear errno if
22 * necessary to distinguish this case. _syscall has set errno to nonzero
23 * for the error case.
25 if (m.m2_l2 == -1) errno = 0;
26 return(m.m2_l2);