Deleted Added
full compact
vm_unix.c (116226) vm_unix.c (118771)
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.

--- 31 unchanged lines hidden (view full) ---

40 * @(#)vm_unix.c 8.1 (Berkeley) 6/11/93
41 */
42
43/*
44 * Traditional sbrk/grow interface to VM
45 */
46
47#include <sys/cdefs.h>
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.

--- 31 unchanged lines hidden (view full) ---

40 * @(#)vm_unix.c 8.1 (Berkeley) 6/11/93
41 */
42
43/*
44 * Traditional sbrk/grow interface to VM
45 */
46
47#include <sys/cdefs.h>
48__FBSDID("$FreeBSD: head/sys/vm/vm_unix.c 116226 2003-06-11 23:50:51Z obrien $");
48__FBSDID("$FreeBSD: head/sys/vm/vm_unix.c 118771 2003-08-11 07:14:08Z bms $");
49
50#include <sys/param.h>
51#include <sys/lock.h>
52#include <sys/mutex.h>
53#include <sys/proc.h>
54#include <sys/resourcevar.h>
55#include <sys/sysproto.h>
56#include <sys/systm.h>

--- 17 unchanged lines hidden (view full) ---

74obreak(td, uap)
75 struct thread *td;
76 struct obreak_args *uap;
77{
78 struct vmspace *vm = td->td_proc->p_vmspace;
79 vm_offset_t new, old, base;
80 int rv;
81 int error = 0;
49
50#include <sys/param.h>
51#include <sys/lock.h>
52#include <sys/mutex.h>
53#include <sys/proc.h>
54#include <sys/resourcevar.h>
55#include <sys/sysproto.h>
56#include <sys/systm.h>

--- 17 unchanged lines hidden (view full) ---

74obreak(td, uap)
75 struct thread *td;
76 struct obreak_args *uap;
77{
78 struct vmspace *vm = td->td_proc->p_vmspace;
79 vm_offset_t new, old, base;
80 int rv;
81 int error = 0;
82 boolean_t do_map_wirefuture;
82
83
84 do_map_wirefuture = FALSE;
83 new = round_page((vm_offset_t)uap->nsize);
84 vm_map_lock(&vm->vm_map);
85
86 base = round_page((vm_offset_t) vm->vm_daddr);
87 old = base + ctob(vm->vm_dsize);
88 if (new > base) {
89 /*
90 * Check the resource limit, but allow a process to reduce

--- 25 unchanged lines hidden (view full) ---

116 }
117 rv = vm_map_insert(&vm->vm_map, NULL, 0, old, new,
118 VM_PROT_ALL, VM_PROT_ALL, 0);
119 if (rv != KERN_SUCCESS) {
120 error = ENOMEM;
121 goto done;
122 }
123 vm->vm_dsize += btoc(new - old);
85 new = round_page((vm_offset_t)uap->nsize);
86 vm_map_lock(&vm->vm_map);
87
88 base = round_page((vm_offset_t) vm->vm_daddr);
89 old = base + ctob(vm->vm_dsize);
90 if (new > base) {
91 /*
92 * Check the resource limit, but allow a process to reduce

--- 25 unchanged lines hidden (view full) ---

118 }
119 rv = vm_map_insert(&vm->vm_map, NULL, 0, old, new,
120 VM_PROT_ALL, VM_PROT_ALL, 0);
121 if (rv != KERN_SUCCESS) {
122 error = ENOMEM;
123 goto done;
124 }
125 vm->vm_dsize += btoc(new - old);
126 /*
127 * Handle the MAP_WIREFUTURE case for legacy applications,
128 * by marking the newly mapped range of pages as wired.
129 * We are not required to perform a corresponding
130 * vm_map_unwire() before vm_map_delete() below, as
131 * it will forcibly unwire the pages in the range.
132 *
133 * XXX If the pages cannot be wired, no error is returned.
134 */
135 if ((vm->vm_map.flags & MAP_WIREFUTURE) == MAP_WIREFUTURE) {
136 if (bootverbose)
137 printf("obreak: MAP_WIREFUTURE set\n");
138 do_map_wirefuture = TRUE;
139 }
124 } else if (new < old) {
125 rv = vm_map_delete(&vm->vm_map, new, old);
126 if (rv != KERN_SUCCESS) {
127 error = ENOMEM;
128 goto done;
129 }
130 vm->vm_dsize -= btoc(old - new);
131 }
132done:
133 vm_map_unlock(&vm->vm_map);
140 } else if (new < old) {
141 rv = vm_map_delete(&vm->vm_map, new, old);
142 if (rv != KERN_SUCCESS) {
143 error = ENOMEM;
144 goto done;
145 }
146 vm->vm_dsize -= btoc(old - new);
147 }
148done:
149 vm_map_unlock(&vm->vm_map);
150
151 if (do_map_wirefuture)
152 (void) vm_map_wire(&vm->vm_map, old, new,
153 VM_MAP_WIRE_USER|VM_MAP_WIRE_NOHOLES);
154
134 return (error);
135}
136
137#ifndef _SYS_SYSPROTO_H_
138struct ovadvise_args {
139 int anom;
140};
141#endif

--- 14 unchanged lines hidden ---
155 return (error);
156}
157
158#ifndef _SYS_SYSPROTO_H_
159struct ovadvise_args {
160 int anom;
161};
162#endif

--- 14 unchanged lines hidden ---