diff options
author | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-09-27 20:58:43 +0000 |
---|---|---|
committer | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-09-27 20:58:43 +0000 |
commit | 27463101f15bee17d2f46642c48a7373bc6c595e (patch) | |
tree | d542c7676a0da3b27271b60df27eab23e879368a /compatfd.c | |
parent | b8ae75538e8a9db54207e6bf3da484939bb5df7e (diff) |
Make compatfd fallback more robust
Be more friendly when signalfd() fails, and also add configure checks to detect
that syscall(SYS_signalfd) actually works. malc pointed out that some installs
do not have /usr/include/linux headers that are in sync with the glibc headers
so why SYS_signalfd is defined, it's #defined to _NR_signalfd which is not
defined in the /usr/include/linux header.
While this is a distro bug, it doesn't hurt to do a more thorough job in
detection.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5334 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'compatfd.c')
-rw-r--r-- | compatfd.c | 9 |
1 files changed, 4 insertions, 5 deletions
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); |