Module Name:    src
Committed By:   jdolecek
Date:           Sat Nov  9 23:44:32 UTC 2019

Modified Files:
        src/sys/compat/linux/arch/alpha: syscalls.master
        src/sys/compat/linux/arch/amd64: syscalls.master
        src/sys/compat/linux/arch/arm: syscalls.master
        src/sys/compat/linux/arch/i386: syscalls.master
        src/sys/compat/linux/arch/m68k: syscalls.master
        src/sys/compat/linux/arch/mips: syscalls.master
        src/sys/compat/linux/arch/powerpc: syscalls.master
        src/sys/compat/linux/common: linux_file.c
        src/sys/compat/linux32/arch/amd64: syscalls.master
        src/sys/compat/linux32/common: linux32_unistd.c

Log Message:
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


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/sys/compat/linux/arch/alpha/syscalls.master
cvs rdiff -u -r1.60 -r1.61 src/sys/compat/linux/arch/amd64/syscalls.master
cvs rdiff -u -r1.67 -r1.68 src/sys/compat/linux/arch/arm/syscalls.master
cvs rdiff -u -r1.122 -r1.123 src/sys/compat/linux/arch/i386/syscalls.master
cvs rdiff -u -r1.93 -r1.94 src/sys/compat/linux/arch/m68k/syscalls.master
cvs rdiff -u -r1.66 -r1.67 src/sys/compat/linux/arch/mips/syscalls.master
cvs rdiff -u -r1.72 -r1.73 src/sys/compat/linux/arch/powerpc/syscalls.master
cvs rdiff -u -r1.116 -r1.117 src/sys/compat/linux/common/linux_file.c
cvs rdiff -u -r1.69 -r1.70 src/sys/compat/linux32/arch/amd64/syscalls.master
cvs rdiff -u -r1.41 -r1.42 src/sys/compat/linux32/common/linux32_unistd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/linux/arch/alpha/syscalls.master
diff -u src/sys/compat/linux/arch/alpha/syscalls.master:1.95 src/sys/compat/linux/arch/alpha/syscalls.master:1.96
--- src/sys/compat/linux/arch/alpha/syscalls.master:1.95	Sun Mar 24 16:24:19 2019
+++ src/sys/compat/linux/arch/alpha/syscalls.master	Sat Nov  9 23:44:31 2019
@@ -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

Index: src/sys/compat/linux/arch/amd64/syscalls.master
diff -u src/sys/compat/linux/arch/amd64/syscalls.master:1.60 src/sys/compat/linux/arch/amd64/syscalls.master:1.61
--- src/sys/compat/linux/arch/amd64/syscalls.master:1.60	Fri Feb  3 16:18:19 2017
+++ src/sys/compat/linux/arch/amd64/syscalls.master	Sat Nov  9 23:44:31 2019
@@ -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, \

Index: src/sys/compat/linux/arch/arm/syscalls.master
diff -u src/sys/compat/linux/arch/arm/syscalls.master:1.67 src/sys/compat/linux/arch/arm/syscalls.master:1.68
--- src/sys/compat/linux/arch/arm/syscalls.master:1.67	Fri Feb  3 16:28:34 2017
+++ src/sys/compat/linux/arch/arm/syscalls.master	Sat Nov  9 23:44:31 2019
@@ -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

Index: src/sys/compat/linux/arch/i386/syscalls.master
diff -u src/sys/compat/linux/arch/i386/syscalls.master:1.122 src/sys/compat/linux/arch/i386/syscalls.master:1.123
--- src/sys/compat/linux/arch/i386/syscalls.master:1.122	Mon Jan  2 16:32:09 2017
+++ src/sys/compat/linux/arch/i386/syscalls.master	Sat Nov  9 23:44:32 2019
@@ -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

Index: src/sys/compat/linux/arch/m68k/syscalls.master
diff -u src/sys/compat/linux/arch/m68k/syscalls.master:1.93 src/sys/compat/linux/arch/m68k/syscalls.master:1.94
--- src/sys/compat/linux/arch/m68k/syscalls.master:1.93	Fri Feb  3 16:44:12 2017
+++ src/sys/compat/linux/arch/m68k/syscalls.master	Sat Nov  9 23:44:32 2019
@@ -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

Index: src/sys/compat/linux/arch/mips/syscalls.master
diff -u src/sys/compat/linux/arch/mips/syscalls.master:1.66 src/sys/compat/linux/arch/mips/syscalls.master:1.67
--- src/sys/compat/linux/arch/mips/syscalls.master:1.66	Thu Feb  9 22:02:05 2017
+++ src/sys/compat/linux/arch/mips/syscalls.master	Sat Nov  9 23:44:32 2019
@@ -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

Index: src/sys/compat/linux/arch/powerpc/syscalls.master
diff -u src/sys/compat/linux/arch/powerpc/syscalls.master:1.72 src/sys/compat/linux/arch/powerpc/syscalls.master:1.73
--- src/sys/compat/linux/arch/powerpc/syscalls.master:1.72	Fri Feb  3 16:56:46 2017
+++ src/sys/compat/linux/arch/powerpc/syscalls.master	Sat Nov  9 23:44:32 2019
@@ -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

Index: src/sys/compat/linux/common/linux_file.c
diff -u src/sys/compat/linux/common/linux_file.c:1.116 src/sys/compat/linux/common/linux_file.c:1.117
--- src/sys/compat/linux/common/linux_file.c:1.116	Tue Jun 18 22:34:25 2019
+++ src/sys/compat/linux/common/linux_file.c	Sat Nov  9 23:44:32 2019
@@ -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_flistxattr
 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)

Index: src/sys/compat/linux32/arch/amd64/syscalls.master
diff -u src/sys/compat/linux32/arch/amd64/syscalls.master:1.69 src/sys/compat/linux32/arch/amd64/syscalls.master:1.70
--- src/sys/compat/linux32/arch/amd64/syscalls.master:1.69	Sun Mar  8 17:10:44 2015
+++ src/sys/compat/linux32/arch/amd64/syscalls.master	Sat Nov  9 23:44:31 2019
@@ -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

Index: src/sys/compat/linux32/common/linux32_unistd.c
diff -u src/sys/compat/linux32/common/linux32_unistd.c:1.41 src/sys/compat/linux32/common/linux32_unistd.c:1.42
--- src/sys/compat/linux32/common/linux32_unistd.c:1.41	Fri Sep 20 15:25:19 2019
+++ src/sys/compat/linux32/common/linux32_unistd.c	Sat Nov  9 23:44:31 2019
@@ -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 @@ linux32_sys_pwrite(struct lwp *l,
 
 	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;
+}

Reply via email to