diff options
| author | 2001-11-28 19:28:14 +0000 | |
|---|---|---|
| committer | 2001-11-28 19:28:14 +0000 | |
| commit | 5905e0cd3b4b382de87f90db0f8c6b3008cc771b (patch) | |
| tree | 7a0877e8763f6a9fa10f1b215de512cfe08b9780 /sys/uvm/uvm_unix.c | |
| parent | somebody forgot something (diff) | |
| download | wireguard-openbsd-5905e0cd3b4b382de87f90db0f8c6b3008cc771b.tar.xz wireguard-openbsd-5905e0cd3b4b382de87f90db0f8c6b3008cc771b.zip | |
Sync in more uvm from NetBSD. Mostly just cosmetic stuff.
Contains also support for page coloring.
Diffstat (limited to 'sys/uvm/uvm_unix.c')
| -rw-r--r-- | sys/uvm/uvm_unix.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/sys/uvm/uvm_unix.c b/sys/uvm/uvm_unix.c index a2fde83db35..a6debf6ff8d 100644 --- a/sys/uvm/uvm_unix.c +++ b/sys/uvm/uvm_unix.c @@ -1,9 +1,9 @@ -/* $OpenBSD: uvm_unix.c,v 1.18 2001/11/28 13:47:40 art Exp $ */ -/* $NetBSD: uvm_unix.c,v 1.20 2001/03/19 02:25:33 simonb Exp $ */ +/* $OpenBSD: uvm_unix.c,v 1.19 2001/11/28 19:28:15 art Exp $ */ +/* $NetBSD: uvm_unix.c,v 1.24 2001/06/06 21:28:51 mrg Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. - * Copyright (c) 1991, 1993 The Regents of the University of California. + * Copyright (c) 1991, 1993 The Regents of the University of California. * Copyright (c) 1988 University of Utah. * * All rights reserved. @@ -23,7 +23,7 @@ * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Charles D. Cranor, - * Washington University, the University of California, Berkeley and + * Washington University, the University of California, Berkeley and * its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software @@ -77,38 +77,36 @@ sys_obreak(p, v, retval) } */ *uap = v; struct vmspace *vm = p->p_vmspace; vaddr_t new, old; - ssize_t diff; int error; old = (vaddr_t)vm->vm_daddr; new = round_page((vaddr_t)SCARG(uap, nsize)); - if ((new - old) > p->p_rlimit[RLIMIT_DATA].rlim_cur) + if ((new - old) > p->p_rlimit[RLIMIT_DATA].rlim_cur && new > old) return (ENOMEM); old = round_page(old + ptoa(vm->vm_dsize)); - diff = new - old; - if (diff == 0) + if (new == old) return (0); /* * grow or shrink? */ - if (diff > 0) { - error = uvm_map(&vm->vm_map, &old, diff, NULL, + if (new > old) { + error = uvm_map(&vm->vm_map, &old, new - old, NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_COPY, UVM_ADV_NORMAL, UVM_FLAG_AMAPPAD|UVM_FLAG_FIXED| UVM_FLAG_OVERLAY|UVM_FLAG_COPYONW)); if (error) { uprintf("sbrk: grow %ld failed, error = %d\n", - (long)diff, error); + new - old, error); return error; } - vm->vm_dsize += atop(diff); + vm->vm_dsize += atop(new - old); } else { - uvm_deallocate(&vm->vm_map, new, -diff); - vm->vm_dsize -= atop(-diff); + uvm_deallocate(&vm->vm_map, new, old - new); + vm->vm_dsize -= atop(old - new); } return (0); @@ -192,8 +190,8 @@ uvm_coredump(p, vp, cred, chdr) struct core *chdr; { struct vmspace *vm = p->p_vmspace; - vm_map_t map = &vm->vm_map; - vm_map_entry_t entry; + struct vm_map *map = &vm->vm_map; + struct vm_map_entry *entry; vaddr_t start, end, maxstack; struct coreseg cseg; off_t offset; |
