From patchwork Mon Jun 26 14:28:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 780745 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wxBHn0XYwz9s65 for ; Tue, 27 Jun 2017 00:28:35 +1000 (AEST) Received: from localhost ([::1]:46929 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPV0B-0001aL-UL for incoming@patchwork.ozlabs.org; Mon, 26 Jun 2017 10:28:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41882) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPUzs-0001aD-3H for qemu-devel@nongnu.org; Mon, 26 Jun 2017 10:28:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dPUzr-0007NM-5i for qemu-devel@nongnu.org; Mon, 26 Jun 2017 10:28:12 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:37343) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dPUzq-0007Ko-Up for qemu-devel@nongnu.org; Mon, 26 Jun 2017 10:28:11 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.84_2) (envelope-from ) id 1dPUzh-0007s6-G3; Mon, 26 Jun 2017 15:28:01 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 26 Jun 2017 15:28:00 +0100 Message-Id: <1498487280-17836-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 2.7.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PATCH v2] main_loop: Make main_loop_wait() return void X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Stefan Hajnoczi , patches@linaro.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" In commit e330c118f2a5a the last usage of main_loop_wait() that cared about the return value was 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 Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Stefan Hajnoczi --- 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, 3 insertions(+), 7 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..0b25405 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,14 @@ 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; + return; } /* Functions to operate on the main QEMU AioContext. */