o Remove an incorrect cast from obreak(). This cast would,

for example, break an sbrk(>=4GB) on 64-bit architectures
   even if the resource limit allowed it.
 o Correct an off-by-one error.
 o Correct a spelling error in a comment.
 o Reorder an && expression so that the commonly FALSE expression
   comes first.

Submitted by:	bde (bullets 1 and 2)
This commit is contained in:
Alan Cox 2002-06-20 18:38:28 +00:00
parent 69be5db96f
commit 3d66f1384e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=98498

View File

@ -85,15 +85,15 @@ obreak(td, uap)
old = base + ctob(vm->vm_dsize);
if (new > base) {
/*
* We check resource limits here, but alow processes to
* reduce their usage, even if they remain over the limit.
* Check the resource limit, but allow a process to reduce
* its usage, even if it remains over the limit.
*/
if (new > old &&
(new - base) > (unsigned) td->td_proc->p_rlimit[RLIMIT_DATA].rlim_cur) {
if (new - base > td->td_proc->p_rlimit[RLIMIT_DATA].rlim_cur &&
new > old) {
error = ENOMEM;
goto done;
}
if (new >= VM_MAXUSER_ADDRESS) {
if (new > VM_MAXUSER_ADDRESS) {
error = ENOMEM;
goto done;
}