* Allocate a zeroed cred structure. */
| 1987 | * Allocate a zeroed cred structure. |
| 1988 | */ |
| 1989 | struct ucred * |
| 1990 | crget(void) |
| 1991 | { |
| 1992 | struct ucred *cr; |
| 1993 | |
| 1994 | cr = malloc(sizeof(*cr), M_CRED, M_WAITOK | M_ZERO); |
| 1995 | mtx_init(&cr->cr_mtx, "cred", NULL, MTX_DEF); |
| 1996 | cr->cr_ref = 1; |
| 1997 | #ifdef AUDIT |
| 1998 | audit_cred_init(cr); |
| 1999 | #endif |
| 2000 | #ifdef MAC |
| 2001 | mac_cred_init(cr); |
| 2002 | #endif |
| 2003 | cr->cr_groups = cr->cr_smallgroups; |
| 2004 | cr->cr_agroups = |
| 2005 | sizeof(cr->cr_smallgroups) / sizeof(cr->cr_smallgroups[0]); |
| 2006 | return (cr); |
| 2007 | } |
| 2008 | |
| 2009 | /* |
| 2010 | * Claim another reference to a ucred structure. |
no test coverage detected