tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

linux fadvise64



Attached patch implements linux's fadvise64 and fadvise64_64 syscalls.
It fixes "unimplemented" entries and error returns in kdump output.
The patch doesn't include autogenerated stuff.
Tested on amd64 using wip/icc11 (64bit) and www/opera (32bit) programs.
Can I commit it?
Thanks,
Alex
Index: sys/compat/linux/arch/alpha/syscalls.master
===================================================================
RCS file: /cvsroot/src/sys/compat/linux/arch/alpha/syscalls.master,v
retrieving revision 1.73
diff -p -u -p -h -u -r1.73 syscalls.master
--- sys/compat/linux/arch/alpha/syscalls.master 15 Apr 2011 13:04:52 -0000      
1.73
+++ sys/compat/linux/arch/alpha/syscalls.master 30 May 2011 01:09:17 -0000
@@ -652,7 +652,8 @@
 410    UNIMPL          remap_file_pages
 411    STD             { int|linux_sys||set_tid_address(int *tid); }
 412    UNIMPL          restart_syscall
-413    UNIMPL          fadvise64
+413    STD             { int|linux_sys||fadvise64(int fd, \
+                           linux_off_t offset, size_t len, int advice); }
 414    UNIMPL          timer_create
 415    UNIMPL          timer_settime
 416    UNIMPL          timer_gettime
Index: sys/compat/linux/arch/amd64/linux_commons.c
===================================================================
RCS file: /cvsroot/src/sys/compat/linux/arch/amd64/linux_commons.c,v
retrieving revision 1.10
diff -p -u -p -h -u -r1.10 linux_commons.c
--- sys/compat/linux/arch/amd64/linux_commons.c 2 Mar 2010 15:46:19 -0000       
1.10
+++ sys/compat/linux/arch/amd64/linux_commons.c 30 May 2011 01:09:17 -0000
@@ -36,3 +36,4 @@ __KERNEL_RCSID(1, "$NetBSD: linux_common
 #include "../../common/linux_misc_notalpha.c"
 #include "../../common/linux_sig_notalpha.c"
 #include "../../common/linux_futex.c"
+#include "../../common/linux_fadvise64.c"
Index: sys/compat/linux/arch/amd64/syscalls.master
===================================================================
RCS file: /cvsroot/src/sys/compat/linux/arch/amd64/syscalls.master,v
retrieving revision 1.36
diff -p -u -p -h -u -r1.36 syscalls.master
--- sys/compat/linux/arch/amd64/syscalls.master 10 Apr 2011 15:48:46 -0000      
1.36
+++ sys/compat/linux/arch/amd64/syscalls.master 30 May 2011 01:09:17 -0000
@@ -417,7 +417,8 @@
 218    STD             { int|linux_sys||set_tid_address(int *tid); }
 219    UNIMPL          restart_syscall
 220    UNIMPL          semtimedop
-221    UNIMPL          fadvise64
+221    STD             { int|linux_sys||fadvise64(int fd, \
+                           linux_off_t offset, size_t len, int advice); }
 222    UNIMPL          timer_create
 223    UNIMPL          timer_settime
 224    UNIMPL          timer_gettime
Index: sys/compat/linux/arch/arm/files.linux_arm
===================================================================
RCS file: /cvsroot/src/sys/compat/linux/arch/arm/files.linux_arm,v
retrieving revision 1.4
diff -p -u -p -h -u -r1.4 files.linux_arm
--- sys/compat/linux/arch/arm/files.linux_arm   30 Aug 2006 11:14:39 -0000      
1.4
+++ sys/compat/linux/arch/arm/files.linux_arm   30 May 2011 01:09:17 -0000
@@ -8,3 +8,4 @@ file    compat/linux/arch/arm/linux_syscall
 file   compat/linux/arch/arm/linux_sysent.c            compat_linux
 file   compat/linux/arch/arm/linux_sys_machdep.c       compat_linux
 file   compat/linux/arch/arm/linux_commons.c           compat_linux
+file   compat/linux/common/linux_fadvise64_64.c        compat_linux
Index: sys/compat/linux/arch/arm/syscalls.master
===================================================================
RCS file: /cvsroot/src/sys/compat/linux/arch/arm/syscalls.master,v
retrieving revision 1.45
diff -p -u -p -h -u -r1.45 syscalls.master
--- sys/compat/linux/arch/arm/syscalls.master   15 Apr 2011 13:04:52 -0000      
1.45
+++ sys/compat/linux/arch/arm/syscalls.master   30 May 2011 01:09:17 -0000
@@ -447,7 +447,8 @@
                            size_t sz, struct linux_statfs64 *sp); }
 268    STD             { int|linux_sys||tgkill(int tgid, int tid, int sig); }
 269    UNIMPL          utimes
