Fixup fromcvs/togit conversion
[minix-pkgsrc.git] / sysutils / strace / patches / patch-ba
bloba9be712cb9a0bc2cc44ea3172800c6a05e7a0bb0
1 $NetBSD$
3 --- util.c.orig 2005-10-21 18:06:46.000000000 -0400
4 +++ util.c      2007-04-27 11:31:51.000000000 -0400
5 @@ -36,9 +36,9 @@
6  #include "defs.h"
7  
8  #include <signal.h>
9 +#include <sys/param.h>
10  #include <sys/syscall.h>
11  #include <sys/user.h>
12 -#include <sys/param.h>
13  #include <fcntl.h>
14  #if HAVE_SYS_UIO_H
15  #include <sys/uio.h>
16 @@ -58,6 +58,9 @@
17  # include <asm/rse.h>
18  #endif
20 +#ifdef NETBSD
21 +#include <machine/reg.h>
22 +#endif
23  #ifdef HAVE_SYS_REG_H
24  #include <sys/reg.h>
25  # define PTRACE_PEEKUSR PTRACE_PEEKUSER
26 @@ -96,6 +99,7 @@
27  # define PTRACE_SETREGS PTRACE_SETREGS64
28  #endif /* SPARC64 */
31  #if !defined(__GLIBC__)
33  #include <linux/unistd.h>
34 @@ -759,6 +763,20 @@
35                 return -1;
36  #endif /* USE_PROCFS */
38 +#ifdef NETBSD
39 +       struct ptrace_io_desc piod;
41 +       piod.piod_op = PIOD_READ_D;
42 +       piod.piod_offs = (void *)addr;
43 +       piod.piod_addr = laddr;
44 +       piod.piod_len = len;
46 +       if (ptrace(PT_IO, tcp->pid, (char *)&piod, sizeof(piod)) < 0) {
47 +               perror("PT_IO");
48 +               return -1;
49 +       }
50 +#endif
52         return 0;
53  }
55 @@ -1079,6 +1097,14 @@
56         pread(tcp->pfd_reg, &regs, sizeof(regs), 0);
57         return regs.r_eip;
58  #endif /* FREEBSD */
59 +#ifdef NETBSD
60 +       struct reg regs;
61 +       if (ptrace(PTRACE_GETREGS, tcp->pid, (char *) &regs, 0) < 0) {
62 +               perror("getpc: ptrace(PTRACE_GETREGS, ...)");
63 +               return -1;
64 +       }
65 +       return regs.r_eip;
66 +#endif /* NETBSD */
67  }
68  #endif