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

Function fdclose

freebsd/kern/kern_descrip.c:2757–2769  ·  view source on GitHub ↗

* If a specific file object occupies a specific file descriptor, close the * file descriptor entry and drop a reference on the file object. This is a * convenience function to handle a subsequent error in a function that calls * falloc() that handles the race that another thread might have closed the * file descriptor out from under the thread creating the file object. */

Source from the content-addressed store, hash-verified

2755 * file descriptor out from under the thread creating the file object.
2756 */
2757void
2758fdclose(struct thread *td, struct file *fp, int idx)
2759{
2760 struct filedesc *fdp = td->td_proc->p_fd;
2761
2762 FILEDESC_XLOCK(fdp);
2763 if (fdp->fd_ofiles[idx].fde_file == fp) {
2764 fdfree(fdp, idx);
2765 FILEDESC_XUNLOCK(fdp);
2766 fdrop(fp, td);
2767 } else
2768 FILEDESC_XUNLOCK(fdp);
2769}
2770
2771/*
2772 * Close any files on exec?

Callers 12

sys_sctp_peeloffFunction · 0.85
sys_posix_openptFunction · 0.85
fork1Function · 0.85
kern_socketFunction · 0.85
accept1Function · 0.85
kern_accept4Function · 0.85
kern_socketpairFunction · 0.85
m_dispose_extcontrolmFunction · 0.85
kern_kmq_openFunction · 0.85
ksem_createFunction · 0.85
kern_pipeFunction · 0.85
kern_shm_open2Function · 0.85

Calls 1

fdfreeFunction · 0.85

Tested by

no test coverage detected