static void sigfd_handler(void *opaque)

{

    int fd = (intptr_t)opaque;

    struct qemu_signalfd_siginfo info;

    struct sigaction action;

    ssize_t len;



    while (1) {

        do {

            len = read(fd, &info, sizeof(info));

        } while (len == -1 && errno == EINTR);



        if (len == -1 && errno == EAGAIN) {

            break;

        }



        if (len != sizeof(info)) {

            printf("read from sigfd returned %zd: %m\n", len);

            return;

        }



        sigaction(info.ssi_signo, NULL, &action);

        if ((action.sa_flags & SA_SIGINFO) && action.sa_sigaction) {

            action.sa_sigaction(info.ssi_signo,

                                (siginfo_t *)&info, NULL);

        } else if (action.sa_handler) {

            action.sa_handler(info.ssi_signo);

        }

    }

}

static void sigfd_handler(void *opaque)

{

    int fd = (intptr_t)opaque;

    struct qemu_signalfd_siginfo info;

    struct sigaction action;

    ssize_t len;



    while (1) {

        do {

            len = read(fd, &info, sizeof(info));

        } while (len == -1 && errno == EINTR);



        if (len == -1 && errno == EAGAIN) {

            break;

        }



        if (len != sizeof(info)) {

            printf("read from sigfd returned %zd: %m\n", len);

            return;

        }



        sigaction(info.ssi_signo, NULL, &action);

        if ((action.sa_flags & SA_SIGINFO) && action.sa_sigaction) {

            action.sa_sigaction(info.ssi_signo,

                                (siginfo_t *)&info, NULL);

        } else if (action.sa_handler) {

            action.sa_handler(info.ssi_signo);

        }

    }

}

static void FUNC_0(void *VAR_0)

{

    int VAR_1 = (intptr_t)VAR_0;

    struct qemu_signalfd_siginfo VAR_2;

    struct sigaction VAR_3;

    ssize_t len;



    while (1) {

        do {

            len = read(VAR_1, &VAR_2, sizeof(VAR_2));

        } while (len == -1 && errno == EINTR);



        if (len == -1 && errno == EAGAIN) {

            break;

        }



        if (len != sizeof(VAR_2)) {

            printf("read from sigfd returned %zd: %m\n", len);

            return;

        }



        sigaction(VAR_2.ssi_signo, NULL, &VAR_3);

        if ((VAR_3.sa_flags & SA_SIGINFO) && VAR_3.sa_sigaction) {

            VAR_3.sa_sigaction(VAR_2.ssi_signo,

                                (siginfo_t *)&VAR_2, NULL);

        } else if (VAR_3.sa_handler) {

            VAR_3.sa_handler(VAR_2.ssi_signo);

        }

    }

}

static void FUNC_0(void *VAR_0)
{ int VAR_1 = (intptr_t)VAR_0; struct qemu_signalfd_siginfo VAR_2; struct sigaction VAR_3; ssize_t len; while (1) { do { len = read(VAR_1, &VAR_2, sizeof(VAR_2)); } while (len == -1 && errno == EINTR); if (len == -1 && errno == EAGAIN) { break; } if (len != sizeof(VAR_2)) { printf("read from sigfd returned %zd: %m\n", len); return; } sigaction(VAR_2.ssi_signo, NULL, &VAR_3); if ((VAR_3.sa_flags & SA_SIGINFO) && VAR_3.sa_sigaction) { VAR_3.sa_sigaction(VAR_2.ssi_signo,
(siginfo_t *)&VAR_2, NULL); } else if (VAR_3.sa_handler) { VAR_3.sa_handler(VAR_2.ssi_signo); } } }