diff options
-rw-r--r-- | block-raw-posix.c | 4 | ||||
-rw-r--r-- | compatfd.c | 9 | ||||
-rwxr-xr-x | configure | 35 |
3 files changed, 43 insertions, 5 deletions
diff --git a/block-raw-posix.c b/block-raw-posix.c index 2875fa1bfc..267d6c07bd 100644 --- a/block-raw-posix.c +++ b/block-raw-posix.c @@ -584,6 +584,10 @@ static int posix_aio_init(void) s->first_aio = NULL; s->fd = qemu_signalfd(&mask); + if (s->fd == -1) { + fprintf(stderr, "failed to create signalfd\n"); + return -errno; + } fcntl(s->fd, F_SETFL, O_NONBLOCK); diff --git a/compatfd.c b/compatfd.c index 519b4d8f3f..cc5ced3967 100644 --- a/compatfd.c +++ b/compatfd.c @@ -100,11 +100,11 @@ static int qemu_signalfd_compat(const sigset_t *mask) int qemu_signalfd(const sigset_t *mask) { -#if defined(SYS_signalfd) +#if defined(CONFIG_signalfd) int ret; ret = syscall(SYS_signalfd, -1, mask, _NSIG / 8); - if (!(ret == -1 && errno == ENOSYS)) + if (ret != -1) return ret; #endif @@ -113,15 +113,14 @@ int qemu_signalfd(const sigset_t *mask) int qemu_eventfd(int *fds) { -#if defined(SYS_eventfd) +#if defined(CONFIG_eventfd) int ret; ret = syscall(SYS_eventfd, 0); if (ret >= 0) { fds[0] = fds[1] = ret; return 0; - } else if (!(ret == -1 && errno == ENOSYS)) - return ret; + } #endif return pipe(fds); @@ -110,6 +110,8 @@ curses="yes" aio="yes" nptl="yes" mixemu="no" +signalfd="no" +eventfd="no" # OS specific targetos=`uname -s` @@ -901,6 +903,33 @@ EOF fi fi +########################################## +# signalfd probe +cat > $TMPC << EOF +#define _GNU_SOURCE +#include <unistd.h> +#include <sys/syscall.h> +#include <signal.h> +int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); } +EOF + +if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then + signalfd=yes +fi + +########################################## +# eventfd probe +cat > $TMPC << EOF +#define _GNU_SOURCE +#include <unistd.h> +#include <sys/syscall.h> +int main(void) { return syscall(SYS_eventfd, 0); } +EOF + +if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then + eventfd=yes +fi + # Check if tools are available to build documentation. if [ -x "`which texi2html 2>/dev/null`" ] && \ [ -x "`which pod2man 2>/dev/null`" ]; then @@ -1229,6 +1258,12 @@ if test "$aio" = "yes" ; then echo "#define CONFIG_AIO 1" >> $config_h echo "CONFIG_AIO=yes" >> $config_mak fi +if test "$signalfd" = "yes" ; then + echo "#define CONFIG_signalfd 1" >> $config_h +fi +if test "$eventfd" = "yes" ; then + echo "#define CONFIG_eventfd 1" >> $config_h +fi # XXX: suppress that if [ "$bsd" = "yes" ] ; then |