pseudofs: Simplify pfs_visible_proc

Reviewed by:		des
Differential revision:	https://reviews.freebsd.org/D39383
MFC after:		1 month
This commit is contained in:
Dmitry Chagin 2023-04-02 11:24:10 +03:00
parent 405c0c04ed
commit a32ed5ec05

View File

@ -90,21 +90,17 @@ pn_fileno(struct pfs_node *pn, pid_t pid)
static int static int
pfs_visible_proc(struct thread *td, struct pfs_node *pn, struct proc *proc) pfs_visible_proc(struct thread *td, struct pfs_node *pn, struct proc *proc)
{ {
int visible;
if (proc == NULL) if (proc == NULL)
return (0); return (0);
PROC_LOCK_ASSERT(proc, MA_OWNED); PROC_LOCK_ASSERT(proc, MA_OWNED);
visible = ((proc->p_flag & P_WEXIT) == 0); if ((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)
return (0); return (0);
return (1); if (p_cansee(td, proc) != 0)
return (0);
return (pn_vis(td, proc, pn));
} }
static int static int