Skip to contentSkip to conversation

qemu-kvm: add compat eventfd

PATCH Superseded Michael S. Tsirkin 2 participants 3 messages Aug 16, 2009 – Aug 17, 2009 KVM

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qemu-kvm: add compat eventfd

Support build on rhel 5.3 where we have syscall for eventfd but not userspace wrapper.

---
 compat/sys/eventfd.h |   13 +++++++++++++
 configure            |    1 +
 2 files changed, 14 insertions(+), 0 deletions(-)
 create mode 100644 compat/sys/eventfd.h
compat/sys/eventfd.h new file +13 -0
new file mode 100644
index 0000000..f55d96a
@@ -0,0 +1,13 @@
+#ifndef _COMPAT_SYS_EVENTFD
+#define _COMPAT_SYS_EVENTFD
+
+#include <unistd.h>
+#include <syscall.h>
+
+
+static inline int eventfd (int count, int flags)
+{
+    return syscall(SYS_eventfd, count, flags);
+}
+
+#endif
configure +1 -0
index 84af8bd..bb2680f 100755
@@ -866,6 +866,7 @@ if test "$kvm" = "yes" ; then
 
 kvm_cflags="-I$source_path/kvm/include"
 kvm_cflags="$kvm_cflags -I$source_path/kvm/include/$kvm_arch"
+kvm_cflags="$kvm_cflags -I$source_path/compat"
 
 # test for KVM_CAP_PIT
 
Signature · 1 line
1.6.2.5
#1 lore raw
Quoted 34 lines · Michael S. Tsirkin

Support build on rhel 5.3 where we have syscall for eventfd but not userspace wrapper.

---
  compat/sys/eventfd.h |   13 +++++++++++++
  configure            |    1 +
  2 files changed, 14 insertions(+), 0 deletions(-)

create mode 100644 compat/sys/eventfd.h

compat/sys/eventfd.h new file +13 -0
new file mode 100644
index 0000000..f55d96a
@@ -0,0 +1,13 @@
+#ifndef _COMPAT_SYS_EVENTFD
+#define _COMPAT_SYS_EVENTFD
+
+#include<unistd.h>
+#include<syscall.h>
+
+
+static inline int eventfd (int count, int flags)
+{
+    return syscall(SYS_eventfd, count, flags);
+}
+
+#endif
configure +0 -0
index 84af8bd..bb2680f 100755

configure if test "$kvm" = "yes" ; then · line 871

Quoted 6 lines
configure +1 -0
@@ -866,6 +866,7 @@ if test "$kvm" = "yes" ; then
 
  kvm_cflags="-I$source_path/kvm/include"
  kvm_cflags="$kvm_cflags -I$source_path/kvm/include/$kvm_arch"
+kvm_cflags="$kvm_cflags -I$source_path/compat"
 
 

er, that will override sys/eventfd.h even if it does exist. We need to prefer the system eventfd.h to ours.

Signature · 1 line
error compiling committee.c: too many arguments to function
#2 lore raw
Quoted 6 lines · Avi Kivity
Quoted 6 lines
configure +0 -0
index 84af8bd..bb2680f 100755
@@ -866,6 +866,7 @@ if test "$kvm" = "yes" ; then
 
Quoted 6 lines

configure if test "$kvm" = "yes" ; then · line 872

Quoted 5 lines
configure +1 -0
  kvm_cflags="-I$source_path/kvm/include"
  kvm_cflags="$kvm_cflags -I$source_path/kvm/include/$kvm_arch"
+kvm_cflags="$kvm_cflags -I$source_path/compat"
 
 

er, that will override sys/eventfd.h even if it does exist. We need to prefer the system eventfd.h to ours.

OK, -idirafter does this.

Quoted 3 lines
Signature · 2 lines
-- 
error compiling committee.c: too many arguments to function