-270    UNIMPL          fadvise64_64
+270    STD             { int|linux_sys||fadvise64_64(int fd, \
+                           linux_off_t offset, linux_off_t len, int advice); }
 271    UNIMPL          pciconfig_iobase
 272    UNIMPL          pciconfig_read
 273    UNIMPL          pciconfig_write
Index: sys/compat/linux/arch/i386/files.linux_i386
===================================================================
RCS file: /cvsroot/src/sys/compat/linux/arch/i386/files.linux_i386,v
retrieving revision 1.10
diff -p -u -p -h -u -r1.10 files.linux_i386
--- sys/compat/linux/arch/i386/files.linux_i386 23 Feb 2009 20:28:58 -0000      
1.10
+++ sys/compat/linux/arch/i386/files.linux_i386 30 May 2011 01:09:17 -0000
@@ -8,3 +8,5 @@ file    compat/linux/arch/i386/linux_sysent
 file   compat/linux/arch/i386/linux_commons.c          compat_linux
 file   compat/linux/arch/i386/linux_ptrace.c           compat_linux & ptrace
 file   compat/linux/arch/i386/linux_exec_machdep.c     compat_linux
+file   compat/linux/common/linux_fadvise64.c           compat_linux
+file   compat/linux/common/linux_fadvise64_64.c        compat_linux
Index: sys/compat/linux/arch/i386/syscalls.master
===================================================================
RCS file: /cvsroot/src/sys/compat/linux/arch/i386/syscalls.master,v
retrieving revision 1.104
diff -p -u -p -h -u -r1.104 syscalls.master
--- sys/compat/linux/arch/i386/syscalls.master  10 Apr 2011 15:48:46 -0000      
1.104
+++ sys/compat/linux/arch/i386/syscalls.master  30 May 2011 01:09:17 -0000
@@ -419,7 +419,8 @@
 247    UNIMPL          io_getevents
 248    UNIMPL          io_submit
 249    UNIMPL          io_cancel
-250    UNIMPL          fadvise64
+250    STD             { int|linux_sys||fadvise64(int fd, \
+                           linux_off_t offset, size_t len, int advice); }
 251    UNIMPL          /* unused */
 252    STD             { int|linux_sys||exit_group(int error_code); }
 253    UNIMPL          lookup_dcookie
@@ -448,7 +449,8 @@
                            size_t sz, struct linux_statfs64 *sp); }
 270    STD             { int|linux_sys||tgkill(int tgid, int tid, int sig); }
 271    UNIMPL          utimes
-272    UNIMPL          fadvise64_64
+272    STD             { int|linux_sys||fadvise64_64(int fd, \
+                           linux_off_t offset, linux_off_t len, int advice); }
 273    UNIMPL          vserver
 274    UNIMPL          mbind
 275    UNIMPL          get_mempolicy
