Line | |
---|
1 | #include <lib.h>
|
---|
2 | #define ptrace _ptrace
|
---|
3 | #include <unistd.h>
|
---|
4 |
|
---|
5 | PUBLIC long ptrace(req, pid, addr, data)
|
---|
6 | int req;
|
---|
7 | pid_t pid;
|
---|
8 | long addr;
|
---|
9 | long data;
|
---|
10 | {
|
---|
11 | message m;
|
---|
12 |
|
---|
13 | m.m2_i1 = pid;
|
---|
14 | m.m2_i2 = req;
|
---|
15 | m.m2_l1 = addr;
|
---|
16 | m.m2_l2 = data;
|
---|
17 | if (_syscall(MM, PTRACE, &m) < 0) return(-1);
|
---|
18 |
|
---|
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
|
---|
21 | * for the error case.
|
---|
22 | */
|
---|
23 | if (m.m2_l2 == -1) errno = 0;
|
---|
24 | return(m.m2_l2);
|
---|
25 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.