| * Copyright Red Hat, Inc. 2010 |
| * Michael S. Tsirkin <mst@redhat.com> |
| * This work is licensed under the terms of the GNU GPL, version 2 or later. |
| * See the COPYING file in the top-level directory. |
| #include "event_notifier.h" |
| void event_notifier_init_fd(EventNotifier *e, int fd) |
| int event_notifier_init(EventNotifier *e, int active) |
| int fd = eventfd(!!active, EFD_NONBLOCK | EFD_CLOEXEC); |
| void event_notifier_cleanup(EventNotifier *e) |
| int event_notifier_get_fd(EventNotifier *e) |
| int event_notifier_set_handler(EventNotifier *e, |
| EventNotifierHandler *handler) |
| return qemu_set_fd_handler(e->fd, (IOHandler *)handler, NULL, e); |
| int event_notifier_set(EventNotifier *e) |
| int r = write(e->fd, &value, sizeof(value)); |
| return r == sizeof(value); |
| int event_notifier_test_and_clear(EventNotifier *e) |
| int r = read(e->fd, &value, sizeof(value)); |
| return r == sizeof(value); |