qemu_co_sendv_recvv(int sockfd, struct iovec *iov, unsigned iov_cnt,

                    size_t offset, size_t bytes, bool do_send)

{

    size_t done = 0;

    ssize_t ret;

    while (done < bytes) {

        ret = iov_send_recv(sockfd, iov,

                            offset + done, bytes - done, do_send);

        if (ret > 0) {

            done += ret;

        } else if (ret < 0) {

            if (errno == EAGAIN) {

                qemu_coroutine_yield();

            } else if (done == 0) {

                return -1;

            } else {

                break;

            }

        } else if (ret == 0 && !do_send) {

            /* write (send) should never return 0.

             * read (recv) returns 0 for end-of-file (-data).

             * In both cases there's little point retrying,

             * but we do for write anyway, just in case */

            break;

        }

    }

    return done;

}

qemu_co_sendv_recvv(int sockfd, struct iovec *iov, unsigned iov_cnt,

                    size_t offset, size_t bytes, bool do_send)

{

    size_t done = 0;

    ssize_t ret;

    while (done < bytes) {

        ret = iov_send_recv(sockfd, iov,

                            offset + done, bytes - done, do_send);

        if (ret > 0) {

            done += ret;

        } else if (ret < 0) {

            if (errno == EAGAIN) {

                qemu_coroutine_yield();

            } else if (done == 0) {

                return -1;

            } else {

                break;

            }

        } else if (ret == 0 && !do_send) {

            







            break;

        }

    }

    return done;

}

    ssize_t ret;             } else {             } else {                 break;                 break;         ret = iov_send_recv(sockfd, iov,
FUNC_0(int VAR_0, struct iovec *VAR_1, unsigned VAR_2,

                    size_t VAR_3, size_t VAR_4, bool VAR_5)

{

    size_t done = 0;

    ssize_t ret;

    while (done < VAR_4) {

        ret = iov_send_recv(VAR_0, VAR_1,

                            VAR_3 + done, VAR_4 - done, VAR_5);

        if (ret > 0) {

            done += ret;

        } else if (ret < 0) {

            if (errno == EAGAIN) {

                qemu_coroutine_yield();

            } else if (done == 0) {

                return -1;

            } else {

                break;

            }

        } else if (ret == 0 && !VAR_5) {

            







            break;

        }

    }

    return done;

}

FUNC_0(int VAR_0, struct iovec *VAR_1, unsigned VAR_2,
size_t VAR_3, size_t VAR_4, bool VAR_5)
{ size_t done = 0; ssize_t ret; while (done < VAR_4) { ret = iov_send_recv(VAR_0, VAR_1,
VAR_3 + done, VAR_4 - done, VAR_5); if (ret > 0) { done += ret; } else if (ret < 0) { if (errno == EAGAIN) { qemu_coroutine_yield(); } else if (done == 0) { return -1; } else { break; } } else if (ret == 0 && !VAR_5) { break; } } return done; }