[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH] aio-posix: Don't use epoll if epoll_create1 not
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-block] [PATCH] aio-posix: Don't use epoll if epoll_create1 not available |
Date: |
Tue, 23 Feb 2016 11:28:53 +0000 |
User-agent: |
Mutt/1.5.24 (2015-08-30) |
On Tue, Feb 23, 2016 at 09:20:14AM +0800, Fam Zheng wrote:
> Reported-by: Matthew Fortune <address@hidden>
> Signed-off-by: Fam Zheng <address@hidden>
> ---
> aio-posix.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/aio-posix.c b/aio-posix.c
> index fa7f8ab..97e5a0c 100644
> --- a/aio-posix.c
> +++ b/aio-posix.c
> @@ -18,7 +18,9 @@
> #include "block/block.h"
> #include "qemu/queue.h"
> #include "qemu/sockets.h"
> -#ifdef CONFIG_EPOLL
> +
> +#if defined(CONFIG_EPOLL) && defined(CONFIG_EPOLL_CREATE1)
> +#define USE_EPOLL 1
Other Linux syscalls with multiple versions for CLOEXEC support tend to
be wrapped in util/osdep.c. When CLOEXEC isn't available they just skip
it rather than manually adding the flag using fcntl(2).
The following function is added:
int qemu_epoll_create(void)
{
#if defined(CONFIG_EPOLL_CREATE1)
return epoll_create1(EPOLL_CLOEXEC);
#elif defined(CONFIG_EPOLL)
return epoll_create(1);
#else
return -ENOSYS;
#endif
}
Now the rest of QEMU can rely on just CONFIG_EPOLL.
Even if you don't want to add qemu_epoll_create(), please keep things
simple by doing just s/CONFIG_EPOLL/CONFIG_EPOLL_CREATE1/ in
aio-posix.c. That way USE_EPOLL isn't needed. It's confusing to have
multiple preprocessor definitions related to epoll.
signature.asc
Description: PGP signature