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

Function crunuse

freebsd/kern/kern_prot.c:1865–1889  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1863}
1864
1865static struct ucred *
1866crunuse(struct thread *td)
1867{
1868 struct ucred *cr, *crold;
1869
1870 MPASS(td->td_realucred == td->td_ucred);
1871 cr = td->td_realucred;
1872 mtx_lock(&cr->cr_mtx);
1873 cr->cr_ref += td->td_ucredref;
1874 td->td_ucredref = 0;
1875 KASSERT(cr->cr_users > 0, ("%s: users %d not > 0 on cred %p",
1876 __func__, cr->cr_users, cr));
1877 cr->cr_users--;
1878 if (cr->cr_users == 0) {
1879 KASSERT(cr->cr_ref > 0, ("%s: ref %d not > 0 on cred %p",
1880 __func__, cr->cr_ref, cr));
1881 crold = cr;
1882 } else {
1883 cr->cr_ref--;
1884 crold = NULL;
1885 }
1886 mtx_unlock(&cr->cr_mtx);
1887 td->td_realucred = NULL;
1888 return (crold);
1889}
1890
1891static void
1892crunusebatch(struct ucred *cr, int users, int ref)

Callers 2

crcowfreeFunction · 0.85
crcowsyncFunction · 0.85

Calls 2

mtx_lockFunction · 0.70
mtx_unlockFunction · 0.70

Tested by

no test coverage detected