git: 974770199877 - main - sys_procdesc: extract pdtofdflags()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 07 Jul 2026 01:57:12 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=974770199877ae7aa912b6dced909429c52dea93
commit 974770199877ae7aa912b6dced909429c52dea93
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-05-20 02:03:32 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-07-07 01:23:25 +0000
sys_procdesc: extract pdtofdflags()
Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D57124
---
sys/kern/sys_procdesc.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/sys/kern/sys_procdesc.c b/sys/kern/sys_procdesc.c
index e6d8ac403dfb..69f327e3604e 100644
--- a/sys/kern/sys_procdesc.c
+++ b/sys/kern/sys_procdesc.c
@@ -241,6 +241,17 @@ procdesc_new(struct proc *p, int flags)
p->p_procdesc = pd;
}
+static int
+pdtofdflags(int flags)
+{
+ int fflags;
+
+ fflags = 0;
+ if (flags & PD_CLOEXEC)
+ fflags |= O_CLOEXEC;
+ return (fflags);
+}
+
/*
* Create a new process decriptor for the process that refers to it.
*/
@@ -248,13 +259,7 @@ int
procdesc_falloc(struct thread *td, struct file **resultfp, int *resultfd,
int flags, struct filecaps *fcaps)
{
- int fflags;
-
- fflags = 0;
- if (flags & PD_CLOEXEC)
- fflags = O_CLOEXEC;
-
- return (falloc_caps(td, resultfp, resultfd, fflags, fcaps));
+ return (falloc_caps(td, resultfp, resultfd, pdtofdflags(flags), fcaps));
}
/*