From: niklas Date: Sun, 3 Mar 1996 17:45:26 +0000 (+0000) Subject: From NetBSD: merge with 960217 X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=149bde5d4a62507b18db9fbd9472e49b1007dbdb;p=openbsd From NetBSD: merge with 960217 --- diff --git a/sys/vm/vm_conf.h b/sys/vm/vm_conf.h new file mode 100644 index 00000000000..790d99bd880 --- /dev/null +++ b/sys/vm/vm_conf.h @@ -0,0 +1,36 @@ +/* $OpenBSD: vm_conf.h,v 1.1 1996/03/03 17:45:26 niklas Exp $ */ +/* $NetBSD: vm_conf.h,v 1.1 1996/02/05 01:53:53 christos Exp $ */ + +/* + * Copyright (c) 1995 Christos Zoulas. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Christos Zoulas. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +bdev_decl(sw); +cdev_decl(sw); diff --git a/sys/vm/vm_extern.h b/sys/vm/vm_extern.h index 614a501d8c5..89731d5018b 100644 --- a/sys/vm/vm_extern.h +++ b/sys/vm/vm_extern.h @@ -1,4 +1,5 @@ -/* $NetBSD: vm_extern.h,v 1.15 1995/12/09 04:28:16 mycroft Exp $ */ +/* $OpenBSD: vm_extern.h,v 1.4 1996/03/03 17:45:26 niklas Exp $ */ +/* $NetBSD: vm_extern.h,v 1.19 1996/02/10 00:08:05 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -42,6 +43,7 @@ struct vmspace; struct vmtotal; struct mount; struct vnode; +struct core; #ifdef KGDB void chgkprot __P((caddr_t, int, int)); @@ -76,11 +78,12 @@ void kmem_free_wakeup __P((vm_map_t, vm_offset_t, vm_size_t)); void kmem_init __P((vm_offset_t, vm_offset_t)); vm_offset_t kmem_malloc __P((vm_map_t, vm_size_t, boolean_t)); vm_map_t kmem_suballoc __P((vm_map_t, vm_offset_t *, vm_offset_t *, - vm_size_t, boolean_t)); + vm_size_t, boolean_t)); void loadav __P((struct loadavg *)); void munmapfd __P((struct proc *, int)); int pager_cache __P((vm_object_t, boolean_t)); void sched __P((void)); +void scheduler __P((void)); int svm_allocate __P((struct proc *, void *, int *)); int svm_deallocate __P((struct proc *, void *, int *)); int svm_inherit __P((struct proc *, void *, int *)); @@ -94,10 +97,12 @@ void thread_block __P((void)); void thread_sleep __P((void *, simple_lock_t, boolean_t)); void thread_wakeup __P((void *)); int useracc __P((caddr_t, int, int)); -int vm_allocate __P((vm_map_t, - vm_offset_t *, vm_size_t, boolean_t)); +int vm_allocate __P((vm_map_t, vm_offset_t *, vm_size_t, + boolean_t)); int vm_allocate_with_pager __P((vm_map_t, vm_offset_t *, vm_size_t, boolean_t, vm_pager_t, vm_offset_t, boolean_t)); +int vm_coredump __P((struct proc *, struct vnode *, struct ucred *, + struct core *)); int vm_deallocate __P((vm_map_t, vm_offset_t, vm_size_t)); int vm_fault __P((vm_map_t, vm_offset_t, vm_prot_t, boolean_t)); void vm_fault_copy_entry __P((vm_map_t, @@ -127,5 +132,16 @@ void vnode_pager_setsize __P((struct vnode *, u_long)); void vnode_pager_umount __P((struct mount *)); boolean_t vnode_pager_uncache __P((struct vnode *)); void vslock __P((caddr_t, u_int)); -void vsunlock __P((caddr_t, u_int, int)); +void vsunlock __P((caddr_t, u_int)); + +/* Machine dependent portion */ +void vmapbuf __P((struct buf *, vm_size_t)); +void vunmapbuf __P((struct buf *, vm_size_t)); +void remrq __P((struct proc *)); +#ifdef __FORK_BRAINDAMAGE +int cpu_fork __P((struct proc *, struct proc *)); +#else +void cpu_fork __P((struct proc *, struct proc *)); +#endif + #endif diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index 4d9c8c5033e..033486cd54b 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -1,4 +1,5 @@ -/* $NetBSD: vm_fault.c,v 1.16 1994/09/07 20:25:07 mycroft Exp $ */ +/* $OpenBSD: vm_fault.c,v 1.2 1996/03/03 17:45:28 niklas Exp $ */ +/* $NetBSD: vm_fault.c,v 1.17 1996/02/05 01:53:55 christos Exp $ */ /* * Copyright (c) 1991, 1993 @@ -571,7 +572,7 @@ vm_fault(map, vaddr, fault_type, change_wiring) copy_offset = first_offset - copy_object->shadow_offset; copy_m = vm_page_lookup(copy_object, copy_offset); - if (page_exists = (copy_m != NULL)) { + if ((page_exists = (copy_m != NULL)) != 0) { if (copy_m->flags & PG_BUSY) { #ifdef DOTHREADS int wait_result; diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c index df95fb03fb2..cd7e32e2838 100644 --- a/sys/vm/vm_glue.c +++ b/sys/vm/vm_glue.c @@ -1,4 +1,5 @@ -/* $NetBSD: vm_glue.c,v 1.48 1995/12/09 04:28:19 mycroft Exp $ */ +/* $OpenBSD: vm_glue.c,v 1.9 1996/03/03 17:45:29 niklas Exp $ */ +/* $NetBSD: vm_glue.c,v 1.52 1996/02/12 21:51:59 christos Exp $ */ /* * Copyright (c) 1991, 1993 @@ -68,6 +69,9 @@ #include #include #include +#ifdef SYSVSHM +#include +#endif #include #include @@ -179,14 +183,10 @@ vslock(addr, len) } void -vsunlock(addr, len, dirtied) +vsunlock(addr, len) caddr_t addr; u_int len; - int dirtied; { -#ifdef lint - dirtied++; -#endif vm_map_pageable(&curproc->p_vmspace->vm_map, trunc_page(addr), round_page(addr+len), TRUE); } @@ -392,7 +392,7 @@ loop: } #ifdef DEBUG if (swapdebug & SDB_FOLLOW) - printf("scheduler: running, procp %x pri %d\n", pp, ppri); + printf("scheduler: running, procp %p pri %d\n", pp, ppri); #endif /* * Nothing to do, back to sleep @@ -410,7 +410,7 @@ loop: if (cnt.v_free_count > atop(USPACE)) { #ifdef DEBUG if (swapdebug & SDB_SWAPIN) - printf("swapin: pid %d(%s)@%x, pri %d free %d\n", + printf("swapin: pid %d(%s)@%p, pri %d free %d\n", p->p_pid, p->p_comm, p->p_addr, ppri, cnt.v_free_count); #endif @@ -502,7 +502,7 @@ swapout_threads() p = outp2; #ifdef DEBUG if (swapdebug & SDB_SWAPOUT) - printf("swapout_threads: no duds, try procp %x\n", p); + printf("swapout_threads: no duds, try procp %p\n", p); #endif if (p) swapout(p); @@ -518,7 +518,7 @@ swapout(p) #ifdef DEBUG if (swapdebug & SDB_SWAPOUT) - printf("swapout: pid %d(%s)@%x, stat %x pri %d free %d\n", + printf("swapout: pid %d(%s)@%p, stat %x pri %d free %d\n", p->p_pid, p->p_comm, p->p_addr, p->p_stat, p->p_slptime, cnt.v_free_count); #endif diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index 98be7181420..d8d952f4019 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -1,4 +1,5 @@ -/* $NetBSD: vm_map.c,v 1.21 1995/04/10 16:54:00 mycroft Exp $ */ +/* $OpenBSD: vm_map.c,v 1.2 1996/03/03 17:45:30 niklas Exp $ */ +/* $NetBSD: vm_map.c,v 1.23 1996/02/10 00:08:08 christos Exp $ */ /* * Copyright (c) 1991, 1993 @@ -288,15 +289,15 @@ vm_map_entry_create(map) isspecial = (map == kernel_map || map == kmem_map || map == mb_map || map == pager_map); - if (isspecial && map->entries_pageable || - !isspecial && !map->entries_pageable) + if ((isspecial && map->entries_pageable) || + (!isspecial && !map->entries_pageable)) panic("vm_map_entry_create: bogus map"); #endif if (map->entries_pageable) { MALLOC(entry, vm_map_entry_t, sizeof(struct vm_map_entry), M_VMMAPENT, M_WAITOK); } else { - if (entry = kentry_free) + if ((entry = kentry_free) != NULL) kentry_free = kentry_free->next; } if (entry == NULL) @@ -321,8 +322,8 @@ vm_map_entry_dispose(map, entry) isspecial = (map == kernel_map || map == kmem_map || map == mb_map || map == pager_map); - if (isspecial && map->entries_pageable || - !isspecial && !map->entries_pageable) + if ((isspecial && map->entries_pageable) || + (!isspecial && !map->entries_pageable)) panic("vm_map_entry_dispose: bogus map"); #endif if (map->entries_pageable) { @@ -1142,7 +1143,7 @@ vm_map_pageable(map, start, end, new_pageable) { register vm_map_entry_t entry; vm_map_entry_t start_entry; - register vm_offset_t failed; + register vm_offset_t failed = 0; int rv; vm_map_lock(map); @@ -2363,7 +2364,7 @@ vm_map_lookup(var_map, vaddr, fault_type, out_entry, * it for all possible accesses. */ - if (*wired = (entry->wired_count != 0)) + if ((*wired = (entry->wired_count != 0)) != 0) prot = fault_type = entry->protection; /* @@ -2371,7 +2372,7 @@ vm_map_lookup(var_map, vaddr, fault_type, out_entry, * it down. */ - if (su = !entry->is_a_map) { + if ((su = !entry->is_a_map) != 0) { share_map = map; share_offset = vaddr; } @@ -2581,8 +2582,6 @@ vm_map_print(map, full) register vm_map_t map; boolean_t full; { - extern void _vm_map_print(); - _vm_map_print(map, full, printf); } diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c index bcaf79423c3..100c65b88b8 100644 --- a/sys/vm/vm_meter.c +++ b/sys/vm/vm_meter.c @@ -1,4 +1,5 @@ -/* $NetBSD: vm_meter.c,v 1.17 1995/07/08 03:12:22 cgd Exp $ */ +/* $OpenBSD: vm_meter.c,v 1.2 1996/03/03 17:45:32 niklas Exp $ */ +/* $NetBSD: vm_meter.c,v 1.18 1996/02/05 01:53:59 christos Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -99,6 +100,7 @@ loadav(avg) /* * Attributes associated with virtual memory. */ +int vm_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) int *name; u_int namelen; diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c index 2e6ef423185..294d2ce84a4 100644 --- a/sys/vm/vm_mmap.c +++ b/sys/vm/vm_mmap.c @@ -1,4 +1,5 @@ -/* $NetBSD: vm_mmap.c,v 1.43 1995/12/05 22:54:42 pk Exp $ */ +/* $OpenBSD: vm_mmap.c,v 1.4 1996/03/03 17:45:32 niklas Exp $ */ +/* $NetBSD: vm_mmap.c,v 1.45 1996/02/10 00:08:10 christos Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -79,9 +80,11 @@ sys_sbrk(p, v, retval) void *v; register_t *retval; { +#if 0 struct sys_sbrk_args /* { syscallarg(int) incr; } */ *uap = v; +#endif /* Not yet implemented */ return (EOPNOTSUPP); @@ -94,90 +97,16 @@ sys_sstk(p, v, retval) void *v; register_t *retval; { +#if 0 struct sys_sstk_args /* { syscallarg(int) incr; } */ *uap = v; +#endif /* Not yet implemented */ return (EOPNOTSUPP); } -#if defined(COMPAT_43) || defined(COMPAT_SUNOS) || defined(COMPAT_OSF1) || \ - defined(COMPAT_FREEBSD) -/* ARGSUSED */ -int -compat_43_sys_getpagesize(p, v, retval) - struct proc *p; - void *v; - register_t *retval; -{ - - *retval = PAGE_SIZE; - return (0); -} -#endif /* COMPAT_43 || COMPAT_SUNOS || COMPAT_OSF1 || COMPAT_FREEBSD */ - -#if defined(COMPAT_43) || defined(COMPAT_FREEBSD) -int -compat_43_sys_mmap(p, v, retval) - struct proc *p; - void *v; - register_t *retval; -{ - register struct compat_43_sys_mmap_args /* { - syscallarg(caddr_t) addr; - syscallarg(size_t) len; - syscallarg(int) prot; - syscallarg(int) flags; - syscallarg(int) fd; - syscallarg(long) pos; - } */ *uap = v; - struct sys_mmap_args /* { - syscallarg(caddr_t) addr; - syscallarg(size_t) len; - syscallarg(int) prot; - syscallarg(int) flags; - syscallarg(int) fd; - syscallarg(long) pad; - syscallarg(off_t) pos; - } */ nargs; - static const char cvtbsdprot[8] = { - 0, - PROT_EXEC, - PROT_WRITE, - PROT_EXEC|PROT_WRITE, - PROT_READ, - PROT_EXEC|PROT_READ, - PROT_WRITE|PROT_READ, - PROT_EXEC|PROT_WRITE|PROT_READ, - }; -#define OMAP_ANON 0x0002 -#define OMAP_COPY 0x0020 -#define OMAP_SHARED 0x0010 -#define OMAP_FIXED 0x0100 -#define OMAP_INHERIT 0x0800 - - SCARG(&nargs, addr) = SCARG(uap, addr); - SCARG(&nargs, len) = SCARG(uap, len); - SCARG(&nargs, prot) = cvtbsdprot[SCARG(uap, prot)&0x7]; - SCARG(&nargs, flags) = 0; - if (SCARG(uap, flags) & OMAP_ANON) - SCARG(&nargs, flags) |= MAP_ANON; - if (SCARG(uap, flags) & OMAP_COPY) - SCARG(&nargs, flags) |= MAP_COPY; - if (SCARG(uap, flags) & OMAP_SHARED) - SCARG(&nargs, flags) |= MAP_SHARED; - else - SCARG(&nargs, flags) |= MAP_PRIVATE; - if (SCARG(uap, flags) & OMAP_FIXED) - SCARG(&nargs, flags) |= MAP_FIXED; - if (SCARG(uap, flags) & OMAP_INHERIT) - SCARG(&nargs, flags) |= MAP_INHERIT; - SCARG(&nargs, fd) = SCARG(uap, fd); - SCARG(&nargs, pos) = SCARG(uap, pos); - return (sys_mmap(p, &nargs, retval)); -} -#endif /* * Memory Map (mmap) system call. Note that the file offset @@ -210,6 +139,7 @@ sys_mmap(p, v, retval) vm_prot_t prot, maxprot; caddr_t handle; int fd, flags, error; + vm_offset_t vm_min_address = VM_MIN_ADDRESS; addr = (vm_offset_t) SCARG(uap, addr); size = (vm_size_t) SCARG(uap, len); @@ -253,9 +183,10 @@ sys_mmap(p, v, retval) if (addr & PAGE_MASK) return (EINVAL); /* Address range must be all in user VM space. */ - if (VM_MAXUSER_ADDRESS > 0 && addr + size > VM_MAXUSER_ADDRESS) + if (VM_MAXUSER_ADDRESS > 0 && + addr + size > VM_MAXUSER_ADDRESS) return (EINVAL); - if (VM_MIN_ADDRESS > 0 && addr < VM_MIN_ADDRESS) + if (vm_min_address > 0 && addr < vm_min_address) return (EINVAL); if (addr > addr + size) return (EINVAL); @@ -436,6 +367,8 @@ sys_munmap(p, v, retval) vm_offset_t addr; vm_size_t size, pageoff; vm_map_t map; + vm_offset_t vm_min_address = VM_MIN_ADDRESS; + addr = (vm_offset_t) SCARG(uap, addr); size = (vm_size_t) SCARG(uap, len); @@ -463,7 +396,7 @@ sys_munmap(p, v, retval) */ if (VM_MAXUSER_ADDRESS > 0 && addr + size > VM_MAXUSER_ADDRESS) return (EINVAL); - if (VM_MIN_ADDRESS > 0 && addr < VM_MIN_ADDRESS) + if (vm_min_address > 0 && addr < vm_min_address) return (EINVAL); if (addr > addr + size) return (EINVAL); @@ -589,11 +522,13 @@ sys_madvise(p, v, retval) void *v; register_t *retval; { +#if 0 struct sys_madvise_args /* { syscallarg(caddr_t) addr; syscallarg(size_t) len; syscallarg(int) behav; } */ *uap = v; +#endif /* Not yet implemented */ return (EOPNOTSUPP); @@ -606,11 +541,13 @@ sys_mincore(p, v, retval) void *v; register_t *retval; { +#if 0 struct sys_mincore_args /* { syscallarg(caddr_t) addr; syscallarg(size_t) len; syscallarg(char *) vec; } */ *uap = v; +#endif /* Not yet implemented */ return (EOPNOTSUPP); @@ -658,7 +595,7 @@ sys_mlock(p, v, retval) p->p_rlimit[RLIMIT_MEMLOCK].rlim_cur) return (EAGAIN); #else - if (error = suser(p->p_ucred, &p->p_acflag)) + if ((error = suser(p->p_ucred, &p->p_acflag)) != 0) return (error); #endif @@ -701,7 +638,7 @@ sys_munlock(p, v, retval) return (EINVAL); #ifndef pmap_wired_count - if (error = suser(p->p_ucred, &p->p_acflag)) + if ((error = suser(p->p_ucred, &p->p_acflag)) != 0) return (error); #endif @@ -803,7 +740,7 @@ vm_mmap(map, addr, size, prot, maxprot, flags, handle, foff) (void) pager_cache(object, FALSE); #ifdef DEBUG if (mmapdebug & MDB_MAPIT) - printf("vm_mmap(%d): ANON *addr %x size %x pager %x\n", + printf("vm_mmap(%d): ANON *addr %x size %x pager %p\n", curproc->p_pid, *addr, size, pager); #endif } @@ -833,7 +770,7 @@ vm_mmap(map, addr, size, prot, maxprot, flags, handle, foff) else { #ifdef DEBUG if (object == NULL) - printf("vm_mmap: no object: vp %x, pager %x\n", + printf("vm_mmap: no object: vp %p, pager %p\n", vp, pager); #endif /* @@ -984,7 +921,7 @@ vm_mmap(map, addr, size, prot, maxprot, flags, handle, foff) } #ifdef DEBUG if (mmapdebug & MDB_MAPIT) - printf("vm_mmap(%d): FILE *addr %x size %x pager %x\n", + printf("vm_mmap(%d): FILE *addr %x size %x pager %p\n", curproc->p_pid, *addr, size, pager); #endif } diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 81bb806cfa8..6fd2c08da60 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -1,4 +1,5 @@ -/* $NetBSD: vm_object.c,v 1.31 1995/12/06 00:38:11 pk Exp $ */ +/* $OpenBSD: vm_object.c,v 1.3 1996/03/03 17:45:34 niklas Exp $ */ +/* $NetBSD: vm_object.c,v 1.33 1996/02/10 00:08:11 christos Exp $ */ /* * Copyright (c) 1991, 1993 @@ -387,7 +388,7 @@ vm_object_page_clean(object, start, end, syncio, de_queue) boolean_t de_queue; { register vm_page_t p; - int onqueue; + int onqueue = 0; boolean_t noerror = TRUE; if (object == NULL) @@ -427,7 +428,7 @@ again: * Loop through the object page list cleaning as necessary. */ for (p = object->memq.tqh_first; p != NULL; p = p->listq.tqe_next) { - if ((start == end || p->offset >= start && p->offset < end) && + if ((start == end || (p->offset >= start && p->offset < end)) && !(p->flags & PG_FICTITIOUS)) { if ((p->flags & PG_CLEAN) && pmap_is_modified(VM_PAGE_TO_PHYS(p))) @@ -1460,8 +1461,6 @@ vm_object_print(object, full) vm_object_t object; boolean_t full; { - extern void _vm_object_print(); - _vm_object_print(object, full, printf); } diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index 5ecb20755e0..7bb8ac4f5b5 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -1,4 +1,5 @@ -/* $NetBSD: vm_page.c,v 1.26 1995/06/26 14:40:11 leo Exp $ */ +/* $OpenBSD: vm_page.c,v 1.2 1996/03/03 17:45:35 niklas Exp $ */ +/* $NetBSD: vm_page.c,v 1.28 1996/02/05 01:54:05 christos Exp $ */ /* * Copyright (c) 1991, 1993 @@ -195,9 +196,8 @@ vm_page_bootstrap(startp, endp) * map (they should use their own maps). */ - kentry_data_size = MAX_KMAP * sizeof(struct vm_map) + - MAX_KMAPENT * sizeof(struct vm_map_entry); - kentry_data_size = round_page(kentry_data_size); + kentry_data_size = round_page(MAX_KMAP*sizeof(struct vm_map) + + MAX_KMAPENT*sizeof(struct vm_map_entry)); kentry_data = (vm_offset_t) pmap_steal_memory(kentry_data_size); /* @@ -542,7 +542,12 @@ pmap_startup(startp, endp) i = pmap_page_index(paddr) - first_page; /* Don't trust pmap_page_index()... */ - if (i < 0 || i >= vm_page_count) + if ( +#if 0 + /* Cannot happen; i is unsigned */ + i < 0 || +#endif + i >= vm_page_count) panic("pmap_startup: bad i=0x%x", i); } diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c index d4456e6009a..f6abe2f1313 100644 --- a/sys/vm/vm_pageout.c +++ b/sys/vm/vm_pageout.c @@ -1,4 +1,5 @@ -/* $NetBSD: vm_pageout.c,v 1.22 1995/06/28 02:58:51 cgd Exp $ */ +/* $OpenBSD: vm_pageout.c,v 1.2 1996/03/03 17:45:36 niklas Exp $ */ +/* $NetBSD: vm_pageout.c,v 1.23 1996/02/05 01:54:07 christos Exp $ */ /* * Copyright (c) 1991, 1993 @@ -69,6 +70,7 @@ */ #include +#include #include #include diff --git a/sys/vm/vm_pager.c b/sys/vm/vm_pager.c index d832daec2fa..67179b515ad 100644 --- a/sys/vm/vm_pager.c +++ b/sys/vm/vm_pager.c @@ -1,4 +1,5 @@ -/* $NetBSD: vm_pager.c,v 1.18 1995/05/07 19:27:30 cgd Exp $ */ +/* $OpenBSD: vm_pager.c,v 1.2 1996/03/03 17:45:37 niklas Exp $ */ +/* $NetBSD: vm_pager.c,v 1.20 1996/02/10 00:08:13 christos Exp $ */ /* * Copyright (c) 1991, 1993 @@ -72,6 +73,7 @@ #include #include #include +#include #include #include @@ -339,7 +341,7 @@ vm_pager_unmap_pages(kva, npages) if (m->flags & PG_PAGEROWNED) m->flags &= ~PG_PAGEROWNED; else - printf("vm_pager_unmap_pages: %x(%x/%x) not owned\n", + printf("vm_pager_unmap_pages: %p(%x/%x) not owned\n", m, va, VM_PAGE_TO_PHYS(m)); } #endif diff --git a/sys/vm/vm_swap.c b/sys/vm/vm_swap.c index 41958bd6d85..8e9a2806ba1 100644 --- a/sys/vm/vm_swap.c +++ b/sys/vm/vm_swap.c @@ -1,4 +1,5 @@ -/* $NetBSD: vm_swap.c,v 1.31 1995/10/07 06:29:02 mycroft Exp $ */ +/* $OpenBSD: vm_swap.c,v 1.2 1996/03/03 17:45:38 niklas Exp $ */ +/* $NetBSD: vm_swap.c,v 1.32 1996/02/05 01:54:09 christos Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -38,7 +39,6 @@ #include #include #include -#include #include #include #include /* XXX */ @@ -49,6 +49,9 @@ #include #include +#include +#include + #include /* @@ -61,6 +64,8 @@ int niswdev; /* number of interleaved swap devices */ int niswap; /* size of interleaved swap area */ #endif +int swfree __P((struct proc *, int)); + /* * Set up swap devices. * Initialize linked list of free swap @@ -239,7 +244,7 @@ swstrategy(bp) panic("swstrategy"); VHOLD(sp->sw_vp); if ((bp->b_flags & B_READ) == 0) { - if (vp = bp->b_vp) { + if ((vp = bp->b_vp) != NULL) { vp->v_numoutput--; if ((vp->v_flag & VBWAIT) && vp->v_numoutput <= 0) { vp->v_flag &= ~VBWAIT; @@ -254,19 +259,23 @@ swstrategy(bp) VOP_STRATEGY(bp); } +/*ARGSUSED*/ int -swread(dev, uio) +swread(dev, uio, ioflag) dev_t dev; struct uio *uio; + int ioflag; { return (physio(swstrategy, NULL, dev, B_READ, minphys, uio)); } +/*ARGSUSED*/ int -swwrite(dev, uio) +swwrite(dev, uio, ioflag) dev_t dev; struct uio *uio; + int ioflag; { return (physio(swstrategy, NULL, dev, B_WRITE, minphys, uio)); @@ -293,10 +302,10 @@ sys_swapon(p, v, retval) int error; struct nameidata nd; - if (error = suser(p->p_ucred, &p->p_acflag)) + if ((error = suser(p->p_ucred, &p->p_acflag)) != 0) return (error); NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, name), p); - if (error = namei(&nd)) + if ((error = namei(&nd)) != 0) return (error); vp = nd.ni_vp; if (vp->v_type != VBLK) { @@ -315,7 +324,7 @@ sys_swapon(p, v, retval) return (EBUSY); } sp->sw_vp = vp; - if (error = swfree(p, sp - swdevt)) { + if ((error = swfree(p, sp - swdevt)) != 0) { vrele(vp); return (error); } @@ -359,7 +368,7 @@ swfree(p, index) vp = sp->sw_vp; /* If root on swap, then the skip open/close operations. */ if (vp != rootvp) { - if (error = VOP_OPEN(vp, FREAD|FWRITE, p->p_ucred, p)) + if ((error = VOP_OPEN(vp, FREAD|FWRITE, p->p_ucred, p)) != 0) return (error); } sp->sw_flags |= SW_FREED; diff --git a/sys/vm/vm_unix.c b/sys/vm/vm_unix.c index 40ae7e564ae..8175bf4077b 100644 --- a/sys/vm/vm_unix.c +++ b/sys/vm/vm_unix.c @@ -1,4 +1,5 @@ -/* $NetBSD: vm_unix.c,v 1.18 1995/10/07 06:29:04 mycroft Exp $ */ +/* $OpenBSD: vm_unix.c,v 1.2 1996/03/03 17:45:39 niklas Exp $ */ +/* $NetBSD: vm_unix.c,v 1.19 1996/02/10 00:08:14 christos Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -136,9 +137,11 @@ sys_ovadvise(p, v, retval) void *v; register_t *retval; { +#if 0 struct sys_ovadvise_args /* { syscallarg(int) anom; } */ *uap = v; +#endif return (EINVAL); } diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index b80754f1005..a84b9725e61 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -1,4 +1,5 @@ -/* $NetBSD: vnode_pager.c,v 1.16 1994/06/29 06:48:47 cgd Exp $ */ +/* $OpenBSD: vnode_pager.c,v 1.2 1996/03/03 17:45:40 niklas Exp $ */ +/* $NetBSD: vnode_pager.c,v 1.18 1996/02/10 00:08:15 christos Exp $ */ /* * Copyright (c) 1990 University of Utah. @@ -128,7 +129,7 @@ vnode_pager_alloc(handle, size, prot, foff) #ifdef DEBUG if (vpagerdebug & (VDB_FOLLOW|VDB_ALLOC)) - printf("vnode_pager_alloc(%x, %x, %x)\n", handle, size, prot); + printf("vnode_pager_alloc(%p, %x, %x)\n", handle, size, prot); #endif /* * Pageout to vnode, no can do yet. @@ -192,7 +193,7 @@ vnode_pager_alloc(handle, size, prot, foff) } #ifdef DEBUG if (vpagerdebug & VDB_ALLOC) - printf("vnode_pager_setup: vp %x sz %x pager %x object %x\n", + printf("vnode_pager_setup: vp %p sz %x pager %p object %p\n", vp, vnp->vnp_size, pager, object); #endif return(pager); @@ -210,9 +211,9 @@ vnode_pager_dealloc(pager) #ifdef DEBUG if (vpagerdebug & VDB_FOLLOW) - printf("vnode_pager_dealloc(%x)\n", pager); + printf("vnode_pager_dealloc(%p)\n", pager); #endif - if (vp = vnp->vnp_vp) { + if ((vp = vnp->vnp_vp) != NULL) { vp->v_vmdata = NULL; vp->v_flag &= ~VTEXT; #if NOTDEF @@ -236,7 +237,7 @@ vnode_pager_getpage(pager, mlist, npages, sync) #ifdef DEBUG if (vpagerdebug & VDB_FOLLOW) - printf("vnode_pager_getpage(%x, %x, %x, %x)\n", + printf("vnode_pager_getpage(%p, %p, %x, %x)\n", pager, mlist, npages, sync); #endif return(vnode_pager_io((vn_pager_t)pager->pg_data, @@ -254,7 +255,7 @@ vnode_pager_putpage(pager, mlist, npages, sync) #ifdef DEBUG if (vpagerdebug & VDB_FOLLOW) - printf("vnode_pager_putpage(%x, %x, %x, %x)\n", + printf("vnode_pager_putpage(%p, %p, %x, %x)\n", pager, mlist, npages, sync); #endif if (pager == NULL) @@ -285,7 +286,7 @@ vnode_pager_haspage(pager, offset) #ifdef DEBUG if (vpagerdebug & VDB_FOLLOW) - printf("vnode_pager_haspage(%x, %x)\n", pager, offset); + printf("vnode_pager_haspage(%p, %x)\n", pager, offset); #endif /* @@ -298,7 +299,7 @@ vnode_pager_haspage(pager, offset) VOP_UNLOCK(vnp->vnp_vp); #ifdef DEBUG if (vpagerdebug & (VDB_FAIL|VDB_SIZE)) - printf("vnode_pager_haspage: pg %x, off %x, size %x\n", + printf("vnode_pager_haspage: pg %p, off %x, size %x\n", pager, offset, vnp->vnp_size); #endif return(FALSE); @@ -318,7 +319,7 @@ vnode_pager_haspage(pager, offset) if (err) { #ifdef DEBUG if (vpagerdebug & VDB_FAIL) - printf("vnode_pager_haspage: BMAP err %d, pg %x, off %x\n", + printf("vnode_pager_haspage: BMAP err %d, pg %p, off %x\n", err, pager, offset); #endif return(TRUE); @@ -338,7 +339,7 @@ vnode_pager_cluster(pager, offset, loffset, hoffset) #ifdef DEBUG if (vpagerdebug & VDB_FOLLOW) - printf("vnode_pager_cluster(%x, %x) ", pager, offset); + printf("vnode_pager_cluster(%p, %x) ", pager, offset); #endif loff = offset; if (loff >= vnp->vnp_size) @@ -403,7 +404,7 @@ vnode_pager_setsize(vp, nsize) #ifdef DEBUG if (vpagerdebug & (VDB_FOLLOW|VDB_SIZE)) - printf("vnode_pager_setsize: vp %x obj %x osz %d nsz %d\n", + printf("vnode_pager_setsize: vp %p obj %p osz %d nsz %d\n", vp, object, vnp->vnp_size, nsize); #endif /* @@ -467,10 +468,10 @@ vnode_pager_uncache(vp) #ifdef DEBUG if (!VOP_ISLOCKED(vp)) { #ifdef NFSCLIENT - extern int (**nfsv2_vnodeop_p)(); - extern int (**spec_nfsv2nodeop_p)(); + extern int (**nfsv2_vnodeop_p) __P((void *)); + extern int (**spec_nfsv2nodeop_p) __P((void *)); #ifdef FIFO - extern int (**fifo_nfsv2nodeop_p)(); + extern int (**fifo_nfsv2nodeop_p) __P((void *)); #endif if (vp->v_op != nfsv2_vnodeop_p @@ -522,7 +523,7 @@ vnode_pager_io(vnp, mlist, npages, sync, rw) #ifdef DEBUG if (vpagerdebug & VDB_FOLLOW) - printf("vnode_pager_io(%x, %x, %c): vnode %x\n", + printf("vnode_pager_io(%p, %p, %c): vnode %p\n", vnp, m, rw == UIO_READ ? 'R' : 'W', vnp->vnp_vp); #endif foff = m->offset + m->object->paging_offset; @@ -545,7 +546,7 @@ vnode_pager_io(vnp, mlist, npages, sync, rw) vm_pager_unmap_pages(kva, npages); #ifdef DEBUG if (vpagerdebug & VDB_SIZE) - printf("vnode_pager_io: vp %x, off %d size %d\n", + printf("vnode_pager_io: vp %p, off %d size %d\n", vnp->vnp_vp, foff, vnp->vnp_size); #endif return(VM_PAGER_BAD); @@ -565,7 +566,7 @@ vnode_pager_io(vnp, mlist, npages, sync, rw) auio.uio_procp = (struct proc *)0; #ifdef DEBUG if (vpagerdebug & VDB_IO) - printf("vnode_pager_io: vp %x kva %x foff %x size %x", + printf("vnode_pager_io: vp %p kva %x foff %x size %x", vnp->vnp_vp, kva, foff, size); #endif if (rw == UIO_READ)