int qemu_set_fd_handler2(int fd,

                         IOCanReadHandler *fd_read_poll,

                         IOHandler *fd_read,

                         IOHandler *fd_write,

                         void *opaque)

{

    IOHandlerRecord *ioh;



    assert(fd >= 0);



    if (!fd_read && !fd_write) {

        QLIST_FOREACH(ioh, &io_handlers, next) {

            if (ioh->fd == fd) {

                ioh->deleted = 1;

                break;

            }

        }

    } else {

        QLIST_FOREACH(ioh, &io_handlers, next) {

            if (ioh->fd == fd)

                goto found;

        }

        ioh = g_malloc0(sizeof(IOHandlerRecord));

        QLIST_INSERT_HEAD(&io_handlers, ioh, next);

    found:

        ioh->fd = fd;

        ioh->fd_read_poll = fd_read_poll;

        ioh->fd_read = fd_read;

        ioh->fd_write = fd_write;

        ioh->opaque = opaque;

        ioh->pollfds_idx = -1;

        ioh->deleted = 0;

        qemu_notify_event();

    }

    return 0;

}

int qemu_set_fd_handler2(int fd,

                         IOCanReadHandler *fd_read_poll,

                         IOHandler *fd_read,

                         IOHandler *fd_write,

                         void *opaque)

{

    IOHandlerRecord *ioh;



    assert(fd >= 0);



    if (!fd_read && !fd_write) {

        QLIST_FOREACH(ioh, &io_handlers, next) {

            if (ioh->fd == fd) {

                ioh->deleted = 1;

                break;

            }

        }

    } else {

        QLIST_FOREACH(ioh, &io_handlers, next) {

            if (ioh->fd == fd)

                goto found;

        }

        ioh = g_malloc0(sizeof(IOHandlerRecord));

        QLIST_INSERT_HEAD(&io_handlers, ioh, next);

    found:

        ioh->fd = fd;

        ioh->fd_read_poll = fd_read_poll;

        ioh->fd_read = fd_read;

        ioh->fd_write = fd_write;

        ioh->opaque = opaque;

        ioh->pollfds_idx = -1;

        ioh->deleted = 0;

        qemu_notify_event();

    }

    return 0;

}

int FUNC_0(int VAR_0,

                         IOCanReadHandler *VAR_1,

                         IOHandler *VAR_2,

                         IOHandler *VAR_3,

                         void *VAR_4)

{

    IOHandlerRecord *ioh;



    assert(VAR_0 >= 0);



    if (!VAR_2 && !VAR_3) {

        QLIST_FOREACH(ioh, &io_handlers, next) {

            if (ioh->VAR_0 == VAR_0) {

                ioh->deleted = 1;

                break;

            }

        }

    } else {

        QLIST_FOREACH(ioh, &io_handlers, next) {

            if (ioh->VAR_0 == VAR_0)

                goto found;

        }

        ioh = g_malloc0(sizeof(IOHandlerRecord));

        QLIST_INSERT_HEAD(&io_handlers, ioh, next);

    found:

        ioh->VAR_0 = VAR_0;

        ioh->VAR_1 = VAR_1;

        ioh->VAR_2 = VAR_2;

        ioh->VAR_3 = VAR_3;

        ioh->VAR_4 = VAR_4;

        ioh->pollfds_idx = -1;

        ioh->deleted = 0;

        qemu_notify_event();

    }

    return 0;

}

int FUNC_0(int VAR_0,
IOCanReadHandler *VAR_1,
IOHandler *VAR_2,
IOHandler *VAR_3,
void *VAR_4)
{ IOHandlerRecord *ioh; assert(VAR_0 >= 0); if (!VAR_2 && !VAR_3) { QLIST_FOREACH(ioh, &io_handlers, next) { if (ioh->VAR_0 == VAR_0) { ioh->deleted = 1; break; } } } else { QLIST_FOREACH(ioh, &io_handlers, next) { if (ioh->VAR_0 == VAR_0)
goto found; } ioh = g_malloc0(sizeof(IOHandlerRecord)); QLIST_INSERT_HEAD(&io_handlers, ioh, next); found:
ioh->VAR_0 = VAR_0; ioh->VAR_1 = VAR_1; ioh->VAR_2 = VAR_2; ioh->VAR_3 = VAR_3; ioh->VAR_4 = VAR_4; ioh->pollfds_idx = -1; ioh->deleted = 0; qemu_notify_event(); } return 0; }