git: baf3b132b572 - stable/15 - sys_procdesc: extract procdesc_destroy()

Konstantin Belousov <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src
Message-ID <6a812489.44914.14e3a9e4__30602.4915234715$1786848516$gmane$org@gitrepo.freebsd.org>
The branch stable/15 has been updated by kib:

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

commit baf3b132b572e7cc7963425304d49043926c2c6f
Author:     Konstantin Belousov <[email protected]>
AuthorDate: 2026-06-05 01:42:44 +0000
Commit:     Konstantin Belousov <[email protected]>
CommitDate: 2026-08-16 02:41:20 +0000

    sys_procdesc: extract procdesc_destroy()
    
    (cherry picked from commit 90b560f7bae649f9770e787d9e268401a1319493)
---
 sys/kern/sys_procdesc.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/sys/kern/sys_procdesc.c b/sys/kern/sys_procdesc.c
index cb2d779df158..3c99f0241016 100644
--- a/sys/kern/sys_procdesc.c
+++ b/sys/kern/sys_procdesc.c
@@ -272,6 +272,14 @@ procdesc_finit(struct procdesc *pdp, struct file *fp)
 	finit(fp, FREAD | FWRITE, DTYPE_PROCDESC, pdp, &procdesc_ops);
 }
 
+static void
+procdesc_destroy(struct procdesc *pd)
+{
+	knlist_destroy(&pd->pd_selinfo.si_note);
+	PROCDESC_LOCK_DESTROY(pd);
+	free(pd, M_PROCDESC);
+}
+
 static void
 procdesc_free(struct procdesc *pd)
 {
@@ -292,9 +300,7 @@ procdesc_free(struct procdesc *pd)
 			proc_id_clear(PROC_ID_PID, pd->pd_pid);
 
 		seldrain(&pd->pd_selinfo);
-		knlist_destroy(&pd->pd_selinfo.si_note);
-		PROCDESC_LOCK_DESTROY(pd);
-		free(pd, M_PROCDESC);
+		procdesc_destroy(pd);
 	}
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.