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