Replace SIGUSR1 in io-thread with eventfd()
[qemu-kvm/fedora.git] / kvm-compatfd.c
blob1b030ba410926c2776814dae0cf94140ada0f6e4
1 /*
2 * signalfd/eventfd compatibility
4 * Copyright IBM, Corp. 2008
6 * Authors:
7 * Anthony Liguori <aliguori@us.ibm.com>
9 * This work is licensed under the terms of the GNU GPL, version 2. See
10 * the COPYING file in the top-level directory.
14 #include "qemu-common.h"
15 #include "qemu-kvm.h"
17 #include <sys/syscall.h>
19 int kvm_eventfd(int *fds)
21 #if defined(SYS_eventfd)
22 int ret;
24 ret = syscall(SYS_eventfd, 0);
25 if (ret >= 0) {
26 fds[0] = fds[1] = ret;
27 return 0;
28 } else if (!(ret == -1 && errno == ENOSYS))
29 return ret;
30 #endif
32 return pipe(fds);