summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_unix.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/vm/vm_unix.c')
-rw-r--r--sys/vm/vm_unix.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/vm/vm_unix.c b/sys/vm/vm_unix.c
index 877609f..6313cc1 100644
--- a/sys/vm/vm_unix.c
+++ b/sys/vm/vm_unix.c
@@ -77,10 +77,16 @@ obreak(td, uap)
{
struct vmspace *vm = td->td_proc->p_vmspace;
vm_offset_t new, old, base;
+ rlim_t datalim, vmemlim;
int rv;
int error = 0;
boolean_t do_map_wirefuture;
+ PROC_LOCK(td->td_proc);
+ datalim = lim_cur(td->td_proc, RLIMIT_DATA);
+ vmemlim = lim_cur(td->td_proc, RLIMIT_VMEM);
+ PROC_UNLOCK(td->td_proc);
+
do_map_wirefuture = FALSE;
new = round_page((vm_offset_t)uap->nsize);
vm_map_lock(&vm->vm_map);
@@ -92,8 +98,7 @@ obreak(td, uap)
* Check the resource limit, but allow a process to reduce
* its usage, even if it remains over the limit.
*/
- if (new - base > td->td_proc->p_rlimit[RLIMIT_DATA].rlim_cur &&
- new > old) {
+ if (new - base > datalim && new > old) {
error = ENOMEM;
goto done;
}
@@ -111,8 +116,7 @@ obreak(td, uap)
goto done;
}
if (new > old) {
- if (vm->vm_map.size + (new - old) >
- td->td_proc->p_rlimit[RLIMIT_VMEM].rlim_cur) {
+ if (vm->vm_map.size + (new - old) > vmemlim) {
error = ENOMEM;
goto done;
}
OpenPOWER on IntegriCloud