Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Oct 2021 09:15:53 GMT
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: e6014341647f - stable/13 - fd: add pwd_hold_proc
Message-ID:  <202110110915.19B9FrTl009578@gitrepo.freebsd.org>

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

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

commit e6014341647f9a45dab9d09f57d475c50137e6b6
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2021-09-30 10:49:51 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2021-10-11 09:13:03 +0000

    fd: add pwd_hold_proc
    
    (cherry picked from commit 85c855d31b18d7a8ab534259f27444c81b6ec797)
---
 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



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