From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:50456) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QcjyJ-0004C2-PX for qemu-devel@nongnu.org; Fri, 01 Jul 2011 16:05:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QcjyH-0005a2-Ok for qemu-devel@nongnu.org; Fri, 01 Jul 2011 16:05:51 -0400 Received: from mail-qw0-f45.google.com ([209.85.216.45]:57016) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QcjyH-0005Zp-CA for qemu-devel@nongnu.org; Fri, 01 Jul 2011 16:05:49 -0400 Received: by qwj8 with SMTP id 8so2128659qwj.4 for ; Fri, 01 Jul 2011 13:05:48 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20110630155725.GA9765@redhat.com> References: <20110630155725.GA9765@redhat.com> From: Blue Swirl Date: Fri, 1 Jul 2011 23:05:28 +0300 Message-ID: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCHv2] Add compat eventfd header List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: Paolo Bonzini , Alexander Graf , qemu-devel@nongnu.org, Aurelien Jarno , Stefan Hajnoczi On Thu, Jun 30, 2011 at 6:57 PM, Michael S. Tsirkin wrote: > Support build on rhel 5.X where we have syscall for eventfd but not > userspace wrapper. > > (cherry-picked from commit 9e3269181e9bc56feb43bcd4e8ce0b82cd543e65 > =C2=A0in qemu-kvm.git). > > Signed-off-by: Michael S. Tsirkin > --- > > Changes from v1: > =C2=A0checkpatch fix > =C2=A0address comments by agraf > =C2=A0verify we are on linux > > =C2=A0compat/sys/eventfd.h | =C2=A0 20 ++++++++++++++++++++ > =C2=A0configure =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| =C2=A0 =C2=A06= ++++-- > =C2=A02 files changed, 24 insertions(+), 2 deletions(-) > =C2=A0create mode 100644 compat/sys/eventfd.h > > diff --git a/compat/sys/eventfd.h b/compat/sys/eventfd.h > new file mode 100644 > index 0000000..1801a5f > --- /dev/null > +++ b/compat/sys/eventfd.h Since we have linux-headers directory now, the directory should be compat-headers. I'd also add 'linux' directory below that to avoid collisions, so the full path would be compat-headers/linux/sys/eventfd.h. > @@ -0,0 +1,20 @@ > +#ifndef _COMPAT_SYS_EVENTFD > +#define _COMPAT_SYS_EVENTFD > + > +#ifdef CONFIG_EVENTFD > + > +#ifndef __linux__ > +#error __linux__ is not defined: eventfd is only supported on linux > +#endif With the linux directory, this check wouldn't be needed. It's not incorrect and we could add more specific checks later (for example if SYS_eventfd is not defined). > + > +#include > +#include > + > +static inline int eventfd(int count, int flags) > +{ > + =C2=A0 =C2=A0return syscall(SYS_eventfd, count, flags); > +} > + > +#endif > + > +#endif > diff --git a/configure b/configure > index 856b41e..6f7dd74 100755 > --- a/configure > +++ b/configure > @@ -822,7 +822,6 @@ esac > > =C2=A0[ -z "$guest_base" ] && guest_base=3D"$host_guest_base" > > - > =C2=A0default_target_list=3D"" > > =C2=A0# these targets are portable > @@ -891,6 +890,9 @@ sparc64-bsd-user \ > =C2=A0" > =C2=A0fi > > +#compat headers > +QEMU_CFLAGS=3D"$QEMU_CFLAGS -idirafter $source_path/compat" Please use $source_path/compat-headers/$targetos/. > + > =C2=A0if test x"$show_help" =3D x"yes" ; then > =C2=A0cat << EOF > > @@ -2122,7 +2124,7 @@ int main(void) > =C2=A0 =C2=A0 return 0; > =C2=A0} > =C2=A0EOF > -if compile_prog "" "" ; then > +if compile_prog "-DCONFIG_EVENTFD" "" ; then > =C2=A0 eventfd=3Dyes > =C2=A0fi > > -- > 1.7.5.53.gc233e >