summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2002-03-12 14:37:41 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2002-03-12 14:37:41 +0000
commit2a1ce5c0e75dfe8d3dd39c3d9186f7cd7795b6b8 (patch)
treeb395e06790687c656ab449ba7ed3161ac0e56d3d /sys
parent5b79aab6eebe0f7a472f6dca68a6d5c34c8e48e3 (diff)
Change the PT_IO interfaces like discussed on
the bsd-api-discuss list.
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/sys_process.c15
-rw-r--r--sys/sys/ptrace.h16
2 files changed, 18 insertions, 13 deletions
diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c
index 7f695677ae8..562fe227661 100644
--- a/sys/kern/sys_process.c
+++ b/sys/kern/sys_process.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys_process.c,v 1.20 2002/03/12 11:57:12 art Exp $ */
+/* $OpenBSD: sys_process.c,v 1.21 2002/03/12 14:37:40 art Exp $ */
/* $NetBSD: sys_process.c,v 1.55 1996/05/15 06:17:47 tls Exp $ */
/*-
@@ -89,9 +89,9 @@ sys_ptrace(p, v, retval)
struct proc *t; /* target process */
struct uio uio;
struct iovec iov;
+ struct ptrace_io_desc piod;
int error, write;
int temp;
- struct ptrace_io_desc piod;
/* "A foolish consistency..." XXX */
if (SCARG(uap, req) == PT_TRACE_ME)
@@ -242,19 +242,20 @@ sys_ptrace(p, v, retval)
uio.uio_segflg = UIO_USERSPACE;
uio.uio_procp = p;
switch (piod.piod_op) {
- case PIOD_OP_READ_DATA:
- case PIOD_OP_READ_TEXT:
+ case PIOD_READ_D:
+ case PIOD_READ_I:
uio.uio_rw = UIO_READ;
break;
- case PIOD_OP_WRITE_DATA:
- case PIOD_OP_WRITE_TEXT:
+ case PIOD_WRITE_D:
+ case PIOD_WRITE_I:
uio.uio_rw = UIO_WRITE;
break;
default:
return (EINVAL);
}
error = procfs_domem(p, t, NULL, &uio);
- *retval = piod.piod_len - uio.uio_resid;
+ piod.piod_len -= uio.uio_resid;
+ (void) copyout(&piod, SCARG(uap, addr), sizeof(piod));
return (error);
#ifdef PT_STEP
case PT_STEP:
diff --git a/sys/sys/ptrace.h b/sys/sys/ptrace.h
index c8b76d99828..5caa4b11229 100644
--- a/sys/sys/ptrace.h
+++ b/sys/sys/ptrace.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ptrace.h,v 1.5 2002/03/11 15:39:27 art Exp $ */
+/* $OpenBSD: ptrace.h,v 1.6 2002/03/12 14:37:40 art Exp $ */
/* $NetBSD: ptrace.h,v 1.21 1996/02/09 18:25:26 christos Exp $ */
/*-
@@ -51,16 +51,20 @@
#define PT_IO 11 /* do I/O to/from the stopped process. */
struct ptrace_io_desc {
- int piod_op;
-#define PIOD_OP_READ_DATA 1
-#define PIOD_OP_WRITE_DATA 2
-#define PIOD_OP_READ_TEXT 3
-#define PIOD_OP_WRITE_TEXT 4
+ int piod_op; /* I/O operation */
void *piod_offs; /* child offset */
void *piod_addr; /* parent offset */
size_t piod_len; /* request length */
};
+/*
+ * Operations in piod_op.
+ */
+#define PIOD_READ_D 1 /* Read from D space */
+#define PIOD_WRITE_D 2 /* Write to D space */
+#define PIOD_READ_I 3 /* Read from I space */
+#define PIOD_WRITE_I 4 /* Write to I space */
+
#define PT_FIRSTMACH 32 /* for machine-specific requests */
#include <machine/ptrace.h> /* machine-specific requests, if any */