* SysReadDirNext(fd, direntPointer) - Read directory using the file descriptor offset as an index * * fd - File descriptor of directory * direntPointer - Pointer to fs_dirent_t * * Return Value: * 1 on Success * 0 on End of directory * Negative value on failure * */
| 755 | * |
| 756 | */ |
| 757 | long SysReadDirNext(regs64_t* r){ |
| 758 | unsigned int fd = SC_ARG0(r); |
| 759 | if(fd > Scheduler::GetCurrentProcess()->fileDescriptors.get_length()){ |
| 760 | return -EBADF; |
| 761 | } |
| 762 | |
| 763 | fs_dirent_t* direntPointer = (fs_dirent_t*)SC_ARG1(r); |
| 764 | fs_fd_t* handle = Scheduler::GetCurrentProcess()->fileDescriptors[fd]; |
| 765 | |
| 766 | if(!handle){ |
| 767 | return -EBADF; |
| 768 | } |
| 769 | |
| 770 | if(!Memory::CheckUsermodePointer((uintptr_t)direntPointer, sizeof(fs_dirent_t), Scheduler::GetCurrentProcess()->addressSpace)){ |
| 771 | return -EFAULT; |
| 772 | } |
| 773 | |
| 774 | if((Scheduler::GetCurrentProcess()->fileDescriptors[fd]->node->flags & FS_NODE_TYPE) != FS_NODE_DIRECTORY){ |
| 775 | return -ENOTDIR; |
| 776 | } |
| 777 | |
| 778 | DirectoryEntry tempent; |
| 779 | int ret = fs::ReadDir(handle, &tempent, handle->pos++); |
| 780 | |
| 781 | strcpy(direntPointer->name, tempent.name); |
| 782 | direntPointer->type = tempent.flags; |
| 783 | |
| 784 | return ret; |
| 785 | } |
| 786 | |
| 787 | long SysRenameAt(regs64_t* r){ |
| 788 | Log::Warning("SysRenameAt is a stub!"); |
nothing calls this directly
no test coverage detected