Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/compat/linux/common Fixed the return value of ptrace for...



details:   https://anonhg.NetBSD.org/src/rev/d53425922c86
branches:  trunk
changeset: 510379:d53425922c86
user:      manu <manu%NetBSD.org@localhost>
date:      Sun May 27 21:17:16 2001 +0000

description:
Fixed the return value of ptrace for PEEKTEXT and PEEKDATA: return value must
be a pointer to data, which holds the result. Linux's glibc undo this odd
operation to bring the standard ptrace behavior to userland.

diffstat:

 sys/compat/linux/common/linux_misc.c |  18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diffs (39 lines):

diff -r a830cf5521ac -r d53425922c86 sys/compat/linux/common/linux_misc.c
--- a/sys/compat/linux/common/linux_misc.c      Sun May 27 21:15:59 2001 +0000
+++ b/sys/compat/linux/common/linux_misc.c      Sun May 27 21:17:16 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_misc.c,v 1.88 2001/05/20 09:29:10 manu Exp $     */
+/*     $NetBSD: linux_misc.c,v 1.89 2001/05/27 21:17:16 manu Exp $     */
 
 /*-
  * Copyright (c) 1995, 1998, 1999 The NetBSD Foundation, Inc.
@@ -1223,6 +1223,7 @@
        } */ *uap = v;
        const int *ptr;
        int request;
+       int error;
 
        ptr = linux_ptrace_request_map;
        request = SCARG(uap, request);
@@ -1247,7 +1248,20 @@
                        if (request == LINUX_PTRACE_CONT && SCARG(uap, addr)==0)
                                SCARG(&pta, addr) = (caddr_t) 1;
                        
-                       return sys_ptrace(p, &pta, retval);
+                       error = sys_ptrace(p, &pta, retval);
+                       if (!error) 
+                               switch (request) {
+                                       case LINUX_PTRACE_PEEKTEXT:
+                                       case LINUX_PTRACE_PEEKDATA:
+                                               error = copyout (retval, 
+                                                   (caddr_t)SCARG(&pta, data), 
+                                                   sizeof retval);
+                                               *retval = SCARG(&pta, data);
+                                               break;
+                                       default:        
+                                               break;
+                               }
+                       return error;
                }
                else
                        ptr++;



Home | Main Index | Thread Index | Old Index