MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / sys_rename

Function sys_rename

components/lwp/lwp_syscall.c:8265–8285  ·  view source on GitHub ↗

* @brief Rename or move a file or directory. * * This function renames or moves a file or directory from `oldpath` to `newpath`. * If the `newpath` exists, it may be overwritten depending on the system's file system behavior and * the permissions of the files involved. * * @param[in] oldpath The current path of the file or directory to rename or move. * @param[in] newpath The new path or

Source from the content-addressed store, hash-verified

8263 * @see sys_unlink(), sys_mkdir(), sys_access()
8264 */
8265sysret_t sys_rename(const char *oldpath, const char *newpath)
8266{
8267 int ret = -1;
8268#ifdef ARCH_MM_MMU
8269 int err;
8270
8271 err = lwp_user_strlen(oldpath);
8272 if (err <= 0)
8273 {
8274 return -EFAULT;
8275 }
8276
8277 err = lwp_user_strlen(newpath);
8278 if (err <= 0)
8279 {
8280 return -EFAULT;
8281 }
8282#endif
8283 ret = rename(oldpath, newpath);
8284 return (ret < 0 ? GET_ERRNO() : ret);
8285}
8286
8287typedef unsigned long long rlim_t;
8288

Callers

nothing calls this directly

Calls 2

lwp_user_strlenFunction · 0.85
renameFunction · 0.50

Tested by

no test coverage detected