diff options
| author | Konstantin Belousov <kib@FreeBSD.org> | 2026-05-20 02:03:32 +0000 |
|---|---|---|
| committer | Konstantin Belousov <kib@FreeBSD.org> | 2026-07-07 01:23:25 +0000 |
| commit | 974770199877ae7aa912b6dced909429c52dea93 (patch) | |
| tree | 9bb169856ed4f03f30c497b041623573058146cd | |
| parent | 599d021224f2af3fc0befdbd6b804a328dd556f9 (diff) | |
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
| -rw-r--r-- | sys/kern/sys_procdesc.c | 19 |
1 files 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)); } /* |
