Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_resource.c
Show First 20 Lines • Show All 666 Lines • ▼ Show 20 Lines | kern_proc_setrlimit(struct thread *td, struct proc *p, u_int which, | ||||
/* | /* | ||||
* Preserve historical bugs by treating negative limits as unsigned. | * Preserve historical bugs by treating negative limits as unsigned. | ||||
*/ | */ | ||||
if (limp->rlim_cur < 0) | if (limp->rlim_cur < 0) | ||||
limp->rlim_cur = RLIM_INFINITY; | limp->rlim_cur = RLIM_INFINITY; | ||||
if (limp->rlim_max < 0) | if (limp->rlim_max < 0) | ||||
limp->rlim_max = RLIM_INFINITY; | limp->rlim_max = RLIM_INFINITY; | ||||
if (which == RLIMIT_STACK && limp->rlim_cur != RLIM_INFINITY) | |||||
limp->rlim_cur += p->p_vmspace->vm_stkgap; | |||||
oldssiz.rlim_cur = 0; | oldssiz.rlim_cur = 0; | ||||
newlim = lim_alloc(); | newlim = lim_alloc(); | ||||
PROC_LOCK(p); | PROC_LOCK(p); | ||||
oldlim = p->p_limit; | oldlim = p->p_limit; | ||||
alimp = &oldlim->pl_rlimit[which]; | alimp = &oldlim->pl_rlimit[which]; | ||||
if (limp->rlim_cur > alimp->rlim_max || | if (limp->rlim_cur > alimp->rlim_max || | ||||
limp->rlim_max > alimp->rlim_max) | limp->rlim_max > alimp->rlim_max) | ||||
if ((error = priv_check(td, PRIV_PROC_SETRLIMIT))) { | if ((error = priv_check(td, PRIV_PROC_SETRLIMIT))) { | ||||
▲ Show 20 Lines • Show All 880 Lines • Show Last 20 Lines |