1 1.3 maxv /* $NetBSD: linux_fadvise64_64.c,v 1.3 2014/11/09 17:48:08 maxv Exp $ */ 2 1.1 alnsn 3 1.1 alnsn /*- 4 1.1 alnsn * Copyright (c) 2011 The NetBSD Foundation, Inc. 5 1.1 alnsn * All rights reserved. 6 1.1 alnsn * 7 1.1 alnsn * Redistribution and use in source and binary forms, with or without 8 1.1 alnsn * modification, are permitted provided that the following conditions 9 1.1 alnsn * are met: 10 1.1 alnsn * 1. Redistributions of source code must retain the above copyright 11 1.1 alnsn * notice, this list of conditions and the following disclaimer. 12 1.1 alnsn * 2. Redistributions in binary form must reproduce the above copyright 13 1.1 alnsn * notice, this list of conditions and the following disclaimer in the 14 1.1 alnsn * documentation and/or other materials provided with the distribution. 15 1.1 alnsn * 16 1.1 alnsn * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 17 1.1 alnsn * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 18 1.1 alnsn * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 1.1 alnsn * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 20 1.1 alnsn * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 1.1 alnsn * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 1.1 alnsn * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 1.1 alnsn * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 1.1 alnsn * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 1.1 alnsn * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 1.1 alnsn * POSSIBILITY OF SUCH DAMAGE. 27 1.1 alnsn */ 28 1.1 alnsn 29 1.1 alnsn #include <sys/cdefs.h> 30 1.3 maxv __KERNEL_RCSID(0, "$NetBSD: linux_fadvise64_64.c,v 1.3 2014/11/09 17:48:08 maxv Exp $"); 31 1.1 alnsn 32 1.1 alnsn #include <sys/param.h> 33 1.1 alnsn #include <sys/types.h> 34 1.1 alnsn #include <sys/systm.h> 35 1.1 alnsn #include <sys/namei.h> 36 1.1 alnsn #include <sys/proc.h> 37 1.1 alnsn #include <sys/file.h> 38 1.1 alnsn #include <sys/fcntl.h> 39 1.1 alnsn #include <sys/stat.h> 40 1.1 alnsn #include <sys/filedesc.h> 41 1.1 alnsn #include <sys/ioctl.h> 42 1.1 alnsn #include <sys/kernel.h> 43 1.1 alnsn #include <sys/mount.h> 44 1.1 alnsn #include <sys/namei.h> 45 1.1 alnsn #include <sys/vnode.h> 46 1.1 alnsn #include <sys/tty.h> 47 1.1 alnsn #include <sys/socketvar.h> 48 1.1 alnsn #include <sys/conf.h> 49 1.1 alnsn #include <sys/pipe.h> 50 1.1 alnsn 51 1.1 alnsn #include <machine/limits.h> 52 1.1 alnsn 53 1.1 alnsn #include <sys/syscall.h> 54 1.1 alnsn #include <sys/syscallargs.h> 55 1.1 alnsn 56 1.1 alnsn #include <compat/linux/common/linux_types.h> 57 1.1 alnsn #include <compat/linux/common/linux_machdep.h> 58 1.1 alnsn #include <compat/linux/common/linux_misc.h> 59 1.1 alnsn 60 1.1 alnsn #include <compat/linux/linux_syscallargs.h> 61 1.1 alnsn 62 1.1 alnsn 63 1.1 alnsn int 64 1.1 alnsn linux_sys_fadvise64_64(struct lwp *l, 65 1.1 alnsn const struct linux_sys_fadvise64_64_args *uap, register_t *retval) 66 1.1 alnsn { 67 1.1 alnsn /* { 68 1.1 alnsn syscallarg(int) fd; 69 1.1 alnsn syscallarg(off_t) offset; 70 1.1 alnsn syscallarg(off_t) len; 71 1.1 alnsn syscallarg(int) advice; 72 1.1 alnsn } */ 73 1.1 alnsn 74 1.1 alnsn return do_posix_fadvise(SCARG(uap, fd), SCARG(uap, offset), 75 1.2 njoly SCARG(uap, len), linux_to_bsd_posix_fadv(SCARG(uap, advice))); 76 1.1 alnsn } 77