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

Function crfree

freebsd/kern/kern_prot.c:2033–2060  ·  view source on GitHub ↗

* Free a cred structure. Throws away space when ref count gets to 0. */

Source from the content-addressed store, hash-verified

2031 * Free a cred structure. Throws away space when ref count gets to 0.
2032 */
2033void
2034crfree(struct ucred *cr)
2035{
2036 struct thread *td;
2037
2038 td = curthread;
2039 if (__predict_true(td->td_realucred == cr)) {
2040 KASSERT(cr->cr_users > 0, ("%s: users %d not > 0 on cred %p",
2041 __func__, cr->cr_users, cr));
2042 td->td_ucredref--;
2043 return;
2044 }
2045 mtx_lock(&cr->cr_mtx);
2046 KASSERT(cr->cr_users >= 0, ("%s: users %d not >= 0 on cred %p",
2047 __func__, cr->cr_users, cr));
2048 cr->cr_ref--;
2049 if (cr->cr_users > 0) {
2050 mtx_unlock(&cr->cr_mtx);
2051 return;
2052 }
2053 KASSERT(cr->cr_ref >= 0, ("%s: ref %d not >= 0 on cred %p",
2054 __func__, cr->cr_ref, cr));
2055 if (cr->cr_ref > 0) {
2056 mtx_unlock(&cr->cr_mtx);
2057 return;
2058 }
2059 crfree_final(cr);
2060}
2061
2062static void
2063crfree_final(struct ucred *cr)

Callers 15

shm_deallocate_segmentFunction · 0.70
ptsdrv_freeFunction · 0.70
acct_disableFunction · 0.70
sys_cap_enterFunction · 0.70
do_jail_attachFunction · 0.70
prison_racct_modifyFunction · 0.70
umtx_shm_free_regFunction · 0.70
sys_setloginclassFunction · 0.70
sem_removeFunction · 0.70
buf_freeFunction · 0.70
vfs_bio_getpagesFunction · 0.70
kqueue_closeFunction · 0.70

Calls 3

crfree_finalFunction · 0.85
mtx_lockFunction · 0.70
mtx_unlockFunction · 0.70

Tested by

no test coverage detected