Index: sys/compat/linux/arch/m68k/files.linux_m68k
===================================================================
RCS file: /cvsroot/src/sys/compat/linux/arch/m68k/files.linux_m68k,v
retrieving revision 1.5
diff -p -u -p -h -u -r1.5 files.linux_m68k
--- sys/compat/linux/arch/m68k/files.linux_m68k 7 Jul 2010 01:30:34 -0000       
1.5
+++ sys/compat/linux/arch/m68k/files.linux_m68k 30 May 2011 01:09:17 -0000
@@ -19,3 +19,5 @@ file  compat/linux/common/linux_oldmmap.c
 file   compat/linux/common/linux_oldselect.c           compat_linux
 file   compat/linux/common/linux_uid16.c               compat_linux
 file   compat/linux/common/linux_futex.c               compat_linux
+file   compat/linux/common/linux_fadvise64.c           compat_linux
+file   compat/linux/common/linux_fadvise64_64.c        compat_linux
Index: sys/compat/linux/arch/m68k/syscalls.master
===================================================================
RCS file: /cvsroot/src/sys/compat/linux/arch/m68k/syscalls.master,v
retrieving revision 1.70
diff -p -u -p -h -u -r1.70 syscalls.master
--- sys/compat/linux/arch/m68k/syscalls.master  15 Apr 2011 13:04:53 -0000      
1.70
+++ sys/compat/linux/arch/m68k/syscalls.master  30 May 2011 01:09:17 -0000
@@ -430,7 +430,8 @@
 243    UNIMPL          io_getevents
 244    UNIMPL          io_submit
 245    UNIMPL          io_cancel
-246    UNIMPL          fadvise64
+246    STD             { int|linux_sys||fadvise64(int fd, \
+                           linux_off_t offset, size_t len, int advice); }
 247    UNIMPL          exit_group
 248    UNIMPL          lookup_dcookie
 249    UNIMPL          epoll_create
@@ -458,7 +459,8 @@
                            size_t sz, struct linux_statfs64 *sp); }
 265    STD             { int|linux_sys||tgkill(int tgid, int tid, int sig); }
 266    UNIMPL          utimes
-267    UNIMPL          fadvise64_64
+267    STD             { int|linux_sys||fadvise64_64(int fd, \
+                           linux_off_t offset, linux_off_t len, int advice); }
 268    UNIMPL          mbind
 269    UNIMPL          get_mempolicy
 270    UNIMPL          set_mempolicy
Index: sys/compat/linux/arch/mips/files.linux_mips
===================================================================
RCS file: /cvsroot/src/sys/compat/linux/arch/mips/files.linux_mips,v
retrieving revision 1.6
diff -p -u -p -h -u -r1.6 files.linux_mips
--- sys/compat/linux/arch/mips/files.linux_mips 7 Jul 2010 01:30:34 -0000       
1.6
+++ sys/compat/linux/arch/mips/files.linux_mips 30 May 2011 01:09:17 -0000
@@ -18,3 +18,4 @@ file  compat/linux/common/linux_olduname.
 file   compat/linux/common/linux_file64.c              compat_linux
 file   compat/linux/common/linux_fcntl64.c             compat_linux
 file   compat/linux/common/linux_futex.c               compat_linux
+file   compat/linux/common/linux_fadvise64.c           compat_linux
Index: sys/compat/linux/arch/mips/syscalls.master
===================================================================
RCS file: /cvsroot/src/sys/compat/linux/arch/mips/syscalls.master,v
retrieving revision 1.40
diff -p -u -p -h -u -r1.40 syscalls.master
--- sys/compat/linux/arch/mips/syscalls.master  15 Apr 2011 13:04:53 -0000      
1.40
+++ sys/compat/linux/arch/mips/syscalls.master  30 May 2011 01:09:18 -0000
@@ -428,7 +428,8 @@
 251    UNIMPL          remap_file_pages
 252    STD             { int|linux_sys||set_tid_address(int *tid); }
 253    UNIMPL          restart_syscall
