delete a redundant if in dynamic linker ctor execution loop
[musl.git] / src / linux / ptrace.c
bloba3f393d956b3c73c63ec7f7636f315e76be54645
1 #include <sys/ptrace.h>
2 #include <stdarg.h>
3 #include <unistd.h>
4 #include "syscall.h"
6 long ptrace(int req, ...)
8 va_list ap;
9 pid_t pid;
10 void *addr, *data, *addr2 = 0;
11 long ret, result;
13 va_start(ap, req);
14 pid = va_arg(ap, pid_t);
15 addr = va_arg(ap, void *);
16 data = va_arg(ap, void *);
17 /* PTRACE_{READ,WRITE}{DATA,TEXT} (16...19) are specific to SPARC. */
18 #ifdef PTRACE_READDATA
19 if ((unsigned)req - PTRACE_READDATA < 4)
20 addr2 = va_arg(ap, void *);
21 #endif
22 va_end(ap);
24 if (req-1U < 3) data = &result;
25 ret = syscall(SYS_ptrace, req, pid, addr, data, addr2);
27 if (ret < 0 || req-1U >= 3) return ret;
28 return result;