kern_prot.c (873fbcd776b5c6e0b7caa1f1f87cc91a12d339db) kern_prot.c (faef53711b12833053c3a430f78b4aa03684cf22)
1/*-
2 * Copyright (c) 1982, 1986, 1989, 1990, 1991, 1993
3 * The Regents of the University of California.
4 * (c) UNIX System Laboratories, Inc.
5 * Copyright (c) 2000-2001 Robert N. M. Watson.
6 * All rights reserved.
7 *
8 * All or some portions of this file are derived from material licensed

--- 1749 unchanged lines hidden (view full) ---

1758 */
1759struct ucred *
1760crget(void)
1761{
1762 register struct ucred *cr;
1763
1764 MALLOC(cr, struct ucred *, sizeof(*cr), M_CRED, M_WAITOK | M_ZERO);
1765 refcount_init(&cr->cr_ref, 1);
1/*-
2 * Copyright (c) 1982, 1986, 1989, 1990, 1991, 1993
3 * The Regents of the University of California.
4 * (c) UNIX System Laboratories, Inc.
5 * Copyright (c) 2000-2001 Robert N. M. Watson.
6 * All rights reserved.
7 *
8 * All or some portions of this file are derived from material licensed

--- 1749 unchanged lines hidden (view full) ---

1758 */
1759struct ucred *
1760crget(void)
1761{
1762 register struct ucred *cr;
1763
1764 MALLOC(cr, struct ucred *, sizeof(*cr), M_CRED, M_WAITOK | M_ZERO);
1765 refcount_init(&cr->cr_ref, 1);
1766#ifdef AUDIT
1767 audit_cred_init(cr);
1768#endif
1766#ifdef MAC
1767 mac_init_cred(cr);
1768#endif
1769 return (cr);
1770}
1771
1772/*
1773 * Claim another reference to a ucred structure.

--- 25 unchanged lines hidden (view full) ---

1799 uifree(cr->cr_uidinfo);
1800 if (cr->cr_ruidinfo != NULL)
1801 uifree(cr->cr_ruidinfo);
1802 /*
1803 * Free a prison, if any.
1804 */
1805 if (jailed(cr))
1806 prison_free(cr->cr_prison);
1769#ifdef MAC
1770 mac_init_cred(cr);
1771#endif
1772 return (cr);
1773}
1774
1775/*
1776 * Claim another reference to a ucred structure.

--- 25 unchanged lines hidden (view full) ---

1802 uifree(cr->cr_uidinfo);
1803 if (cr->cr_ruidinfo != NULL)
1804 uifree(cr->cr_ruidinfo);
1805 /*
1806 * Free a prison, if any.
1807 */
1808 if (jailed(cr))
1809 prison_free(cr->cr_prison);
1810#ifdef AUDIT
1811 audit_cred_destroy(cr);
1812#endif
1807#ifdef MAC
1808 mac_destroy_cred(cr);
1809#endif
1810 FREE(cr, M_CRED);
1811 }
1812}
1813
1814/*

--- 16 unchanged lines hidden (view full) ---

1831 KASSERT(crshared(dest) == 0, ("crcopy of shared ucred"));
1832 bcopy(&src->cr_startcopy, &dest->cr_startcopy,
1833 (unsigned)((caddr_t)&src->cr_endcopy -
1834 (caddr_t)&src->cr_startcopy));
1835 uihold(dest->cr_uidinfo);
1836 uihold(dest->cr_ruidinfo);
1837 if (jailed(dest))
1838 prison_hold(dest->cr_prison);
1813#ifdef MAC
1814 mac_destroy_cred(cr);
1815#endif
1816 FREE(cr, M_CRED);
1817 }
1818}
1819
1820/*

--- 16 unchanged lines hidden (view full) ---

1837 KASSERT(crshared(dest) == 0, ("crcopy of shared ucred"));
1838 bcopy(&src->cr_startcopy, &dest->cr_startcopy,
1839 (unsigned)((caddr_t)&src->cr_endcopy -
1840 (caddr_t)&src->cr_startcopy));
1841 uihold(dest->cr_uidinfo);
1842 uihold(dest->cr_ruidinfo);
1843 if (jailed(dest))
1844 prison_hold(dest->cr_prison);
1845#ifdef AUDIT
1846 audit_cred_copy(src, dest);
1847#endif
1839#ifdef MAC
1840 mac_copy_cred(src, dest);
1841#endif
1842}
1843
1844/*
1845 * Dup cred struct to a new held one.
1846 */

--- 202 unchanged lines hidden ---
1848#ifdef MAC
1849 mac_copy_cred(src, dest);
1850#endif
1851}
1852
1853/*
1854 * Dup cred struct to a new held one.
1855 */

--- 202 unchanged lines hidden ---