Source-Changes-HG archive

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

[src/trunk]: src/sys/compat add dummy implementation of linux fallocate() whi...



details:   https://anonhg.NetBSD.org/src/rev/1090757a6f78
branches:  trunk
changeset: 460914:1090757a6f78
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Sat Nov 09 23:44:31 2019 +0000

description:
add dummy implementation of linux fallocate() which just returns EOPNOTSUPP;
this is needed so that glibc falls back to emulation and apps behaving
properly, since EOPNOTSUPP is a documented and expected return code, but
ENOSYS is not

right now there are no filesystems in NetBSD tree supporting the fallocate
VOP, so no point trying to map this to a native call

supposed to help with problem reported in
https://mail-index.netbsd.org/tech-kern/2019/11/03/msg025641.html

diffstat:

 sys/compat/linux/arch/alpha/syscalls.master   |   5 +++--
 sys/compat/linux/arch/amd64/syscalls.master   |   5 +++--
 sys/compat/linux/arch/arm/syscalls.master     |   5 +++--
 sys/compat/linux/arch/i386/syscalls.master    |   5 +++--
 sys/compat/linux/arch/m68k/syscalls.master    |   5 +++--
 sys/compat/linux/arch/mips/syscalls.master    |   5 +++--
 sys/compat/linux/arch/powerpc/syscalls.master |   5 +++--
 sys/compat/linux/common/linux_file.c          |  12 ++++++++++--
 sys/compat/linux32/arch/amd64/syscalls.master |   5 +++--
 sys/compat/linux32/common/linux32_unistd.c    |  20 ++++++++++++++++++--
 10 files changed, 52 insertions(+), 20 deletions(-)

diffs (220 lines):