-254    UNIMPL          fadvise64
+254    STD             { int|linux_sys||fadvise64(int fd, \
+                           linux_off_t offset, size_t len, int advice); }
 255    STD             { int|linux_sys||statfs64(const char *path, \
                            size_t sz, struct linux_statfs64 *sp); }
 256    STD             { int|linux_sys||fstatfs64(int fd, \
Index: sys/compat/linux/arch/powerpc/files.linux_powerpc
===================================================================
RCS file: /cvsroot/src/sys/compat/linux/arch/powerpc/files.linux_powerpc,v
retrieving revision 1.10
diff -p -u -p -h -u -r1.10 files.linux_powerpc
--- sys/compat/linux/arch/powerpc/files.linux_powerpc   7 Jul 2010 01:30:34 
-0000       1.10
+++ sys/compat/linux/arch/powerpc/files.linux_powerpc   30 May 2011 01:09:18 
-0000
@@ -19,3 +19,5 @@ file  compat/linux/common/linux_olduname.
 file   compat/linux/common/linux_file64.c              compat_linux
 file   compat/linux/common/linux_fcntl64.c             compat_linux
 file   compat/linux/common/linux_futex.c               compat_linux
+file   compat/linux/common/linux_fadvise64.c           compat_linux
+file   compat/linux/common/linux_fadvise64_64.c        compat_linux
Index: sys/compat/linux/arch/powerpc/syscalls.master
===================================================================
RCS file: /cvsroot/src/sys/compat/linux/arch/powerpc/syscalls.master,v
retrieving revision 1.46
diff -p -u -p -h -u -r1.46 syscalls.master
--- sys/compat/linux/arch/powerpc/syscalls.master       15 Apr 2011 13:04:53 
-0000      1.46
+++ sys/compat/linux/arch/powerpc/syscalls.master       30 May 2011 01:09:18 
-0000
@@ -416,7 +416,8 @@
 230    UNIMPL          io_submit
 231    UNIMPL          io_cancel
 232    STD             { int|linux_sys||set_tid_address(int *tid); }
-233    UNIMPL          fadvise64
+233    STD             { int|linux_sys||fadvise64(int fd, \
+                           linux_off_t offset, size_t len, int advice); }
 234    STD             { int|linux_sys||exit_group(int error_code); }
 235    UNIMPL          lookup_dcookie
 236    UNIMPL          epoll_create
@@ -444,7 +445,8 @@
                            size_t sz, struct linux_statfs64 *sp); }
 253    STD             { int|linux_sys||fstatfs64(int fd, \
                            size_t sz, struct linux_statfs64 *sp); }
-254    UNIMPL          fadvise64_64
+254    STD             { int|linux_sys||fadvise64_64(int fd, \
+                           linux_off_t offset, linux_off_t len, int advise); }
 255    UNIMPL          rtas
 256    UNIMPL          /* reserved for sys_debug_setcontext */
 257    UNIMPL          /* reserved for vserver */
