提交 54316a52 编写于 作者: D Drew DeVault 提交者: Rich Felker

support archs with no renameat syscall, only renameat2

上级 46fb680c
...@@ -4,9 +4,11 @@ ...@@ -4,9 +4,11 @@
int rename(const char *old, const char *new) int rename(const char *old, const char *new)
{ {
#ifdef SYS_rename #if defined(SYS_rename)
return syscall(SYS_rename, old, new); return syscall(SYS_rename, old, new);
#else #elif defined(SYS_renameat)
return syscall(SYS_renameat, AT_FDCWD, old, AT_FDCWD, new); return syscall(SYS_renameat, AT_FDCWD, old, AT_FDCWD, new);
#else
return syscall(SYS_renameat2, AT_FDCWD, old, AT_FDCWD, new, 0);
#endif #endif
} }
...@@ -3,5 +3,9 @@ ...@@ -3,5 +3,9 @@
int renameat(int oldfd, const char *old, int newfd, const char *new) int renameat(int oldfd, const char *old, int newfd, const char *new)
{ {
#ifdef SYS_renameat
return syscall(SYS_renameat, oldfd, old, newfd, new); return syscall(SYS_renameat, oldfd, old, newfd, new);
#else
return syscall(SYS_renameat2, oldfd, old, newfd, new, 0);
#endif
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册