#include "src/stdio/rename.h"
#include "include/llvm-libc-macros/linux/fcntl-macros.h"
#include "src/__support/OSUtil/syscall.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
#include "src/errno/libc_errno.h"
#include <sys/syscall.h>
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(int, rename, (const char *oldpath, const char *newpath)) {
int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_renameat2, AT_FDCWD, oldpath,
AT_FDCWD, newpath, 0);
if (ret >= 0)
return 0;
libc_errno = -ret;
return -1;
}
}