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

Function crhold

freebsd/kern/kern_prot.c:2012–2028  ·  view source on GitHub ↗

* Claim another reference to a ucred structure. */

Source from the content-addressed store, hash-verified

2010 * Claim another reference to a ucred structure.
2011 */
2012struct ucred *
2013crhold(struct ucred *cr)
2014{
2015 struct thread *td;
2016
2017 td = curthread;
2018 if (__predict_true(td->td_realucred == cr)) {
2019 KASSERT(cr->cr_users > 0, ("%s: users %d not > 0 on cred %p",
2020 __func__, cr->cr_users, cr));
2021 td->td_ucredref++;
2022 return (cr);
2023 }
2024 mtx_lock(&cr->cr_mtx);
2025 cr->cr_ref++;
2026 mtx_unlock(&cr->cr_mtx);
2027 return (cr);
2028}
2029
2030/*
2031 * Free a cred structure. Throws away space when ref count gets to 0.

Callers 15

shmget_allocate_segmentFunction · 0.70
pts_allocFunction · 0.70
pts_alloc_externalFunction · 0.70
sys_acctFunction · 0.70
do_jail_attachFunction · 0.70
prison_racct_modifyFunction · 0.70
umtx_shm_create_regFunction · 0.70
sys_setloginclassFunction · 0.70
sys_semgetFunction · 0.70
breadaFunction · 0.70
breadn_flagsFunction · 0.70
kern_kqueueFunction · 0.70

Calls 2

mtx_lockFunction · 0.70
mtx_unlockFunction · 0.70

Tested by

no test coverage detected