MCPcopy Create free account
hub / github.com/F-Stack/f-stack / _finstall

Function _finstall

freebsd/kern/kern_descrip.c:2058–2082  ·  view source on GitHub ↗

* Install a file in a file descriptor table. */

Source from the content-addressed store, hash-verified

2056 * Install a file in a file descriptor table.
2057 */
2058void
2059_finstall(struct filedesc *fdp, struct file *fp, int fd, int flags,
2060 struct filecaps *fcaps)
2061{
2062 struct filedescent *fde;
2063
2064 MPASS(fp != NULL);
2065 if (fcaps != NULL)
2066 filecaps_validate(fcaps, __func__);
2067 FILEDESC_XLOCK_ASSERT(fdp);
2068
2069 fde = &fdp->fd_ofiles[fd];
2070#ifdef CAPABILITIES
2071 seqc_write_begin(&fde->fde_seqc);
2072#endif
2073 fde->fde_file = fp;
2074 fde->fde_flags = (flags & O_CLOEXEC) != 0 ? UF_EXCLOSE : 0;
2075 if (fcaps != NULL)
2076 filecaps_move(fcaps, &fde->fde_caps);
2077 else
2078 filecaps_fill(&fde->fde_caps);
2079#ifdef CAPABILITIES
2080 seqc_write_end(&fde->fde_seqc);
2081#endif
2082}
2083
2084int
2085finstall_refed(struct thread *td, struct file *fp, int *fd, int flags,

Callers 2

finstall_refedFunction · 0.85
unp_externalizeFunction · 0.85

Calls 5

filecaps_validateFunction · 0.85
seqc_write_beginFunction · 0.85
filecaps_moveFunction · 0.85
filecaps_fillFunction · 0.85
seqc_write_endFunction · 0.85

Tested by

no test coverage detected