qio_channel_socket_accept(QIOChannelSocket *ioc,

                          Error **errp)

{

    QIOChannelSocket *cioc;



    cioc = qio_channel_socket_new();

    cioc->remoteAddrLen = sizeof(ioc->remoteAddr);

    cioc->localAddrLen = sizeof(ioc->localAddr);



 retry:

    trace_qio_channel_socket_accept(ioc);

    cioc->fd = qemu_accept(ioc->fd, (struct sockaddr *)&cioc->remoteAddr,

                           &cioc->remoteAddrLen);

    if (cioc->fd < 0) {

        trace_qio_channel_socket_accept_fail(ioc);

        if (errno == EINTR) {

            goto retry;

        }

        goto error;

    }



    if (getsockname(cioc->fd, (struct sockaddr *)&cioc->localAddr,

                    &cioc->localAddrLen) < 0) {

        error_setg_errno(errp, errno,

                         "Unable to query local socket address");

        goto error;

    }



#ifndef WIN32

    if (cioc->localAddr.ss_family == AF_UNIX) {

        QIOChannel *ioc_local = QIO_CHANNEL(cioc);

        qio_channel_set_feature(ioc_local, QIO_CHANNEL_FEATURE_FD_PASS);

    }

#endif /* WIN32 */



    trace_qio_channel_socket_accept_complete(ioc, cioc, cioc->fd);

    return cioc;



 error:

    object_unref(OBJECT(cioc));

    return NULL;

}

qio_channel_socket_accept(QIOChannelSocket *ioc,

                          Error **errp)

{

    QIOChannelSocket *cioc;



    cioc = qio_channel_socket_new();

    cioc->remoteAddrLen = sizeof(ioc->remoteAddr);

    cioc->localAddrLen = sizeof(ioc->localAddr);



 retry:

    trace_qio_channel_socket_accept(ioc);

    cioc->fd = qemu_accept(ioc->fd, (struct sockaddr *)&cioc->remoteAddr,

                           &cioc->remoteAddrLen);

    if (cioc->fd < 0) {

        trace_qio_channel_socket_accept_fail(ioc);

        if (errno == EINTR) {

            goto retry;

        }

        goto error;

    }



    if (getsockname(cioc->fd, (struct sockaddr *)&cioc->localAddr,

                    &cioc->localAddrLen) < 0) {

        error_setg_errno(errp, errno,

                         "Unable to query local socket address");

        goto error;

    }



#ifndef WIN32

    if (cioc->localAddr.ss_family == AF_UNIX) {

        QIOChannel *ioc_local = QIO_CHANNEL(cioc);

        qio_channel_set_feature(ioc_local, QIO_CHANNEL_FEATURE_FD_PASS);

    }

#endif 



    trace_qio_channel_socket_accept_complete(ioc, cioc, cioc->fd);

    return cioc;



 error:

    object_unref(OBJECT(cioc));

    return NULL;

}

        trace_qio_channel_socket_accept_fail(ioc);
FUNC_0(QIOChannelSocket *VAR_0,

                          Error **VAR_1)

{

    QIOChannelSocket *cioc;



    cioc = qio_channel_socket_new();

    cioc->remoteAddrLen = sizeof(VAR_0->remoteAddr);

    cioc->localAddrLen = sizeof(VAR_0->localAddr);



 retry:

    trace_qio_channel_socket_accept(VAR_0);

    cioc->fd = qemu_accept(VAR_0->fd, (struct sockaddr *)&cioc->remoteAddr,

                           &cioc->remoteAddrLen);

    if (cioc->fd < 0) {

        trace_qio_channel_socket_accept_fail(VAR_0);

        if (errno == EINTR) {

            goto retry;

        }

        goto error;

    }



    if (getsockname(cioc->fd, (struct sockaddr *)&cioc->localAddr,

                    &cioc->localAddrLen) < 0) {

        error_setg_errno(VAR_1, errno,

                         "Unable to query local socket address");

        goto error;

    }



#ifndef WIN32

    if (cioc->localAddr.ss_family == AF_UNIX) {

        QIOChannel *ioc_local = QIO_CHANNEL(cioc);

        qio_channel_set_feature(ioc_local, QIO_CHANNEL_FEATURE_FD_PASS);

    }

#endif 



    trace_qio_channel_socket_accept_complete(VAR_0, cioc, cioc->fd);

    return cioc;



 error:

    object_unref(OBJECT(cioc));

    return NULL;

}

FUNC_0(QIOChannelSocket *VAR_0,
Error **VAR_1)
{ QIOChannelSocket *cioc; cioc = qio_channel_socket_new(); cioc->remoteAddrLen = sizeof(VAR_0->remoteAddr); cioc->localAddrLen = sizeof(VAR_0->localAddr); retry:
trace_qio_channel_socket_accept(VAR_0); cioc->fd = qemu_accept(VAR_0->fd, (struct sockaddr *)&cioc->remoteAddr,
&cioc->remoteAddrLen); if (cioc->fd < 0) { trace_qio_channel_socket_accept_fail(VAR_0); if (errno == EINTR) { goto retry; } goto error; } if (getsockname(cioc->fd, (struct sockaddr *)&cioc->localAddr,
&cioc->localAddrLen) < 0) { error_setg_errno(VAR_1, errno,
"Unable to query local socket address"); goto error; } #ifndef WIN32
if (cioc->localAddr.ss_family == AF_UNIX) { QIOChannel *ioc_local = QIO_CHANNEL(cioc); qio_channel_set_feature(ioc_local, QIO_CHANNEL_FEATURE_FD_PASS); } #endif
trace_qio_channel_socket_accept_complete(VAR_0, cioc, cioc->fd); return cioc; error:
object_unref(OBJECT(cioc)); return NULL; }