Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_loginclass.c
Show First 20 Lines • Show All 223 Lines • ▼ Show 20 Lines | sys_setloginclass(struct thread *td, struct setloginclass_args *uap) | ||||
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); | proc_set_cred(p, newcred); | ||||
FOREACH_THREAD_IN_PROC(p, td) { | |||||
thread_lock(td); | |||||
if (TD_IS_SUGID(td)) { | |||||
loginclass_free(td->td_ucred->cr_loginclass); | |||||
loginclass_hold(newlc); | |||||
td->td_ucred->cr_loginclass = newlc; | |||||
} | |||||
thread_unlock(td); | |||||
} | |||||
#ifdef RACCT | #ifdef RACCT | ||||
racct_proc_ucred_changed(p, oldcred, newcred); | racct_proc_ucred_changed(p, oldcred, newcred); | ||||
crhold(newcred); | crhold(newcred); | ||||
#endif | #endif | ||||
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); | ||||
Show All 23 Lines |