Rewrite renameat().
risc-v doesn't have renameat(2), only renameat2(2). Similar to other
architectures, let's make sure everyone's on the same code path by
having all implementations of renameat() go via renameat2().
I've also moved the existing rename()-in-terms-of-renameat() to be in
terms of renameat2() to cut out the middleman!
Test: treehugger
Change-Id: Ibe5e69aca5b39ea014001540bcd4fd3003e665cb
diff --git a/libc/SYSCALLS.TXT b/libc/SYSCALLS.TXT
index 9aeb07c..fe01ab9 100644
--- a/libc/SYSCALLS.TXT
+++ b/libc/SYSCALLS.TXT
@@ -156,7 +156,6 @@
int mkdirat(int, const char*, mode_t) all
int mknodat(int, const char*, mode_t, dev_t) all
int readlinkat(int, const char*, char*, size_t) all
-int renameat(int, const char*, int, const char*) all
int renameat2(int, const char*, int, const char*, unsigned) all
int symlinkat(const char*, int, const char*) all
int unlinkat(int, const char*, int) all
diff --git a/libc/bionic/rename.cpp b/libc/bionic/rename.cpp
index 8295559..89786f7 100644
--- a/libc/bionic/rename.cpp
+++ b/libc/bionic/rename.cpp
@@ -30,5 +30,9 @@
#include <stdio.h>
int rename(const char* old_path, const char* new_path) {
- return renameat(AT_FDCWD, old_path, AT_FDCWD, new_path);
+ return renameat2(AT_FDCWD, old_path, AT_FDCWD, new_path, 0);
+}
+
+int renameat(int old_dir_fd, const char* old_path, int new_dir_fd, const char* new_path) {
+ return renameat2(old_dir_fd, old_path, new_dir_fd, new_path, 0);
}