aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2021-04-30 21:14:26 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2021-05-03 16:13:48 +0000
commit2bd0506c8d94a2c581dd16407f3a1c159a38769b (patch)
tree6f5355a3cef173bc80c47bbb7dcd2e530401ea6f
parentaf928fded0705100e4f3926c99ed488f7ab6dcf1 (diff)
downloadsrc-2bd0506c8d94a2c581dd16407f3a1c159a38769b.tar.gz
src-2bd0506c8d94a2c581dd16407f3a1c159a38769b.zip
kern_ptrace: change type of proctree_locked to bool
Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29955
-rw-r--r--sys/kern/sys_process.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c
index 27a690e65638..492ef287ca53 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