| 47 | namespace internal { |
| 48 | |
| 49 | Future<size_t> read(int_fd fd, void* data, size_t size, bool bypassZeroRead) |
| 50 | { |
| 51 | process::initialize(); |
| 52 | |
| 53 | // TODO(benh): Let the system calls do what ever they're supposed to |
| 54 | // rather than return 0 here? |
| 55 | if (size == 0 && bypassZeroRead) { |
| 56 | return 0; |
| 57 | } |
| 58 | |
| 59 | // Just do a synchronous call. |
| 60 | if (!fd.is_overlapped()) { |
| 61 | ssize_t result = os::read(fd, data, size); |
| 62 | if (result == -1) { |
| 63 | return Failure(WindowsError().message); |
| 64 | } |
| 65 | return static_cast<size_t>(result); |
| 66 | } |
| 67 | |
| 68 | return windows::read(fd, data, size); |
| 69 | } |
| 70 | |
| 71 | Future<size_t> write(int_fd fd, const void* data, size_t size) |
| 72 | { |
no test coverage detected