The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=85c855d31b18d7a8ab534259f27444c81b6ec797
commit 85c855d31b18d7a8ab534259f27444c81b6ec797 Author: Mateusz Guzik <m...@freebsd.org> AuthorDate: 2021-09-30 10:49:51 +0000 Commit: Mateusz Guzik <m...@freebsd.org> CommitDate: 2021-09-30 10:49:51 +0000 fd: add pwd_hold_proc --- sys/kern/kern_descrip.c | 20 ++++++++++++++++++++ sys/sys/filedesc.h | 1 + 2 files changed, 21 insertions(+) diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 58c2d1939dba..755b5df51c6a 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -3791,6 +3791,26 @@ pwd_hold(struct thread *td) return (pwd); } +struct pwd * +pwd_hold_proc(struct proc *p) +{ + struct pwddesc *pdp; + struct pwd *pwd; + + PROC_ASSERT_HELD(p); + PROC_LOCK(p); + pdp = pdhold(p); + MPASS(pdp != NULL); + PROC_UNLOCK(p); + + PWDDESC_XLOCK(pdp); + pwd = pwd_hold_pwddesc(pdp); + MPASS(pwd != NULL); + PWDDESC_XUNLOCK(pdp); + pddrop(pdp); + return (pwd); +} + static struct pwd * pwd_alloc(void) { diff --git a/sys/sys/filedesc.h b/sys/sys/filedesc.h index 7f18d8a2286c..f17fdf601ba1 100644 --- a/sys/sys/filedesc.h +++ b/sys/sys/filedesc.h @@ -341,6 +341,7 @@ void pwd_set_rootvnode(void); struct pwd *pwd_hold_pwddesc(struct pwddesc *pdp); bool pwd_hold_smr(struct pwd *pwd); +struct pwd *pwd_hold_proc(struct proc *p); struct pwd *pwd_hold(struct thread *td); void pwd_drop(struct pwd *pwd); static inline void _______________________________________________ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"