diff -r 911181ae0540 -r 1090757a6f78 sys/compat/linux/arch/alpha/syscalls.master
--- a/sys/compat/linux/arch/alpha/syscalls.master       Sat Nov 09 23:34:13 2019 +0000
+++ b/sys/compat/linux/arch/alpha/syscalls.master       Sat Nov 09 23:44:31 2019 +0000
@@ -1,4 +1,4 @@
-       $NetBSD: syscalls.master,v 1.95 2019/03/24 16:24:19 maxv Exp $
+       $NetBSD: syscalls.master,v 1.96 2019/11/09 23:44:31 jdolecek Exp $
 ;
 ;      @(#)syscalls.master     8.1 (Berkeley) 7/19/93
 
@@ -760,7 +760,8 @@
 479    STD             { int|linux_sys||recvmmsg(int s, \
                            struct linux_mmsghdr *msgvec, unsigned int vlen, \
                            unsigned int flags, struct timespec *timeout); }
-480    UNIMPL          fallocate
+480    STD             { int|linux_sys||fallocate(int fd, int mode, \
+                           off_t offset, off_t len); }
 481    UNIMPL          timerfd_create
 482    UNIMPL          timerfd_settime
 483    UNIMPL          timerfd_gettime
diff -r 911181ae0540 -r 1090757a6f78 sys/compat/linux/arch/amd64/syscalls.master
--- a/sys/compat/linux/arch/amd64/syscalls.master       Sat Nov 09 23:34:13 2019 +0000
+++ b/sys/compat/linux/arch/amd64/syscalls.master       Sat Nov 09 23:44:31 2019 +0000
@@ -1,4 +1,4 @@
-       $NetBSD: syscalls.master,v 1.60 2017/02/03 16:18:19 christos Exp $
+       $NetBSD: syscalls.master,v 1.61 2019/11/09 23:44:31 jdolecek Exp $
 
 ;      @(#)syscalls.master     8.1 (Berkeley) 7/19/93
 
@@ -513,7 +513,8 @@
 282    UNIMPL          signalfd
 283    UNIMPL          timerfd_create
 284    UNIMPL          eventfd
-285    UNIMPL          fallocate
+285    STD             { int|linux_sys||fallocate(int fd, int mode, \
+                           off_t offset, off_t len); }
 286    UNIMPL          timerfd_settime
 287    UNIMPL          timerfd_gettime
 288    STD             { int|linux_sys||accept4(int s, \
diff -r 911181ae0540 -r 1090757a6f78 sys/compat/linux/arch/arm/syscalls.master
--- a/sys/compat/linux/arch/arm/syscalls.master Sat Nov 09 23:34:13 2019 +0000
+++ b/sys/compat/linux/arch/arm/syscalls.master Sat Nov 09 23:44:31 2019 +0000
@@ -1,4 +1,4 @@
-       $NetBSD: syscalls.master,v 1.67 2017/02/03 16:28:34 christos Exp $
+       $NetBSD: syscalls.master,v 1.68 2019/11/09 23:44:31 jdolecek Exp $
 
 ; Derived from sys/compat/linux/arch/*/syscalls.master
 ; and from Linux 2.4.12 arch/arm/kernel/calls.S
@@ -556,7 +556,8 @@
 349    UNIMPL          signalfd
 350    UNIMPL          timerfd_create
 351    UNIMPL          eventfd
-352    UNIMPL          fallocate
+352    STD             { int|linux_sys||fallocate(int fd, int mode, \
+                           off_t offset, off_t len); }
 353    UNIMPL          timerfd_settime
 354    UNIMPL          timerfd_gettime
 355    UNIMPL          signalfd4
diff -r 911181ae0540 -r 1090757a6f78 sys/compat/linux/arch/i386/syscalls.master
--- a/sys/compat/linux/arch/i386/syscalls.master        Sat Nov 09 23:34:13 2019 +0000
+++ b/sys/compat/linux/arch/i386/syscalls.master        Sat Nov 09 23:44:31 2019 +0000
@@ -1,4 +1,4 @@
-       $NetBSD: syscalls.master,v 1.122 2017/01/02 16:32:09 manu Exp $
+       $NetBSD: syscalls.master,v 1.123 2019/11/09 23:44:32 jdolecek Exp $
 
 ;      @(#)syscalls.master     8.1 (Berkeley) 7/19/93
 
@@ -528,7 +528,8 @@
 321    UNIMPL          signalfd
 322    UNIMPL          timerfd_create
 323    UNIMPL          eventfd
-324    UNIMPL          fallocate
+324    STD             { int|linux_sys||fallocate(int fd, int mode, \
+                           off_t offset, off_t len); }
 325    UNIMPL          timerfd_settime
 326    UNIMPL          timerfd_gettime
 327    UNIMPL          signalfd4
diff -r 911181ae0540 -r 1090757a6f78 sys/compat/linux/arch/m68k/syscalls.master
--- a/sys/compat/linux/arch/m68k/syscalls.master        Sat Nov 09 23:34:13 2019 +0000
+++ b/sys/compat/linux/arch/m68k/syscalls.master        Sat Nov 09 23:44:31 2019 +0000
@@ -1,4 +1,4 @@
-       $NetBSD: syscalls.master,v 1.93 2017/02/03 16:44:12 christos Exp $
+       $NetBSD: syscalls.master,v 1.94 2019/11/09 23:44:32 jdolecek Exp $
 
 ;      @(#)syscalls.master     8.1 (Berkeley) 7/19/93
 
@@ -541,7 +541,8 @@
 317    UNIMPL          signalfd
 318    UNIMPL          timerfd_create
 319    UNIMPL          eventfd
-320    UNIMPL          fallocate
+320    STD             { int|linux_sys||fallocate(int fd, int mode, \
+                           off_t offset, off_t len); }
 321    UNIMPL          timerfd_settime
 322    UNIMPL          timerfd_gettime
 323    UNIMPL          signalfd4
diff -r 911181ae0540 -r 1090757a6f78 sys/compat/linux/arch/mips/syscalls.master
--- a/sys/compat/linux/arch/mips/syscalls.master        Sat Nov 09 23:34:13 2019 +0000
+++ b/sys/compat/linux/arch/mips/syscalls.master        Sat Nov 09 23:44:31 2019 +0000
@@ -1,4 +1,4 @@
-       $NetBSD: syscalls.master,v 1.66 2017/02/09 22:02:05 christos Exp $  
+       $NetBSD: syscalls.master,v 1.67 2019/11/09 23:44:32 jdolecek Exp $  
 
 ;      @(#)syscalls.master     8.1 (Berkeley) 7/19/93
 
@@ -529,7 +529,8 @@
 317    UNIMPL          signalfd
 318    UNIMPL          timerfd
 319    UNIMPL          eventfd
-320    UNIMPL          fallocate
+320    STD             { int|linux_sys||fallocate(int fd, int mode, \
+                           off_t offset, off_t len); }
 321    UNIMPL          timerfd_create
 322    UNIMPL          timerfd_gettime
 323    UNIMPL          timerfd_settime
diff -r 911181ae0540 -r 1090757a6f78 sys/compat/linux/arch/powerpc/syscalls.master
--- a/sys/compat/linux/arch/powerpc/syscalls.master     Sat Nov 09 23:34:13 2019 +0000
+++ b/sys/compat/linux/arch/powerpc/syscalls.master     Sat Nov 09 23:44:31 2019 +0000
@@ -1,4 +1,4 @@
-       $NetBSD: syscalls.master,v 1.72 2017/02/03 16:56:46 christos Exp $  
+       $NetBSD: syscalls.master,v 1.73 2019/11/09 23:44:32 jdolecek Exp $  
 
 ;      @(#)syscalls.master     8.1 (Berkeley) 7/19/93
 
@@ -528,7 +528,8 @@
 306    UNIMPL          timerfd_create
 307    UNIMPL          eventfd
 308    UNIMPL          sync_file_range2
-309    UNIMPL          fallocate
+309    STD             { int|linux_sys||fallocate(int fd, int mode, \
+                           off_t offset, off_t len); }
 310    UNIMPL          subpage_prot
 311    UNIMPL          timerfd_settime
 312    UNIMPL          timerfd_gettime
diff -r 911181ae0540 -r 1090757a6f78 sys/compat/linux/common/linux_file.c
--- a/sys/compat/linux/common/linux_file.c      Sat Nov 09 23:34:13 2019 +0000
+++ b/sys/compat/linux/common/linux_file.c      Sat Nov 09 23:44:31 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_file.c,v 1.116 2019/06/18 22:34:25 kamil Exp $   */
+/*     $NetBSD: linux_file.c,v 1.117 2019/11/09 23:44:32 jdolecek Exp $        */
 
 /*-
  * Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.116 2019/06/18 22:34:25 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.117 2019/11/09 23:44:32 jdolecek Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -844,3 +844,11 @@
 LINUX_NOT_SUPPORTED(linux_sys_removexattr)
 LINUX_NOT_SUPPORTED(linux_sys_lremovexattr)
 LINUX_NOT_SUPPORTED(linux_sys_fremovexattr)
+
+/*
+ * For now just return EOPNOTSUPP, this makes glibc posix_fallocate()
+ * to fallback to emulation.
+ * XXX Right now no filesystem actually implements fallocate support,
+ * so no need for mapping.
+ */
+LINUX_NOT_SUPPORTED(linux_sys_fallocate)
diff -r 911181ae0540 -r 1090757a6f78 sys/compat/linux32/arch/amd64/syscalls.master
--- a/sys/compat/linux32/arch/amd64/syscalls.master     Sat Nov 09 23:34:13 2019 +0000
+++ b/sys/compat/linux32/arch/amd64/syscalls.master     Sat Nov 09 23:44:31 2019 +0000
@@ -1,4 +1,4 @@
-       $NetBSD: syscalls.master,v 1.69 2015/03/08 17:10:44 christos Exp $
+       $NetBSD: syscalls.master,v 1.70 2019/11/09 23:44:31 jdolecek Exp $
 
 ; NetBSD i386 COMPAT_LINUX32 system call name/number "master" file.
 ; (See syscalls.conf to see what it is processed into.)
@@ -543,7 +543,8 @@
 321    UNIMPL  signalfd
 322    UNIMPL  timerfd_create
 323    UNIMPL  eventfd
-324    UNIMPL  fallocate
+324    STD     { int|linux32_sys||fallocate(int fd, int mode, \
+                           off_t offset, off_t len); }
 325    UNIMPL  timerfd_settime
 326    UNIMPL  timerfd_gettime
 327    UNIMPL  signalfd4
diff -r 911181ae0540 -r 1090757a6f78 sys/compat/linux32/common/linux32_unistd.c
--- a/sys/compat/linux32/common/linux32_unistd.c        Sat Nov 09 23:34:13 2019 +0000
+++ b/sys/compat/linux32/common/linux32_unistd.c        Sat Nov 09 23:44:31 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux32_unistd.c,v 1.41 2019/09/20 15:25:19 kamil Exp $ */
+/*     $NetBSD: linux32_unistd.c,v 1.42 2019/11/09 23:44:31 jdolecek Exp $ */
 
 /*-
  * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
@@ -33,7 +33,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: linux32_unistd.c,v 1.41 2019/09/20 15:25:19 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_unistd.c,v 1.42 2019/11/09 23:44:31 jdolecek Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -734,3 +734,19 @@
 
        return sys_pwrite(l, &pra, retval);
 }
+
+/*
+ * fallocate(2)
+ */
+int
+linux32_sys_fallocate(struct lwp *l,
+    const struct linux32_sys_fallocate_args *uap, register_t *retval)
+{
+       /*
+        * For now just return EOPNOTSUPP, this makes glibc posix_fallocate()
+        * to fallback to emulation.
+        * XXX Right now no filesystem actually implements fallocate support,
+        * so no need for mapping.
+        */
+       return EOPNOTSUPP;
+}



Home | Main Index | Thread Index | Old Index