| 108 | |
| 109 | |
| 110 | Try<bool> is_async(int_fd fd) |
| 111 | { |
| 112 | if (fd.is_overlapped()) { |
| 113 | return fd.get_iocp() != nullptr; |
| 114 | } |
| 115 | |
| 116 | // For non-overlapped fds, we only accept disk files, since they are "fast" |
| 117 | // devices, similar to how Linux `O_NONBLOCK` no-ops on "fast" file types |
| 118 | // like regular files. |
| 119 | if (fd.type() == os::WindowsFD::Type::SOCKET) { |
| 120 | return false; |
| 121 | } |
| 122 | |
| 123 | DWORD type = ::GetFileType(fd); |
| 124 | WindowsError error; |
| 125 | if (type == FILE_TYPE_UNKNOWN && error.code != NO_ERROR) { |
| 126 | return error; |
| 127 | } |
| 128 | |
| 129 | return type == FILE_TYPE_DISK; |
| 130 | } |
| 131 | |
| 132 | } // namespace internal { |
| 133 | } // namespace io { |
nothing calls this directly
no outgoing calls
no test coverage detected