From: Ian Campbell <ian.campbell@citrix.com>
To: xen-devel@lists.xen.org
Cc: stefano.stabellini@citrix.com, tim@xen.org,
Ian Campbell <ian.campbell@citrix.com>,
ian.jackson@citrix.com
Subject: [PATCH 2/9] blktap2: use sys/eventfd.h if it is available
Date: Fri, 15 Mar 2013 13:15:43 +0000 [thread overview]
Message-ID: <1363353350-32251-2-git-send-email-ian.campbell@citrix.com> (raw)
In-Reply-To: <1363353334.520.7.camel@zakaz.uk.xensource.com>
arm64 only has the eventfd2 system call and using the libc wrapper when
available hides this from us. eventfd() has been in libc since glibc 2.8.
This code is already Linux specific.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
tools/blktap2/drivers/libaio-compat.h | 12 ++++++++++++
tools/config.h.in | 3 +++
tools/configure | 9 +++++----
tools/configure.ac | 2 +-
4 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/tools/blktap2/drivers/libaio-compat.h b/tools/blktap2/drivers/libaio-compat.h
index 353c36a..47cd96d 100644
--- a/tools/blktap2/drivers/libaio-compat.h
+++ b/tools/blktap2/drivers/libaio-compat.h
@@ -29,6 +29,7 @@
#ifndef __LIBAIO_COMPAT
#define __LIBAIO_COMPAT
+#include "../../config.h"
#include <libaio.h>
#include <unistd.h>
#include <sys/syscall.h>
@@ -50,6 +51,16 @@ static inline void __io_set_eventfd(struct iocb *iocb, int eventfd)
c->resfd = eventfd;
}
+#ifdef HAVE_SYS_EVENTFD_H
+
+#include <sys/eventfd.h>
+
+static inline int tapdisk_sys_eventfd(int initval)
+{
+ return eventfd(initval, 0);
+}
+
+#else /* Fallback */
#ifndef SYS_eventfd
#ifndef __NR_eventfd
# if defined(__alpha__)
@@ -88,5 +99,6 @@ static inline int tapdisk_sys_eventfd(int initval)
{
return syscall(SYS_eventfd, initval, 0);
}
+#endif
#endif /* __LIBAIO_COMPAT */
diff --git a/tools/config.h.in b/tools/config.h.in
index 08e337a..a67910b 100644
--- a/tools/config.h.in
+++ b/tools/config.h.in
@@ -27,6 +27,9 @@
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
+/* Define to 1 if you have the <sys/eventfd.h> header file. */
+#undef HAVE_SYS_EVENTFD_H
+
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
diff --git a/tools/configure b/tools/configure
index 9f73172..a98dd9e 100755
--- a/tools/configure
+++ b/tools/configure
@@ -7817,12 +7817,13 @@ fi
# Checks for header files.
-for ac_header in yajl/yajl_version.h
+for ac_header in yajl/yajl_version.h sys/eventfd.h
do :
- ac_fn_c_check_header_mongrel "$LINENO" "yajl/yajl_version.h" "ac_cv_header_yajl_yajl_version_h" "$ac_includes_default"
-if test "x$ac_cv_header_yajl_yajl_version_h" = x""yes; then :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
-#define HAVE_YAJL_YAJL_VERSION_H 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
fi
diff --git a/tools/configure.ac b/tools/configure.ac
index f6e2fec..36a3343 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -166,6 +166,6 @@ AC_CHECK_LIB([iconv], [libiconv_open], [libiconv="y"], [libiconv="n"])
AC_SUBST(libiconv)
# Checks for header files.
-AC_CHECK_HEADERS([yajl/yajl_version.h])
+AC_CHECK_HEADERS([yajl/yajl_version.h sys/eventfd.h])
AC_OUTPUT()
--
1.7.2.5
next prev parent reply other threads:[~2013-03-15 13:15 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-15 13:15 [PATCH 00/09] arm: tools: build for arm64 and enable cross-compiling for both arm32 and arm64 Ian Campbell
2013-03-15 13:15 ` [PATCH 1/9] tools: Use AC_SYS_LARGEFILE instead of calling getconf(1) Ian Campbell
2013-03-15 15:35 ` Ian Jackson
2013-03-15 13:15 ` Ian Campbell [this message]
2013-03-15 15:24 ` [PATCH 2/9] blktap2: use sys/eventfd.h if it is available Ian Jackson
2013-03-15 13:15 ` [PATCH 3/9] tools: only build blktap1 on x86 Ian Campbell
2013-03-15 15:24 ` Ian Jackson
2013-03-15 13:15 ` [PATCH 4/9] tools: only check for Python devel tools if not cross-compiling Ian Campbell
2013-03-15 15:27 ` Ian Jackson
2013-03-15 13:15 ` [PATCH 5/9] tools: libxc: arm64 support Ian Campbell
2013-03-15 15:26 ` Ian Jackson
2013-03-15 16:31 ` Tim Deegan
2013-03-15 13:15 ` [PATCH 6/9] tools: memshr: " Ian Campbell
2013-03-15 15:29 ` Ian Jackson
2013-03-19 15:52 ` Stefano Stabellini
2013-03-15 13:15 ` [PATCH 7/9] xenctx: Support arm64 Ian Campbell
2013-03-15 15:30 ` Ian Jackson
2013-03-15 15:43 ` Ian Campbell
2013-03-15 13:15 ` [PATCH 8/9] xen: arm64 uses the same I/O ABI as arm32 Ian Campbell
2013-03-19 15:48 ` Stefano Stabellini
2013-03-15 13:15 ` [PATCH 9/9] xen: arm: remove PSR_MODE_MASK from public interface Ian Campbell
2013-03-19 15:49 ` Stefano Stabellini
2013-04-11 10:09 ` [PATCH 00/09] arm: tools: build for arm64 and enable cross-compiling for both arm32 and arm64 Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1363353350-32251-2-git-send-email-ian.campbell@citrix.com \
--to=ian.campbell@citrix.com \
--cc=ian.jackson@citrix.com \
--cc=stefano.stabellini@citrix.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).