Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Jul 2020 11:28:40 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r363304 - in head/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux
Message-ID:  <202007181128.06IBSegr022504@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Sat Jul 18 11:28:40 2020
New Revision: 363304
URL: https://svnweb.freebsd.org/changeset/base/363304

Log:
  Add a trivial linux(4) splice(2) implementation, which simply
  returns EINVAL.  Fixes grep (grep-3.1-2build1).
  
  PR:		kern/218699
  Reported by:	avos
  Reviewed by:	emaste
  MFC after:	2 weeks
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D25636

Modified:
  head/sys/amd64/linux/linux_dummy.c
  head/sys/amd64/linux/syscalls.master
  head/sys/amd64/linux32/linux32_dummy.c
  head/sys/amd64/linux32/syscalls.master
  head/sys/arm64/linux/linux_dummy.c
  head/sys/arm64/linux/syscalls.master
  head/sys/compat/linux/linux_file.c
  head/sys/i386/linux/linux_dummy.c
  head/sys/i386/linux/syscalls.master

Modified: head/sys/amd64/linux/linux_dummy.c
==============================================================================
--- head/sys/amd64/linux/linux_dummy.c	Sat Jul 18 10:56:04 2020	(r363303)
+++ head/sys/amd64/linux/linux_dummy.c	Sat Jul 18 11:28:40 2020	(r363304)
@@ -105,7 +105,6 @@ DUMMY(inotify_rm_watch);
 DUMMY(migrate_pages);
 DUMMY(unshare);
 /* Linux 2.6.17: */
-DUMMY(splice);
 DUMMY(tee);
 DUMMY(vmsplice);
 /* Linux 2.6.18: */

Modified: head/sys/amd64/linux/syscalls.master
==============================================================================
--- head/sys/amd64/linux/syscalls.master	Sat Jul 18 10:56:04 2020	(r363303)
+++ head/sys/amd64/linux/syscalls.master	Sat Jul 18 11:28:40 2020	(r363304)
@@ -1612,7 +1612,14 @@
 		);
 	}
 275	AUE_NULL	STD {
-		int linux_splice(void);
+		int linux_splice(
+		    int fd_in,
+		    l_loff_t *off_in,
+		    int fd_out,
+		    l_loff_t *off_out,
+		    l_size_t len,
+		    l_uint flags
+		);
 	}
 276	AUE_NULL	STD {
 		int linux_tee(void);

Modified: head/sys/amd64/linux32/linux32_dummy.c
==============================================================================
--- head/sys/amd64/linux32/linux32_dummy.c	Sat Jul 18 10:56:04 2020	(r363303)
+++ head/sys/amd64/linux32/linux32_dummy.c	Sat Jul 18 11:28:40 2020	(r363304)
@@ -102,7 +102,6 @@ DUMMY(inotify_rm_watch);
 DUMMY(migrate_pages);
 DUMMY(unshare);
 /* Linux 2.6.17: */
-DUMMY(splice);
 DUMMY(tee);
 DUMMY(vmsplice);
 /* Linux 2.6.18: */

Modified: head/sys/amd64/linux32/syscalls.master
==============================================================================
--- head/sys/amd64/linux32/syscalls.master	Sat Jul 18 10:56:04 2020	(r363303)
+++ head/sys/amd64/linux32/syscalls.master	Sat Jul 18 11:28:40 2020	(r363304)
@@ -1731,7 +1731,14 @@
 		);
 	}
 313	AUE_NULL	STD {
-		int linux_splice(void);
+		int linux_splice(
+		    int fd_in,
+		    l_loff_t *off_in,
+		    int fd_out,
+		    l_loff_t *off_out,
+		    l_size_t len,
+		    l_uint flags
+		);
 	}
 314	AUE_NULL	STD {
 		int linux_sync_file_range(

Modified: head/sys/arm64/linux/linux_dummy.c
==============================================================================
--- head/sys/arm64/linux/linux_dummy.c	Sat Jul 18 10:56:04 2020	(r363303)
+++ head/sys/arm64/linux/linux_dummy.c	Sat Jul 18 11:28:40 2020	(r363304)
@@ -98,7 +98,6 @@ DUMMY(inotify_rm_watch);
 DUMMY(migrate_pages);
 DUMMY(unshare);
 /* Linux 2.6.17: */
-DUMMY(splice);
 DUMMY(tee);
 DUMMY(vmsplice);
 /* Linux 2.6.18: */

Modified: head/sys/arm64/linux/syscalls.master
==============================================================================
--- head/sys/arm64/linux/syscalls.master	Sat Jul 18 10:56:04 2020	(r363303)
+++ head/sys/arm64/linux/syscalls.master	Sat Jul 18 11:28:40 2020	(r363304)
@@ -467,7 +467,14 @@
 		int linux_vmsplice(void);
 	}
 76	AUE_NULL	STD	{
-		int linux_splice(void);
+		int linux_splice(
+		    int fd_in,
+		    l_loff_t *off_in,
+		    int fd_out,
+		    l_loff_t *off_out,
+		    l_size_t len,
+		    l_uint flags
+		);
 	}
 77	AUE_NULL	STD	{
 		int linux_tee(void);

Modified: head/sys/compat/linux/linux_file.c
==============================================================================
--- head/sys/compat/linux/linux_file.c	Sat Jul 18 10:56:04 2020	(r363303)
+++ head/sys/compat/linux/linux_file.c	Sat Jul 18 11:28:40 2020	(r363304)
@@ -1766,3 +1766,17 @@ linux_memfd_create(struct thread *td, struct linux_mem
 	return (kern_shm_open2(td, SHM_ANON, oflags, 0, shmflags, NULL,
 	    memfd_name));
 }
+
+int
+linux_splice(struct thread *td, struct linux_splice_args *args)
+{
+
+	linux_msg(td, "syscall splice not really implemented");
+
+	/*
+	 * splice(2) is documented to return EINVAL in various circumstances;
+	 * returning it instead of ENOSYS should hint the caller to use fallback
+	 * instead.
+	 */
+	return (EINVAL);
+}

Modified: head/sys/i386/linux/linux_dummy.c
==============================================================================
--- head/sys/i386/linux/linux_dummy.c	Sat Jul 18 10:56:04 2020	(r363303)
+++ head/sys/i386/linux/linux_dummy.c	Sat Jul 18 11:28:40 2020	(r363304)
@@ -98,7 +98,6 @@ DUMMY(inotify_rm_watch);
 DUMMY(migrate_pages);
 DUMMY(unshare);
 /* Linux 2.6.17: */
-DUMMY(splice);
 DUMMY(tee);
 DUMMY(vmsplice);
 /* Linux 2.6.18: */

Modified: head/sys/i386/linux/syscalls.master
==============================================================================
--- head/sys/i386/linux/syscalls.master	Sat Jul 18 10:56:04 2020	(r363303)
+++ head/sys/i386/linux/syscalls.master	Sat Jul 18 11:28:40 2020	(r363304)
@@ -1753,7 +1753,14 @@
 		);
 	}
 313	AUE_NULL	STD {
-		int linux_splice(void);
+		int linux_splice(
+		    int fd_in,
+		    l_loff_t *off_in,
+		    int fd_out,
+		    l_loff_t *off_out,
+		    l_size_t len,
+		    l_uint flags
+		);
 	}
 314	AUE_NULL	STD {
 		int linux_sync_file_range(



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202007181128.06IBSegr022504>