| 367 | } |
| 368 | |
| 369 | long SysClose(regs64_t* r){ |
| 370 | int fd = SC_ARG0(r); |
| 371 | |
| 372 | process_t* currentProcess = Scheduler::GetCurrentProcess(); |
| 373 | if(fd >= static_cast<int>(currentProcess->fileDescriptors.get_length())){ |
| 374 | Log::Warning("SysClose: Invalid File Descriptor, %d", fd); |
| 375 | return -EBADF; |
| 376 | } |
| 377 | |
| 378 | fs_fd_t* handle; |
| 379 | if((handle = currentProcess->fileDescriptors.at(fd))){ |
| 380 | fs::Close(handle); |
| 381 | |
| 382 | handle->node = nullptr; |
| 383 | |
| 384 | Scheduler::GetCurrentProcess()->fileDescriptors.at(fd) = nullptr; |
| 385 | } |
| 386 | return 0; |
| 387 | } |
| 388 | |
| 389 | long SysSleep(regs64_t* r){ |
| 390 | return 0; |
nothing calls this directly
no test coverage detected