Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Aug 2020 19:25:19 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r364506 - stable/12/sys/amd64/linux
Message-ID:  <202008231925.07NJPJeu062425@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Sun Aug 23 19:25:19 2020
New Revision: 364506
URL: https://svnweb.freebsd.org/changeset/base/364506

Log:
  MFC r348049:
  
  Make linux_ptrace() use linux_msg() instead of printf().
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  stable/12/sys/amd64/linux/linux_ptrace.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/amd64/linux/linux_ptrace.c
==============================================================================
--- stable/12/sys/amd64/linux/linux_ptrace.c	Sun Aug 23 19:22:42 2020	(r364505)
+++ stable/12/sys/amd64/linux/linux_ptrace.c	Sun Aug 23 19:25:19 2020	(r364506)
@@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
 #include <compat/linux/linux_emul.h>
 #include <compat/linux/linux_misc.h>
 #include <compat/linux/linux_signal.h>
+#include <compat/linux/linux_util.h>
 
 #define	LINUX_PTRACE_TRACEME		0
 #define	LINUX_PTRACE_PEEKTEXT		1
@@ -123,7 +124,7 @@ linux_ptrace_status(struct thread *td, pid_t pid, int 
 	error = kern_ptrace(td, PT_LWPINFO, pid, &lwpinfo, sizeof(lwpinfo));
 	td->td_retval[0] = saved_retval;
 	if (error != 0) {
-		printf("%s: PT_LWPINFO failed with error %d\n", __func__, error);
+		linux_msg(td, "PT_LWPINFO failed with error %d", error);
 		return (status);
 	}
 
@@ -320,9 +321,9 @@ linux_ptrace_setoptions(struct thread *td, pid_t pid, 
 	mask = 0;
 
 	if (data & ~LINUX_PTRACE_O_MASK) {
-		printf("%s: unknown ptrace option %lx set; "
-		    "returning EINVAL\n",
-		    __func__, data & ~LINUX_PTRACE_O_MASK);
+		linux_msg(td, "unknown ptrace option %lx set; "
+		    "returning EINVAL",
+		    data & ~LINUX_PTRACE_O_MASK);
 		return (EINVAL);
 	}
 
@@ -357,8 +358,8 @@ linux_ptrace_setoptions(struct thread *td, pid_t pid, 
 		mask |= PTRACE_VFORK; /* XXX: Close enough? */
 
 	if (data & LINUX_PTRACE_O_TRACEEXIT) {
-		printf("%s: PTRACE_O_TRACEEXIT not implemented; "
-		    "returning EINVAL\n", __func__);
+		linux_msg(td, "PTRACE_O_TRACEEXIT not implemented; "
+		    "returning EINVAL");
 		return (EINVAL);
 	}
 
@@ -381,7 +382,7 @@ linux_ptrace_getregs(struct thread *td, pid_t pid, voi
 
 	error = kern_ptrace(td, PT_LWPINFO, pid, &lwpinfo, sizeof(lwpinfo));
 	if (error != 0) {
-		printf("%s: PT_LWPINFO failed with error %d\n", __func__, error);
+		linux_msg(td, "PT_LWPINFO failed with error %d", error);
 		return (error);
 	}
 	if (lwpinfo.pl_flags & PL_FLAG_SCE) {
@@ -433,7 +434,7 @@ linux_ptrace_getregset_prstatus(struct thread *td, pid
 
 	error = copyin((const void *)data, &iov, sizeof(iov));
 	if (error != 0) {
-		printf("%s: copyin error %d\n", __func__, error);
+		linux_msg(td, "copyin error %d", error);
 		return (error);
 	}
 
@@ -451,8 +452,7 @@ linux_ptrace_getregset_prstatus(struct thread *td, pid
 
 	error = kern_ptrace(td, PT_LWPINFO, pid, &lwpinfo, sizeof(lwpinfo));
 	if (error != 0) {
-		printf("%s: PT_LWPINFO failed with error %d\n",
-		    __func__, error);
+		linux_msg(td, "PT_LWPINFO failed with error %d", error);
 		return (error);
 	}
 	if (lwpinfo.pl_flags & PL_FLAG_SCE) {
@@ -474,14 +474,14 @@ linux_ptrace_getregset_prstatus(struct thread *td, pid
 	len = MIN(iov.iov_len, sizeof(l_regset));
 	error = copyout(&l_regset, (void *)iov.iov_base, len);
 	if (error != 0) {
-		printf("%s: copyout error %d\n", __func__, error);
+		linux_msg(td, "copyout error %d", error);
 		return (error);
 	}
 
 	iov.iov_len -= len;
 	error = copyout(&iov, (void *)data, sizeof(iov));
 	if (error != 0) {
-		printf("%s: iov copyout error %d\n", __func__, error);
+		linux_msg(td, "iov copyout error %d", error);
 		return (error);
 	}
 
@@ -496,8 +496,8 @@ linux_ptrace_getregset(struct thread *td, pid_t pid, l
 	case LINUX_NT_PRSTATUS:
 		return (linux_ptrace_getregset_prstatus(td, pid, data));
 	default:
-		printf("%s: PTRACE_GETREGSET request %ld not implemented; "
-		    "returning EINVAL\n", __func__, addr);
+		linux_msg(td, "PTRACE_GETREGSET request %ld not implemented; "
+		    "returning EINVAL", addr);
 		return (EINVAL);
 	}
 }
@@ -506,7 +506,7 @@ static int
 linux_ptrace_seize(struct thread *td, pid_t pid, l_ulong addr, l_ulong data)
 {
 
-	printf("%s: PTRACE_SEIZE not implemented; returning EINVAL\n", __func__);
+	linux_msg(td, "PTRACE_SEIZE not implemented; returning EINVAL");
 	return (EINVAL);
 }
 
@@ -587,8 +587,8 @@ linux_ptrace(struct thread *td, struct linux_ptrace_ar
 		error = linux_ptrace_seize(td, pid, uap->addr, uap->data);
 		break;
 	default:
-		printf("%s: ptrace(%ld, ...) not implemented; returning EINVAL\n",
-		    __func__, uap->req);
+		linux_msg(td, "ptrace(%ld, ...) not implemented; "
+		    "returning EINVAL", uap->req);
 		error = EINVAL;
 		break;
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202008231925.07NJPJeu062425>