1 /* $OpenBSD: compat_vm.c,v 1.4 2003/08/06 21:08:06 millert Exp $ */ 2 /* $NetBSD: vm_12.c,v 1.8 1997/10/20 22:05:22 thorpej Exp $ */ 3 4 /* 5 * Copyright (c) 1997 Matthew R. Green 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 3. The name of the author may not be used to endorse or promote products 17 * derived from this software without specific prior written permission. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 24 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 26 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 27 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 * SUCH DAMAGE. 30 */ 31 32 #include <sys/param.h> 33 #include <sys/systm.h> 34 #include <sys/mount.h> /* needed for next include! */ 35 #include <sys/syscallargs.h> 36 37 #include <sys/swap.h> 38 #include <sys/mman.h> 39 40 int 41 compat_25_sys_swapon(p, v, retval) 42 struct proc *p; 43 void *v; 44 register_t *retval; 45 { 46 struct sys_swapctl_args ua; 47 struct compat_25_sys_swapon_args /* { 48 syscallarg(const char *) name; 49 } */ *uap = v; 50 51 SCARG(&ua, cmd) = SWAP_ON; 52 SCARG(&ua, arg) = (void *)SCARG(uap, name); 53 SCARG(&ua, misc) = 0; /* priority */ 54 return (sys_swapctl(p, &ua, retval)); 55 } 56 57 int 58 compat_25_sys_omsync(p, v, retval) 59 struct proc *p; 60 void *v; 61 register_t *retval; 62 { 63 struct sys_msync_args ua; 64 struct compat_25_sys_omsync_args /* { 65 syscallarg(caddr_t) addr; 66 syscallarg(size_t) len; 67 } */ *uap = v; 68 69 SCARG(&ua, addr) = SCARG(uap, addr); 70 SCARG(&ua, len) = SCARG(uap, len); 71 SCARG(&ua, flags) = MS_SYNC | MS_INVALIDATE; 72 return (sys_msync(p, &ua, retval)); 73 }