1570af302Sopenharmony_ci#include <stdio.h> 2570af302Sopenharmony_ci#include <fcntl.h> 3570af302Sopenharmony_ci#include "syscall.h" 4570af302Sopenharmony_ci 5570af302Sopenharmony_ciint rename(const char *old, const char *new) 6570af302Sopenharmony_ci{ 7570af302Sopenharmony_ci#if defined(SYS_rename) 8570af302Sopenharmony_ci return syscall(SYS_rename, old, new); 9570af302Sopenharmony_ci#elif defined(SYS_renameat) 10570af302Sopenharmony_ci return syscall(SYS_renameat, AT_FDCWD, old, AT_FDCWD, new); 11570af302Sopenharmony_ci#else 12570af302Sopenharmony_ci return syscall(SYS_renameat2, AT_FDCWD, old, AT_FDCWD, new, 0); 13570af302Sopenharmony_ci#endif 14570af302Sopenharmony_ci} 15