| 825 | } |
| 826 | |
| 827 | WasiExpect<void> |
| 828 | INode::fdFdstatSetFlags(__wasi_fdflags_t FdFlags) const noexcept { |
| 829 | auto This = const_cast<INode *>(this); |
| 830 | if (Type == HandleType::NormalSocket) { |
| 831 | // Support __WASI_FDFLAGS_NONBLOCK only, ignore other flags. |
| 832 | if ((This->SavedFdFlags ^ FdFlags) & __WASI_FDFLAGS_NONBLOCK) { |
| 833 | const bool NonBlock = FdFlags & __WASI_FDFLAGS_NONBLOCK; |
| 834 | u_long SysFlag = NonBlock ? 1 : 0; |
| 835 | if (auto Res = ioctlsocket(Socket, FIONBIO, &SysFlag); |
| 836 | unlikely(Res == SOCKET_ERROR_)) { |
| 837 | return WasiUnexpect(detail::fromWSALastError()); |
| 838 | } |
| 839 | if (NonBlock) { |
| 840 | This->SavedFdFlags |= __WASI_FDFLAGS_NONBLOCK; |
| 841 | } else { |
| 842 | This->SavedFdFlags &= ~__WASI_FDFLAGS_NONBLOCK; |
| 843 | } |
| 844 | } |
| 845 | return {}; |
| 846 | } |
| 847 | // Support __WASI_FDFLAGS_APPEND only, ignore other flags. |
| 848 | if ((This->SavedFdFlags ^ FdFlags) & __WASI_FDFLAGS_APPEND) { |
| 849 | const bool Append = FdFlags & __WASI_FDFLAGS_APPEND; |
| 850 | if (Append) { |
| 851 | This->SavedFdFlags |= __WASI_FDFLAGS_APPEND; |
| 852 | } else { |
| 853 | This->SavedFdFlags &= ~__WASI_FDFLAGS_APPEND; |
| 854 | } |
| 855 | } |
| 856 | return {}; |
| 857 | } |
| 858 | |
| 859 | WasiExpect<void> |
| 860 | INode::fdFilestatGet(__wasi_filestat_t &FileStat) const noexcept { |
no test coverage detected