From: Stefan Hajnoczi <stefanha@redhat.com>
To: Fam Zheng <famz@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] aio-posix: Don't use epoll if epoll_create1 not available
Date: Tue, 23 Feb 2016 11:28:53 +0000 [thread overview]
Message-ID: <20160223112853.GE4488@stefanha-x1.localdomain> (raw)
In-Reply-To: <1456190414-14451-1-git-send-email-famz@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1385 bytes --]
On Tue, Feb 23, 2016 at 09:20:14AM +0800, Fam Zheng wrote:
> Reported-by: Matthew Fortune <Matthew.Fortune@imgtec.com>
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
> 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.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
prev parent reply other threads:[~2016-02-23 11:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-23 1:20 [Qemu-devel] [PATCH] aio-posix: Don't use epoll if epoll_create1 not available Fam Zheng
2016-02-23 11:28 ` Stefan Hajnoczi [this message]
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=20160223112853.GE4488@stefanha-x1.localdomain \
--to=stefanha@redhat.com \
--cc=famz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.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).