Index: sys/compat/linux/common/linux_fadvise64.c
===================================================================
RCS file: sys/compat/linux/common/linux_fadvise64.c
diff -N sys/compat/linux/common/linux_fadvise64.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ sys/compat/linux/common/linux_fadvise64.c   30 May 2011 01:09:18 -0000
@@ -0,0 +1,82 @@
+/*     $NetBSD$        */
+
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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 <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD$");
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/systm.h>
+#include <sys/namei.h>
+#include <sys/proc.h>
+#include <sys/file.h>
+#include <sys/fcntl.h>
+#include <sys/stat.h>
+#include <sys/filedesc.h>
+#include <sys/ioctl.h>
+#include <sys/kernel.h>
+#include <sys/mount.h>
+#include <sys/malloc.h>
+#include <sys/namei.h>
+#include <sys/vnode.h>
+#include <sys/tty.h>
+#include <sys/socketvar.h>
+#include <sys/conf.h>
+#include <sys/pipe.h>
+
+#include <machine/limits.h>
+
+#include <sys/syscall.h>
+#include <sys/syscallargs.h>
+
+#include <compat/linux/common/linux_types.h>
+#include <compat/linux/common/linux_machdep.h>
+#include <compat/linux/common/linux_misc.h>
+
+#include <compat/linux/linux_syscallargs.h>
+
+
+int
+linux_sys_fadvise64(struct lwp *l,
+    const struct linux_sys_fadvise64_args *uap, register_t *retval)
+{
+       /* {
+               syscallarg(int) fd;
+               syscallarg(linux_off_t) offset;
+               syscallarg(size_t) len;
+               syscallarg(int) advice;
+       } */
+
+       size_t len = SCARG(uap, len);
+
+       if (sizeof(len) == sizeof(linux_off_t) && len > SSIZE_MAX)
+               return (EINVAL);
+
+       return do_posix_fadvise(SCARG(uap, fd),
+           SCARG(uap, offset), len, linux_to_bsd_posix_fadv(SCARG(uap, 
advice)));
+}
Index: sys/compat/linux/common/linux_fadvise64_64.c
===================================================================
RCS file: sys/compat/linux/common/linux_fadvise64_64.c
diff -N sys/compat/linux/common/linux_fadvise64_64.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ sys/compat/linux/common/linux_fadvise64_64.c        30 May 2011 01:09:18 
-0000
@@ -0,0 +1,77 @@
+/*     $NetBSD$        */
+
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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 <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD$");
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/systm.h>
+#include <sys/namei.h>
+#include <sys/proc.h>
+#include <sys/file.h>
+#include <sys/fcntl.h>
+#include <sys/stat.h>
+#include <sys/filedesc.h>
+#include <sys/ioctl.h>
+#include <sys/kernel.h>
+#include <sys/mount.h>
+#include <sys/malloc.h>
+#include <sys/namei.h>
+#include <sys/vnode.h>
+#include <sys/tty.h>
+#include <sys/socketvar.h>
+#include <sys/conf.h>
+#include <sys/pipe.h>
+
+#include <machine/limits.h>
+
+#include <sys/syscall.h>
+#include <sys/syscallargs.h>
+
+#include <compat/linux/common/linux_types.h>
+#include <compat/linux/common/linux_machdep.h>
+#include <compat/linux/common/linux_misc.h>
+
+#include <compat/linux/linux_syscallargs.h>
+
+
+int
+linux_sys_fadvise64_64(struct lwp *l,
+    const struct linux_sys_fadvise64_64_args *uap, register_t *retval)
+{
+       /* {
+               syscallarg(int) fd;
+               syscallarg(off_t) offset;
+               syscallarg(off_t) len;
+               syscallarg(int) advice;
+       } */
+
+       return do_posix_fadvise(SCARG(uap, fd), SCARG(uap, offset),
+           SCARG(uap, offset), linux_to_bsd_posix_fadv(SCARG(uap, advice)));
+}
Index: sys/compat/linux/common/linux_misc.h
===================================================================
RCS file: /cvsroot/src/sys/compat/linux/common/linux_misc.h,v
retrieving revision 1.20
diff -p -u -p -h -u -r1.20 linux_misc.h
--- sys/compat/linux/common/linux_misc.h        2 Nov 2010 18:18:07 -0000       
1.20
+++ sys/compat/linux/common/linux_misc.h        30 May 2011 01:09:18 -0000
@@ -131,6 +131,12 @@ extern const int linux_fstypes_cnt;
 /* Personality flags. */
 #define LINUX_PER_ADDR_NO_RANDOMIZE    0x00040000
 
+/* 
+ * Convert POSIX_FADV_* constants from Linux to NetBSD
+ * (it's f(x)=x everywhere except S390)
+ */
+#define linux_to_bsd_posix_fadv(advice) (advice)
+
 #ifdef _KERNEL
 __BEGIN_DECLS
 int bsd_to_linux_wstat(int);
Index: sys/compat/linux32/arch/amd64/syscalls.master
===================================================================
RCS file: /cvsroot/src/sys/compat/linux32/arch/amd64/syscalls.master,v
retrieving revision 1.58
diff -p -u -p -h -u -r1.58 syscalls.master
--- sys/compat/linux32/arch/amd64/syscalls.master       10 Apr 2011 15:47:21 
-0000      1.58
+++ sys/compat/linux32/arch/amd64/syscalls.master       30 May 2011 01:09:18 
-0000
@@ -425,7 +425,8 @@
 247    UNIMPL  io_getevents
 248    UNIMPL  io_submit
 249    UNIMPL  io_cancel
