int unix_start_incoming_migration(const char *path)

{

    struct sockaddr_un un;

    int sock;



    dprintf("Attempting to start an incoming migration\n");



    sock = socket(PF_UNIX, SOCK_STREAM, 0);

    if (sock < 0) {

        fprintf(stderr, "Could not open unix socket: %s\n", strerror(errno));

        return -EINVAL;

    }



    memset(&un, 0, sizeof(un));

    un.sun_family = AF_UNIX;

    snprintf(un.sun_path, sizeof(un.sun_path), "%s", path);



    unlink(un.sun_path);

    if (bind(sock, (struct sockaddr*) &un, sizeof(un)) < 0) {

        fprintf(stderr, "bind(unix:%s): %s\n", un.sun_path, strerror(errno));

        goto err;

    }

    if (listen(sock, 1) < 0) {

        fprintf(stderr, "listen(unix:%s): %s\n", un.sun_path, strerror(errno));

        goto err;

    }



    qemu_set_fd_handler2(sock, NULL, unix_accept_incoming_migration, NULL,

			 (void *)(unsigned long)sock);



    return 0;



err:

    close(sock);



    return -EINVAL;

}

int unix_start_incoming_migration(const char *path)

{

    struct sockaddr_un un;

    int sock;



    dprintf("Attempting to start an incoming migration\n");



    sock = socket(PF_UNIX, SOCK_STREAM, 0);

    if (sock < 0) {

        fprintf(stderr, "Could not open unix socket: %s\n", strerror(errno));

        return -EINVAL;

    }



    memset(&un, 0, sizeof(un));

    un.sun_family = AF_UNIX;

    snprintf(un.sun_path, sizeof(un.sun_path), "%s", path);



    unlink(un.sun_path);

    if (bind(sock, (struct sockaddr*) &un, sizeof(un)) < 0) {

        fprintf(stderr, "bind(unix:%s): %s\n", un.sun_path, strerror(errno));

        goto err;

    }

    if (listen(sock, 1) < 0) {

        fprintf(stderr, "listen(unix:%s): %s\n", un.sun_path, strerror(errno));

        goto err;

    }



    qemu_set_fd_handler2(sock, NULL, unix_accept_incoming_migration, NULL,

			 (void *)(unsigned long)sock);



    return 0;



err:

    close(sock);



    return -EINVAL;

}

    sock = socket(PF_UNIX, SOCK_STREAM, 0);     sock = socket(PF_UNIX, SOCK_STREAM, 0);     sock = socket(PF_UNIX, SOCK_STREAM, 0);
int FUNC_0(const char *VAR_0)

{

    struct sockaddr_un VAR_1;

    int VAR_2;



    dprintf("Attempting to start an incoming migration\n");



    VAR_2 = socket(PF_UNIX, SOCK_STREAM, 0);

    if (VAR_2 < 0) {

        fprintf(stderr, "Could not open unix socket: %s\n", strerror(errno));

        return -EINVAL;

    }



    memset(&VAR_1, 0, sizeof(VAR_1));

    VAR_1.sun_family = AF_UNIX;

    snprintf(VAR_1.sun_path, sizeof(VAR_1.sun_path), "%s", VAR_0);



    unlink(VAR_1.sun_path);

    if (bind(VAR_2, (struct sockaddr*) &VAR_1, sizeof(VAR_1)) < 0) {

        fprintf(stderr, "bind(unix:%s): %s\n", VAR_1.sun_path, strerror(errno));

        goto err;

    }

    if (listen(VAR_2, 1) < 0) {

        fprintf(stderr, "listen(unix:%s): %s\n", VAR_1.sun_path, strerror(errno));

        goto err;

    }



    qemu_set_fd_handler2(VAR_2, NULL, unix_accept_incoming_migration, NULL,

			 (void *)(unsigned long)VAR_2);



    return 0;



err:

    close(VAR_2);



    return -EINVAL;

}

int FUNC_0(const char *VAR_0)
{ struct sockaddr_un VAR_1; int VAR_2; dprintf("Attempting to start an incoming migration\n"); VAR_2 = socket(PF_UNIX, SOCK_STREAM, 0); if (VAR_2 < 0) { fprintf(stderr, "Could not open unix socket: %s\n", strerror(errno)); return -EINVAL; } memset(&VAR_1, 0, sizeof(VAR_1)); VAR_1.sun_family = AF_UNIX; snprintf(VAR_1.sun_path, sizeof(VAR_1.sun_path), "%s", VAR_0); unlink(VAR_1.sun_path); if (bind(VAR_2, (struct sockaddr*) &VAR_1, sizeof(VAR_1)) < 0) { fprintf(stderr, "bind(unix:%s): %s\n", VAR_1.sun_path, strerror(errno)); goto err; } if (listen(VAR_2, 1) < 0) { fprintf(stderr, "listen(unix:%s): %s\n", VAR_1.sun_path, strerror(errno)); goto err; } qemu_set_fd_handler2(VAR_2, NULL, unix_accept_incoming_migration, NULL,
(void *)(unsigned long)VAR_2); return 0; err:
close(VAR_2); return -EINVAL; }