Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_loginclass.c
| Show First 20 Lines • Show All 216 Lines • ▼ Show 20 Lines | sys_setloginclass(struct thread *td, struct setloginclass_args *uap) | ||||
| newlc = loginclass_find(lcname); | newlc = loginclass_find(lcname); | ||||
| if (newlc == NULL) | if (newlc == NULL) | ||||
| return (EINVAL); | return (EINVAL); | ||||
| newcred = crget(); | newcred = crget(); | ||||
| PROC_LOCK(p); | PROC_LOCK(p); | ||||
| oldcred = crcopysafe(p, newcred); | oldcred = crcopysafe(p, newcred); | ||||
| newcred->cr_loginclass = newlc; | newcred->cr_loginclass = newlc; | ||||
| proc_set_cred(p, newcred); | |||||
| #ifdef RACCT | #ifdef RACCT | ||||
| racct_proc_ucred_changed(p, oldcred, newcred); | racct_proc_ucred_changed(p, oldcred, newcred); | ||||
| #endif | #endif | ||||
| #ifdef RCTL | #ifdef RCTL | ||||
| crhold(newcred); | crhold(newcred); | ||||
| #endif | #endif | ||||
| /* | |||||
| * Takes over 'newcred''s reference, so 'newcred' must not be used | |||||
| * besides this point except on RCTL where we took an additional | |||||
| * reference above. | |||||
| */ | |||||
| proc_set_cred(p, newcred); | |||||
| PROC_UNLOCK(p); | PROC_UNLOCK(p); | ||||
| #ifdef RCTL | #ifdef RCTL | ||||
| rctl_proc_ucred_changed(p, newcred); | rctl_proc_ucred_changed(p, newcred); | ||||
| crfree(newcred); | crfree(newcred); | ||||
| #endif | #endif | ||||
| loginclass_free(oldcred->cr_loginclass); | loginclass_free(oldcred->cr_loginclass); | ||||
| crfree(oldcred); | crfree(oldcred); | ||||
| Show All 19 Lines | |||||