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

Function _fdrop

freebsd/kern/kern_descrip.c:3595–3613  ·  view source on GitHub ↗

* Handle the last reference to a file being closed. * * Without the noinline attribute clang keeps inlining the func thorough this * file when fdrop is used. */

Source from the content-addressed store, hash-verified

3593 * file when fdrop is used.
3594 */
3595int __noinline
3596_fdrop(struct file *fp, struct thread *td)
3597{
3598 int error;
3599#ifdef INVARIANTS
3600 int count;
3601
3602 count = refcount_load(&fp->f_count);
3603 if (count != 0)
3604 panic("fdrop: fp %p count %d", fp, count);
3605#endif
3606 error = fo_close(fp, td);
3607 atomic_subtract_int(&openfiles, 1);
3608 crfree(fp->f_cred);
3609 free(fp->f_advice, M_FADVISE);
3610 uma_zfree(file_zone, fp);
3611
3612 return (error);
3613}
3614
3615/*
3616 * Apply an advisory lock on a file descriptor.

Callers 1

falloc_abortFunction · 0.85

Calls 6

refcount_loadFunction · 0.85
fo_closeFunction · 0.85
panicFunction · 0.70
crfreeFunction · 0.70
freeFunction · 0.70
uma_zfreeFunction · 0.50

Tested by

no test coverage detected