The branch main has been updated by kib:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=8feb8d221cfb842ee11d744d22571baec6c18cd8

commit 8feb8d221cfb842ee11d744d22571baec6c18cd8
Author:     Konstantin Belousov <[email protected]>
AuthorDate: 2026-02-26 19:21:08 +0000
Commit:     Konstantin Belousov <[email protected]>
CommitDate: 2026-03-05 23:46:53 +0000

    linuxolator: translate LINUX_RENAME_NOREPLACE into our AT_RENAME_NOREPLACE
    
    Reviewed by:    markj
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D55539
---
 sys/compat/linux/linux_file.c | 35 +++++++++++++++++++++++------------
 1 file changed, 23 insertions(+), 12 deletions(-)

diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c
index 43ccac0308d3..30e79a53ad2a 100644
--- a/sys/compat/linux/linux_file.c
+++ b/sys/compat/linux/linux_file.c
@@ -833,23 +833,34 @@ int
 linux_renameat2(struct thread *td, struct linux_renameat2_args *args)
 {
        int olddfd, newdfd;
+       u_int atflags;
 
-       if (args->flags != 0) {
-               if (args->flags & ~(LINUX_RENAME_EXCHANGE |
-                   LINUX_RENAME_NOREPLACE | LINUX_RENAME_WHITEOUT))
-                       return (EINVAL);
-               if (args->flags & LINUX_RENAME_EXCHANGE &&
-                   args->flags & (LINUX_RENAME_NOREPLACE |
-                   LINUX_RENAME_WHITEOUT))
+       atflags = 0;
+       if ((args->flags & ~(LINUX_RENAME_EXCHANGE |
+           LINUX_RENAME_NOREPLACE | LINUX_RENAME_WHITEOUT)) != 0)
+               return (EINVAL);
+       if ((args->flags & LINUX_RENAME_EXCHANGE) != 0 &&
+           (args->flags & (LINUX_RENAME_NOREPLACE |
+           LINUX_RENAME_WHITEOUT)) != 0)
+               return (EINVAL);
+       if ((args->flags & LINUX_RENAME_NOREPLACE) != 0) {
+               if ((args->flags & (LINUX_RENAME_EXCHANGE |
+                   LINUX_RENAME_WHITEOUT)) != 0)
                        return (EINVAL);
-#if 0
+               args->flags &= ~LINUX_RENAME_NOREPLACE;
+               atflags |= AT_RENAME_NOREPLACE;
+       }
+
+       if (args->flags != 0) {
                /*
                 * This spams the console on Ubuntu Focal.
                 *
-                * What's needed here is a general mechanism to let users know
-                * about missing features without hogging the system.
+                * What's needed here is a general mechanism to let
+                * users know about missing features without hogging
+                * the system.
                 */
-               linux_msg(td, "renameat2 unsupported flags 0x%x",
+#if 0
+               linux_msg(td, "renameat2 unsupported flags %#x",
                    args->flags);
 #endif
                return (EINVAL);
@@ -858,7 +869,7 @@ linux_renameat2(struct thread *td, struct 
linux_renameat2_args *args)
        olddfd = (args->olddfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->olddfd;
        newdfd = (args->newdfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->newdfd;
        return (kern_renameat(td, olddfd, args->oldname, newdfd,
-           args->newname, UIO_USERSPACE, 0));
+           args->newname, UIO_USERSPACE, atflags));
 }
 
 #ifdef LINUX_LEGACY_SYSCALLS

Reply via email to