Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 2 Apr 2023 08:24:30 GMT
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: a32ed5ec05d9 - main - pseudofs: Simplify pfs_visible_proc
Message-ID:  <202304020824.3328OU1h076366@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by dchagin:

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

commit a32ed5ec05d9bc01b8e70b45ff510d2f972a0877
Author:     Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2023-04-02 08:24:10 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2023-04-02 08:24:10 +0000

    pseudofs: Simplify pfs_visible_proc
    
    Reviewed by:            des
    Differential revision:  https://reviews.freebsd.org/D39383
    MFC after:              1 month
---
 sys/fs/pseudofs/pseudofs_vnops.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/sys/fs/pseudofs/pseudofs_vnops.c b/sys/fs/pseudofs/pseudofs_vnops.c
index 96c59d7c023d..53e4c2b6b85c 100644
--- a/sys/fs/pseudofs/pseudofs_vnops.c
+++ b/sys/fs/pseudofs/pseudofs_vnops.c
@@ -90,21 +90,17 @@ pn_fileno(struct pfs_node *pn, pid_t pid)
 static int
 pfs_visible_proc(struct thread *td, struct pfs_node *pn, struct proc *proc)
 {
-	int visible;
 
 	if (proc == NULL)
 		return (0);
 
 	PROC_LOCK_ASSERT(proc, MA_OWNED);
 
-	visible = ((proc->p_flag & P_WEXIT) == 0);
-	if (visible)
-		visible = (p_cansee(td, proc) == 0);
-	if (visible && pn->pn_vis != NULL)
-		visible = pn_vis(td, proc, pn);
-	if (!visible)
+	if ((proc->p_flag & P_WEXIT) != 0)
 		return (0);
-	return (1);
+	if (p_cansee(td, proc) != 0)
+		return (0);
+	return (pn_vis(td, proc, pn));
 }
 
 static int



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