//////////////////////// \brief SysSetFileStatusFlags(fd, flags) Set a file handle's mode/status flags \param fd (int) file descriptor \param flags (int) new status flags \return 0 on success, negative error code on failure ////////////////////////
| 2060 | /// \return 0 on success, negative error code on failure |
| 2061 | ///////////////////////////// |
| 2062 | long SysSetFileStatusFlags(regs64_t* r){ |
| 2063 | int fd = static_cast<int>(SC_ARG0(r)); |
| 2064 | int nFlags = static_cast<int>(SC_ARG1(r)); |
| 2065 | fs_fd_t* handle; |
| 2066 | |
| 2067 | process_t* currentProcess = Scheduler::GetCurrentProcess(); |
| 2068 | if(static_cast<unsigned>(fd) > currentProcess->fileDescriptors.get_length() || !(handle = currentProcess->fileDescriptors[fd])){ |
| 2069 | return -EBADF; |
| 2070 | } |
| 2071 | |
| 2072 | int mask = (O_APPEND | O_NONBLOCK); // Only update append or nonblock |
| 2073 | |
| 2074 | handle->mode = (handle->mode & ~mask) | (nFlags & mask); |
| 2075 | |
| 2076 | return 0; |
| 2077 | } |
| 2078 | |
| 2079 | ///////////////////////////// |
| 2080 | /// \brief SysSelect(nfds, readfds, writefds, exceptfds, timeout) Set a file handle's mode/status flags |
nothing calls this directly
no test coverage detected