From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: patches@linaro.org, "Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>
Subject: [Qemu-devel] [PATCH v3 2/2] main_loop: Make main_loop_wait() return void
Date: Tue, 27 Jun 2017 18:32:49 +0100 [thread overview]
Message-ID: <1498584769-12439-3-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1498584769-12439-1-git-send-email-peter.maydell@linaro.org>
The last users of main_loop_wait() that cared about the return value
have now been changed to no longer use it. Drop the now-useless return
value and make the function return void.
We avoid the awkwardness of ifdeffery to handle the 'ret'
variable in main_loop_wait() only being wanted if CONFIG_SLIRP
by simply dropping all the ifdefs. There are stub implementations
of slirp_pollfds_poll() and slirp_pollfds_fill() already in
stubs/slirp.c which do nothing, as required.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
---
This will coincidentally satisfy Coverity, which currently complains
in CID 1372464 that we call main_loop_wait() in vl.c and ignore the
return value which may be reporting a poll() syscall failure.
Essentially we don't expect poll() to fail, except perhaps with
a transient EINTR -- if it ever did we'd spin retrying endlessly
I think.
---
include/qemu/main-loop.h | 2 +-
util/main-loop.c | 8 +-------
2 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/include/qemu/main-loop.h b/include/qemu/main-loop.h
index d7e24af..6b4b60b 100644
--- a/include/qemu/main-loop.h
+++ b/include/qemu/main-loop.h
@@ -79,7 +79,7 @@ int qemu_init_main_loop(Error **errp);
*
* @nonblocking: Whether the caller should block until an event occurs.
*/
-int main_loop_wait(int nonblocking);
+void main_loop_wait(int nonblocking);
/**
* qemu_get_aio_context: Return the main loop's AioContext
diff --git a/util/main-loop.c b/util/main-loop.c
index 19cad6b..2f48f41 100644
--- a/util/main-loop.c
+++ b/util/main-loop.c
@@ -487,7 +487,7 @@ static int os_host_main_loop_wait(int64_t timeout)
}
#endif
-int main_loop_wait(int nonblocking)
+void main_loop_wait(int nonblocking)
{
int ret;
uint32_t timeout = UINT32_MAX;
@@ -500,9 +500,7 @@ int main_loop_wait(int nonblocking)
/* poll any events */
g_array_set_size(gpollfds, 0); /* reset for new iteration */
/* XXX: separate device handlers from system ones */
-#ifdef CONFIG_SLIRP
slirp_pollfds_fill(gpollfds, &timeout);
-#endif
if (timeout == UINT32_MAX) {
timeout_ns = -1;
@@ -515,16 +513,12 @@ int main_loop_wait(int nonblocking)
&main_loop_tlg));
ret = os_host_main_loop_wait(timeout_ns);
-#ifdef CONFIG_SLIRP
slirp_pollfds_poll(gpollfds, (ret < 0));
-#endif
/* CPU thread can infinitely wait for event after
missing the warp */
qemu_start_warp_timer();
qemu_clock_run_all_timers();
-
- return ret;
}
/* Functions to operate on the main QEMU AioContext. */
--
2.7.4
next prev parent reply other threads:[~2017-06-27 17:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-27 17:32 [Qemu-devel] [PATCH v3 0/2] main_loop: Make main_loop_wait() return void Peter Maydell
2017-06-27 17:32 ` [Qemu-devel] [PATCH v3 1/2] tests/test-char.c: Don't use main_loop_wait()'s return value Peter Maydell
2017-06-27 18:07 ` Marc-André Lureau
2017-06-27 17:32 ` Peter Maydell [this message]
2017-06-30 10:47 ` [Qemu-devel] [PATCH v3 0/2] main_loop: Make main_loop_wait() return void Paolo Bonzini
2017-07-06 23:48 ` no-reply
2017-07-07 0:04 ` Fam Zheng
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=1498584769-12439-3-git-send-email-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=f4bug@amsat.org \
--cc=patches@linaro.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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).