int tcp_start_incoming_migration(const char *host_port)

{

    struct sockaddr_in addr;

    int val;

    int s;



    if (parse_host_port(&addr, host_port) < 0) {

        fprintf(stderr, "invalid host/port combination: %s\n", host_port);

        return -EINVAL;

    }



    s = socket(PF_INET, SOCK_STREAM, 0);

    if (s == -1)

        return -socket_error();



    val = 1;

    setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (const char *)&val, sizeof(val));



    if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) == -1)

        goto err;



    if (listen(s, 1) == -1)

        goto err;



    qemu_set_fd_handler2(s, NULL, tcp_accept_incoming_migration, NULL,

                         (void *)(unsigned long)s);



    return 0;



err:

    close(s);

    return -socket_error();

}

int tcp_start_incoming_migration(const char *host_port)

{

    struct sockaddr_in addr;

    int val;

    int s;



    if (parse_host_port(&addr, host_port) < 0) {

        fprintf(stderr, "invalid host/port combination: %s\n", host_port);

        return -EINVAL;

    }



    s = socket(PF_INET, SOCK_STREAM, 0);

    if (s == -1)

        return -socket_error();



    val = 1;

    setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (const char *)&val, sizeof(val));



    if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) == -1)

        goto err;



    if (listen(s, 1) == -1)

        goto err;



    qemu_set_fd_handler2(s, NULL, tcp_accept_incoming_migration, NULL,

                         (void *)(unsigned long)s);



    return 0;



err:

    close(s);

    return -socket_error();

}

    s = socket(PF_INET, SOCK_STREAM, 0);
int FUNC_0(const char *VAR_0)

{

    struct sockaddr_in VAR_1;

    int VAR_2;

    int VAR_3;



    if (parse_host_port(&VAR_1, VAR_0) < 0) {

        fprintf(stderr, "invalid host/port combination: %VAR_3\n", VAR_0);

        return -EINVAL;

    }



    VAR_3 = socket(PF_INET, SOCK_STREAM, 0);

    if (VAR_3 == -1)

        return -socket_error();



    VAR_2 = 1;

    setsockopt(VAR_3, SOL_SOCKET, SO_REUSEADDR, (const char *)&VAR_2, sizeof(VAR_2));



    if (bind(VAR_3, (struct sockaddr *)&VAR_1, sizeof(VAR_1)) == -1)

        goto err;



    if (listen(VAR_3, 1) == -1)

        goto err;



    qemu_set_fd_handler2(VAR_3, NULL, tcp_accept_incoming_migration, NULL,

                         (void *)(unsigned long)VAR_3);



    return 0;



err:

    close(VAR_3);

    return -socket_error();

}

int FUNC_0(const char *VAR_0)
{ struct sockaddr_in VAR_1; int VAR_2; int VAR_3; if (parse_host_port(&VAR_1, VAR_0) < 0) { fprintf(stderr, "invalid host/port combination: %VAR_3\n", VAR_0); return -EINVAL; } VAR_3 = socket(PF_INET, SOCK_STREAM, 0); if (VAR_3 == -1)
return -socket_error(); VAR_2 = 1; setsockopt(VAR_3, SOL_SOCKET, SO_REUSEADDR, (const char *)&VAR_2, sizeof(VAR_2)); if (bind(VAR_3, (struct sockaddr *)&VAR_1, sizeof(VAR_1)) == -1)
goto err; if (listen(VAR_3, 1) == -1)
goto err; qemu_set_fd_handler2(VAR_3, NULL, tcp_accept_incoming_migration, NULL,
(void *)(unsigned long)VAR_3); return 0; err:
close(VAR_3); return -socket_error(); }