]> xenbits.xensource.com Git - freebsd.git/commitdiff
linux: add trivial renameat2 implementation
authoremaste <emaste@FreeBSD.org>
Wed, 11 Sep 2019 13:01:59 +0000 (13:01 +0000)
committeremaste <emaste@FreeBSD.org>
Wed, 11 Sep 2019 13:01:59 +0000 (13:01 +0000)
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

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

index 56c20bb26fecec4dbe7f0ea2f33aea549362722d..7894c0c8484b78605a2836949ea4e2be9b27174a 100644 (file)
@@ -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);
index 9de0c99a3fcee159629b998e4e8d9865ff1c4100..eccb7035da02b48026f0b0fb9911489a76fed62b 100644 (file)
@@ -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);
index da9b690384495cddac06ee2d837a0803d5fc4ad4..d7f3f252fc22aa76d5927a6c36decb5ef7dfa1a6 100644 (file)
@@ -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);
index 67a606896c6e9d90101b2eef3dfab9162a449105..463495175e252167c7eaece8e4ab61cbd2428d53 100644 (file)
@@ -685,10 +685,30 @@ linux_rename(struct thread *td, struct linux_rename_args *args)
 
 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;
        LCONVPATHEXIST_AT(td, args->oldname, &from, olddfd);
index 31212de7fab5a6274dfe2080160c8442fc8fa3f7..cd385f43f4a60e80e71065eb73281bb965afca20 100644 (file)
@@ -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: */