svn commit: r352210 - in head/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux

Ed Maste emaste at FreeBSD.org
Wed Sep 11 13:02:01 UTC 2019


Author: emaste
Date: Wed Sep 11 13:01:59 2019
New Revision: 352210
URL: https://svnweb.freebsd.org/changeset/base/352210

Log:
  linux: add trivial renameat2 implementation
  
  Just return EINVAL if flags != 0.  The Linux man page documents one
  case of EINVAL as "The filesystem does not support one of the flags in
  flags."
  
  After r351723 userland binaries will try using new system calls.
  
  Reported by:	mjg
  Reviewed by:	mjg, trasz
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D21590

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

Modified: head/sys/amd64/linux/linux_dummy.c
==============================================================================
--- head/sys/amd64/linux/linux_dummy.c	Wed Sep 11 12:58:53 2019	(r352209)
+++ head/sys/amd64/linux/linux_dummy.c	Wed Sep 11 13:01:59 2019	(r352210)
@@ -130,8 +130,6 @@ DUMMY(kcmp);
 DUMMY(finit_module);
 DUMMY(sched_setattr);
 DUMMY(sched_getattr);
-/* Linux 3.14: */
-DUMMY(renameat2);
 /* Linux 3.15: */
 DUMMY(seccomp);
 DUMMY(memfd_create);

Modified: head/sys/amd64/linux32/linux32_dummy.c
==============================================================================
--- head/sys/amd64/linux32/linux32_dummy.c	Wed Sep 11 12:58:53 2019	(r352209)
+++ head/sys/amd64/linux32/linux32_dummy.c	Wed Sep 11 13:01:59 2019	(r352210)
@@ -137,8 +137,6 @@ DUMMY(kcmp);
 DUMMY(finit_module);
 DUMMY(sched_setattr);
 DUMMY(sched_getattr);
-/* Linux 3.14: */
-DUMMY(renameat2);
 /* Linux 3.15: */
 DUMMY(seccomp);
 DUMMY(memfd_create);

Modified: head/sys/arm64/linux/linux_dummy.c
==============================================================================
--- head/sys/arm64/linux/linux_dummy.c	Wed Sep 11 12:58:53 2019	(r352209)
+++ head/sys/arm64/linux/linux_dummy.c	Wed Sep 11 13:01:59 2019	(r352210)
@@ -130,8 +130,6 @@ DUMMY(kcmp);
 DUMMY(finit_module);
 DUMMY(sched_setattr);
 DUMMY(sched_getattr);
-/* Linux 3.14: */
-DUMMY(renameat2);
 /* Linux 3.15: */
 DUMMY(seccomp);
 DUMMY(memfd_create);

Modified: head/sys/compat/linux/linux_file.c
==============================================================================
--- head/sys/compat/linux/linux_file.c	Wed Sep 11 12:58:53 2019	(r352209)
+++ head/sys/compat/linux/linux_file.c	Wed Sep 11 13:01:59 2019	(r352210)
@@ -686,8 +686,28 @@ linux_rename(struct thread *td, struct linux_rename_ar
 int
 linux_renameat(struct thread *td, struct linux_renameat_args *args)
 {
+	struct linux_renameat2_args renameat2_args = {
+	    .olddfd = args->olddfd,
+	    .oldname = args->oldname,
+	    .newdfd = args->newdfd,
+	    .newname = args->newname,
+	    .flags = 0
+	};
+
+	return (linux_renameat2(td, &renameat2_args));
+}
+
+int
+linux_renameat2(struct thread *td, struct linux_renameat2_args *args)
+{
 	char *from, *to;
 	int error, olddfd, newdfd;
+
+	if (args->flags != 0) {
+		linux_msg(td, "renameat2 unsupported flags 0x%x\n",
+		    args->flags);
+		return (EINVAL);
+	}
 
 	olddfd = (args->olddfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->olddfd;
 	newdfd = (args->newdfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->newdfd;

Modified: head/sys/i386/linux/linux_dummy.c
==============================================================================
--- head/sys/i386/linux/linux_dummy.c	Wed Sep 11 12:58:53 2019	(r352209)
+++ head/sys/i386/linux/linux_dummy.c	Wed Sep 11 13:01:59 2019	(r352210)
@@ -134,8 +134,6 @@ DUMMY(finit_module);
 DUMMY(sched_setattr);
 DUMMY(sched_getattr);
 /* Linux 3.14: */
-DUMMY(renameat2);
-/* Linux 3.15: */
 DUMMY(seccomp);
 DUMMY(memfd_create);
 /* Linux 3.18: */


More information about the svn-src-all mailing list