Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 May 2021 01:14:51 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: b35e4edc97d8 - stable/13 - kern_ptrace: change type of proctree_locked to bool
Message-ID:  <202105100114.14A1Ep3F028665@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=b35e4edc97d82e7897abc0e15eb6839b65e3441d

commit b35e4edc97d82e7897abc0e15eb6839b65e3441d
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2021-04-30 21:14:26 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2021-05-10 01:02:36 +0000

    kern_ptrace: change type of proctree_locked to bool
    
    (cherry picked from commit 2bd0506c8d94a2c581dd16407f3a1c159a38769b)
---
 sys/kern/sys_process.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c
index c4dfc2def72a..cc440d932eb5 100644
--- a/sys/kern/sys_process.c
+++ b/sys/kern/sys_process.c
@@ -612,13 +612,14 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data)
 	struct ptrace_lwpinfo *pl;
 	struct ptrace_sc_ret *psr;
 	int error, num, tmp;
-	int proctree_locked = 0;
 	lwpid_t tid = 0, *buf;
 #ifdef COMPAT_FREEBSD32
 	int wrap32 = 0, safe = 0;
 #endif
+	bool proctree_locked;
 
 	curp = td->td_proc;
+	proctree_locked = false;
 
 	/* Lock proctree before locking the process. */
 	switch (req) {
@@ -636,7 +637,7 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data)
 	case PT_DETACH:
 	case PT_GET_SC_ARGS:
 		sx_xlock(&proctree_lock);
-		proctree_locked = 1;
+		proctree_locked = true;
 		break;
 	default:
 		break;
@@ -816,7 +817,7 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data)
 		    p->p_oppid);
 
 		sx_xunlock(&proctree_lock);
-		proctree_locked = 0;
+		proctree_locked = false;
 		MPASS(p->p_xthread == NULL);
 		MPASS((p->p_flag & P_STOPPED_TRACE) == 0);
 
@@ -1053,10 +1054,10 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data)
 		}
 
 		sx_xunlock(&proctree_lock);
-		proctree_locked = 0;
+		proctree_locked = false;
 
 	sendsig:
-		MPASS(proctree_locked == 0);
+		MPASS(!proctree_locked);
 
 		/*
 		 * Clear the pending event for the thread that just



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