vm_unix.c (bb10bb497843aadbb454110fe2c8d645976ddf33) | vm_unix.c (190609dd48b42678141934248d836da0c67471b1) |
---|---|
1/* 2 * Copyright (c) 1988 University of Utah. 3 * Copyright (c) 1991, 1993 4 * The Regents of the University of California. All rights reserved. 5 * 6 * This code is derived from software contributed to Berkeley by 7 * the Systems Programming Group of the University of Utah Computer 8 * Science Department. --- 30 unchanged lines hidden (view full) --- 39 * 40 * @(#)vm_unix.c 8.1 (Berkeley) 6/11/93 41 * $FreeBSD$ 42 */ 43 44/* 45 * Traditional sbrk/grow interface to VM 46 */ | 1/* 2 * Copyright (c) 1988 University of Utah. 3 * Copyright (c) 1991, 1993 4 * The Regents of the University of California. All rights reserved. 5 * 6 * This code is derived from software contributed to Berkeley by 7 * the Systems Programming Group of the University of Utah Computer 8 * Science Department. --- 30 unchanged lines hidden (view full) --- 39 * 40 * @(#)vm_unix.c 8.1 (Berkeley) 6/11/93 41 * $FreeBSD$ 42 */ 43 44/* 45 * Traditional sbrk/grow interface to VM 46 */ |
47#include "opt_bleed.h" 48 |
|
47#include <sys/param.h> 48#include <sys/lock.h> 49#include <sys/mutex.h> 50#include <sys/proc.h> 51#include <sys/resourcevar.h> 52#include <sys/sysproto.h> 53#include <sys/systm.h> 54 --- 39 unchanged lines hidden (view full) --- 94 */ 95 return EINVAL; 96 } 97 98 if (new > old) { 99 vm_size_t diff; 100 101 diff = new - old; | 49#include <sys/param.h> 50#include <sys/lock.h> 51#include <sys/mutex.h> 52#include <sys/proc.h> 53#include <sys/resourcevar.h> 54#include <sys/sysproto.h> 55#include <sys/systm.h> 56 --- 39 unchanged lines hidden (view full) --- 96 */ 97 return EINVAL; 98 } 99 100 if (new > old) { 101 vm_size_t diff; 102 103 diff = new - old; |
104#ifndef BLEED 105 mtx_lock(&Giant); 106#endif |
|
102 mtx_lock(&vm_mtx); 103 rv = vm_map_find(&vm->vm_map, NULL, 0, &old, diff, FALSE, 104 VM_PROT_ALL, VM_PROT_ALL, 0); 105 if (rv != KERN_SUCCESS) { 106 mtx_unlock(&vm_mtx); 107 return (ENOMEM); 108 } 109 vm->vm_dsize += btoc(diff); 110 mtx_unlock(&vm_mtx); | 107 mtx_lock(&vm_mtx); 108 rv = vm_map_find(&vm->vm_map, NULL, 0, &old, diff, FALSE, 109 VM_PROT_ALL, VM_PROT_ALL, 0); 110 if (rv != KERN_SUCCESS) { 111 mtx_unlock(&vm_mtx); 112 return (ENOMEM); 113 } 114 vm->vm_dsize += btoc(diff); 115 mtx_unlock(&vm_mtx); |
116#ifndef BLEED 117 mtx_unlock(&Giant); 118#endif |
|
111 } else if (new < old) { 112 mtx_lock(&Giant); 113 mtx_lock(&vm_mtx); 114 rv = vm_map_remove(&vm->vm_map, new, old); 115 if (rv != KERN_SUCCESS) { 116 mtx_unlock(&vm_mtx); 117 mtx_unlock(&Giant); 118 return (ENOMEM); --- 23 unchanged lines hidden --- | 119 } else if (new < old) { 120 mtx_lock(&Giant); 121 mtx_lock(&vm_mtx); 122 rv = vm_map_remove(&vm->vm_map, new, old); 123 if (rv != KERN_SUCCESS) { 124 mtx_unlock(&vm_mtx); 125 mtx_unlock(&Giant); 126 return (ENOMEM); --- 23 unchanged lines hidden --- |