-250    UNIMPL  fadvise64
+250    STD     { int|linux32_sys||fadvise64(int fd, uint32_t offlo, \
+                   uint32_t offhi, linux32_size_t len, int advice); }
 251    UNIMPL  /*      unused  */
 252    STD     { int|linux32_sys||exit_group(int error_code); }
 253    UNIMPL  lookup_dcookie
@@ -453,7 +454,8 @@
                    netbsd32_size_t sz, linux32_statfs64p sp); }
 270    STD     { int|linux32_sys||tgkill(int tgid, int tid, int sig); }
 271    UNIMPL  utimes
-272    UNIMPL  fadvise64_64
+272    STD     { int|linux32_sys||fadvise64_64(int fd, uint32_t offlo, \
+                   uint32_t offhi, uint32_t lenlo, uint32_t lenhi, int 
advice); }
 273    UNIMPL  vserver
 274    UNIMPL  mbind
 275    UNIMPL  get_mempolicy
Index: sys/compat/linux32/common/linux32_fcntl.c
===================================================================
RCS file: /cvsroot/src/sys/compat/linux32/common/linux32_fcntl.c,v
retrieving revision 1.8
diff -p -u -p -h -u -r1.8 linux32_fcntl.c
--- sys/compat/linux32/common/linux32_fcntl.c   29 Dec 2008 14:33:40 -0000      
1.8
+++ sys/compat/linux32/common/linux32_fcntl.c   30 May 2011 01:09:18 -0000
@@ -144,3 +144,47 @@ linux32_sys_fcntl(struct lwp *l, const s
 
        return linux_sys_fcntl(l, &ua, retval);
 }
+
+int
+linux32_sys_fadvise64(struct lwp *l,
+    const struct linux32_sys_fadvise64_args *uap, register_t *retval)
+{
+       /* {
+               syscallarg(int) fd;
+               syscallarg(off_t) offset;
+               syscallarg(size_t) len;
+               syscallarg(int) advice;
+       } */
+       struct sys___posix_fadvise50_args ua;
+
+       /* Linux doesn't have the 'pad' pseudo-parameter */
+       NETBSD32TO64_UAP(fd);
+       SCARG(&ua, PAD) = 0;
+       SCARG(&ua, offset) = ((off_t)SCARG(uap, offhi) << 32) + SCARG(uap, 
offlo);
+       SCARG(&ua, len) = SCARG(uap, len);
+       SCARG(&ua, advice) = linux_to_bsd_posix_fadv(SCARG(uap, advice));
+
+       return sys___posix_fadvise50(l, &ua, retval);
+}
+
+int
+linux32_sys_fadvise64_64(struct lwp *l,
+    const struct linux32_sys_fadvise64_64_args *uap, register_t *retval)
+{
+       /* {
+               syscallarg(int) fd;
+               syscallarg(off_t) offset;
+               syscallarg(off_t) len;
+               syscallarg(int) advice;
+       } */
+       struct sys___posix_fadvise50_args ua;
+
+       /* Linux doesn't have the 'pad' pseudo-parameter */
+       NETBSD32TO64_UAP(fd);
+       SCARG(&ua, PAD) = 0;
+       SCARG(&ua, offset) = ((off_t)SCARG(uap, offhi) << 32) + SCARG(uap, 
offlo);
+       SCARG(&ua, len) = ((off_t)SCARG(uap, lenhi) << 32) + SCARG(uap, lenlo);
+       SCARG(&ua, advice) = linux_to_bsd_posix_fadv(SCARG(uap, advice));
+
+       return sys___posix_fadvise50(l, &ua, retval);
+}


Home | Main Index | Thread Index | Old Index