b4a9f75508
Address <sys/user.h> removal fallout.
67 lines
2 KiB
Text
67 lines
2 KiB
Text
$NetBSD: patch-am,v 1.4 2017/06/23 22:13:22 kamil Exp $
|
|
|
|
- Use standard headers.
|
|
- Support NetBSD.
|
|
- LP64 fix.
|
|
|
|
--- src/pcat/pcat.c.orig 2001-09-25 17:22:20.000000000 +0000
|
|
+++ src/pcat/pcat.c
|
|
@@ -75,6 +75,7 @@
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
+#include <string.h>
|
|
#include <unistd.h>
|
|
#include <fcntl.h>
|
|
#include <signal.h>
|
|
@@ -177,6 +178,23 @@
|
|
#endif
|
|
|
|
/*
|
|
+ * Based on the OpenBSD code above.
|
|
+ */
|
|
+#if defined(NETBSD1) || defined(NETBSD2)
|
|
+#define SUPPORTED
|
|
+#include <sys/param.h>
|
|
+#include <sys/sysctl.h>
|
|
+#include <kvm.h>
|
|
+#include <stddef.h>
|
|
+#define HAVE_PTRACE_MEM
|
|
+#define PTRACE_ATTACH PT_ATTACH
|
|
+#define PTRACE_DETACH PT_DETACH
|
|
+#define PTRACE_PEEKDATA PT_READ_D
|
|
+#define HAVE_BROKEN_CTOB
|
|
+#define PTRACE_ARG3_T caddr_t
|
|
+#endif
|
|
+
|
|
+ /*
|
|
* SunOS 4.x has no /proc, and ptrace() peeking the u area won't give us the
|
|
* process memory segment sizes. Instead we must grope process information
|
|
* from kernel virtual memory. This requires super-user privilege.
|
|
@@ -414,7 +432,7 @@ static int ptrace_attach_wait(pid_t pid)
|
|
|
|
/* call_ptrace - ptrace() with error handling */
|
|
|
|
-static int call_ptrace(int request, pid_t pid, int addr, int data)
|
|
+static int call_ptrace(int request, pid_t pid, uintptr_t addr, int data)
|
|
{
|
|
int result;
|
|
|
|
@@ -456,7 +474,7 @@ static void read_proc(PROC_INFO *proc, c
|
|
"; did you use GCC with another machine's header files?" : "");
|
|
#else
|
|
int words[READ_BUFSIZ_WORDS];
|
|
- int addr;
|
|
+ uintptr_t addr;
|
|
int n;
|
|
|
|
/*
|
|
@@ -469,7 +487,7 @@ static void read_proc(PROC_INFO *proc, c
|
|
panic("read_proc: request size %d is not word-aligned", len);
|
|
if (verbose)
|
|
fprintf(stderr, "read seek to 0x%lx\n", (long) offset);
|
|
- for (n = 0, addr = (int) offset; n < len / sizeof(int); addr += sizeof(int), n++)
|
|
+ for (n = 0, addr = (uintptr_t) offset; n < len / sizeof(int); addr += sizeof(int), n++)
|
|
words[n] = call_ptrace(PTRACE_PEEKDATA, proc->pid, addr, 0);
|
|
memcpy(data, (char *) words, len);
|
|
#endif
|