The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=28599a1e5f1b90676a818e0a4818cddd0839ad25
commit 28599a1e5f1b90676a818e0a4818cddd0839ad25 Author: Konstantin Belousov <[email protected]> AuthorDate: 2026-02-26 18:33:33 +0000 Commit: Konstantin Belousov <[email protected]> CommitDate: 2026-03-05 23:46:53 +0000 sys: add renameat2(2) syscall Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D55539 --- include/stdio.h | 1 + lib/libsys/Symbol.sys.map | 1 + sys/kern/syscalls.master | 10 +++++++++- sys/kern/vfs_syscalls.c | 10 ++++++++++ 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/include/stdio.h b/include/stdio.h index 34e877b60c14..753c7f3df03f 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -398,6 +398,7 @@ int fdclose(FILE *, int *); char *fgetln(FILE *, size_t *); const char *fmtcheck(const char *, const char *) __format_arg(2); int fpurge(FILE *); +int renameat2(int, const char *, int, const char *, unsigned int); void setbuffer(FILE *, char *, int); int setlinebuf(FILE *); int vasprintf(char **, const char *, __va_list) diff --git a/lib/libsys/Symbol.sys.map b/lib/libsys/Symbol.sys.map index 46767f5b6a4d..7f5c252af91b 100644 --- a/lib/libsys/Symbol.sys.map +++ b/lib/libsys/Symbol.sys.map @@ -393,6 +393,7 @@ FBSD_1.8 { FBSD_1.9 { pdrfork; pdrfork_thread; + renameat2; }; FBSDprivate_1.0 { diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index 8a30e5931a0e..b3e1d4be9fee 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -3420,5 +3420,13 @@ _Out_opt_ _Contains_long_ptr_ struct __siginfo *info ); } - +602 AUE_RENAMEAT STD|CAPENABLED { + int renameat2( + int oldfd, + _In_z_ const char *old, + int newfd, + _In_z_ const char *new, + int flags + ); + } ; vim: syntax=off diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 4409b0295587..20780334a6b5 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -3739,6 +3739,14 @@ sys_renameat(struct thread *td, struct renameat_args *uap) UIO_USERSPACE, 0)); } +int +sys_renameat2(struct thread *td, struct renameat2_args *uap) +{ + + return (kern_renameat(td, uap->oldfd, uap->old, uap->newfd, uap->new, + UIO_USERSPACE, uap->flags)); +} + #ifdef MAC static int kern_renameat_mac(struct thread *td, int oldfd, const char *old, int newfd, @@ -3775,6 +3783,8 @@ kern_renameat(struct thread *td, int oldfd, const char *old, int newfd, int error; short irflag; + if (flags != 0) + return (EINVAL); again: tmp = mp = NULL; bwillwrite();
