diff options
| author | Alfred Perlstein <alfred@FreeBSD.org> | 2001-05-19 01:28:09 +0000 |
|---|---|---|
| committer | Alfred Perlstein <alfred@FreeBSD.org> | 2001-05-19 01:28:09 +0000 |
| commit | 2395531439bb140427dff4dfd6d67856f907c15e (patch) | |
| tree | 7d51c8cab74aeec829658414e052238902ea14a0 /sys/vm/vm_unix.c | |
| parent | 3620eb66f3ef16ff28810c74476f01e29c1562bf (diff) | |
Notes
Diffstat (limited to 'sys/vm/vm_unix.c')
| -rw-r--r-- | sys/vm/vm_unix.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/vm/vm_unix.c b/sys/vm/vm_unix.c index f9b24f84523d..48613062ee08 100644 --- a/sys/vm/vm_unix.c +++ b/sys/vm/vm_unix.c @@ -49,6 +49,9 @@ #include <sys/sysproto.h> #include <sys/proc.h> #include <sys/resourcevar.h> +#include <sys/lock.h> +#include <sys/mutex.h> +#include <sys/systm.h> #include <vm/vm.h> #include <vm/vm_param.h> @@ -93,6 +96,7 @@ obreak(p, uap) return EINVAL; } + mtx_lock(&vm_mtx); if (new > old) { vm_size_t diff; @@ -100,16 +104,19 @@ obreak(p, uap) rv = vm_map_find(&vm->vm_map, NULL, 0, &old, diff, FALSE, VM_PROT_ALL, VM_PROT_ALL, 0); if (rv != KERN_SUCCESS) { + mtx_unlock(&vm_mtx); return (ENOMEM); } vm->vm_dsize += btoc(diff); } else if (new < old) { rv = vm_map_remove(&vm->vm_map, new, old); if (rv != KERN_SUCCESS) { + mtx_unlock(&vm_mtx); return (ENOMEM); } vm->vm_dsize -= btoc(old - new); } + mtx_unlock(&vm_mtx); return (0); } |
