| 712 | } |
| 713 | |
| 714 | long SysRename(regs64_t* r){ |
| 715 | char* oldpath = (char*)SC_ARG0(r); |
| 716 | char* newpath = (char*)SC_ARG1(r); |
| 717 | |
| 718 | process_t* proc = Scheduler::GetCurrentProcess(); |
| 719 | |
| 720 | if(!Memory::CheckUsermodePointer(SC_ARG0(r), 0, proc->addressSpace)){ |
| 721 | Log::Warning("sys_rename: Invalid oldpath pointer %x", SC_ARG0(r)); |
| 722 | return -EFAULT; |
| 723 | } |
| 724 | |
| 725 | if(!Memory::CheckUsermodePointer(SC_ARG1(r), 0, proc->addressSpace)){ |
| 726 | Log::Warning("sys_rename: Invalid newpath pointer %x", SC_ARG0(r)); |
| 727 | return -EFAULT; |
| 728 | } |
| 729 | |
| 730 | FsNode* olddir = fs::ResolveParent(oldpath, proc->workingDir); |
| 731 | FsNode* newdir = fs::ResolveParent(newpath, proc->workingDir); |
| 732 | |
| 733 | if(!(olddir && newdir)){ |
| 734 | return -ENOENT; |
| 735 | } |
| 736 | |
| 737 | return fs::Rename(olddir, fs::BaseName(oldpath), newdir, fs::BaseName(newpath)); |
| 738 | } |
| 739 | |
| 740 | long SysYield(regs64_t* r){ |
| 741 | Scheduler::Yield(); |
nothing calls this directly
no test coverage detected