-/* Dumb Windows implementation of pread(). It temporarily changes the file
- * offset, so it is not safe to use with readers/writers on the same file
- * descriptor. */
-extern ssize_t
-win32_pread(int fd, void *buf, size_t count, off_t offset)
-{
- return do_pread_or_pwrite(fd, buf, count, offset, false);
-}
-
-/* Dumb Windows implementation of pwrite(). It temporarily changes the file
- * offset, so it is not safe to use with readers/writers on the same file
- * descriptor. */
-extern ssize_t
-win32_pwrite(int fd, const void *buf, size_t count, off_t offset)
-{
- return do_pread_or_pwrite(fd, (void*)buf, count, offset, true);
-}
-
-/* Dumb Windows implementation of writev(). It writes the vectors one at a
- * time. */
-extern ssize_t
-win32_writev(int fd, const struct iovec *iov, int iovcnt)
-{
- ssize_t total_bytes_written = 0;
-
- if (iovcnt <= 0) {
- errno = EINVAL;
- return -1;
- }
- for (int i = 0; i < iovcnt; i++) {
- ssize_t bytes_written;
-
- bytes_written = write(fd, iov[i].iov_base, iov[i].iov_len);
- if (bytes_written >= 0)
- total_bytes_written += bytes_written;
- if (bytes_written != iov[i].iov_len) {
- if (total_bytes_written == 0)
- total_bytes_written = -1;
- break;
- }
- }
- return total_bytes_written;
-}