From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3E889606A320 for ; Mon, 30 Nov 2026 21:53:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=networkplumber-org.20260707.gappssmtp.com header.i=@networkplumber-org.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=YZX2wNhx Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5DCE140A87; Mon, 30 Nov 2026 22:52:27 +0100 (CET) Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) by mails.dpdk.org (Postfix) with ESMTPS id DB3EE40679 for ; Mon, 30 Nov 2026 22:52:16 +0100 (CET) Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-8a05b210703so5157589b3a.0 for ; Mon, 30 Nov 2026 13:52:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20260707.gappssmtp.com; s=20260707; t=1796075535; x=1796680335; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=RvnTuB1WZqYgQ27pLSdsYK9ueD/MaeU285prjtF8SoU=; b=YZX2wNhxMZm6Al5p1Nv1Ov4LrwqcmoNKv5xZeyOhKeR2MPjiS92aqXynC+eeIbzXh0 onCfJHVPPXJTiLkLckcERruPm5ut2LqZn2yc1GMBvyP24MA8CB+0WyHSxb8YIox+8gpp LpxgSKcG2rpoRI2sXcfT+J+LN21Gv0vXUokV0ou8eC2IBQcpnY31p1SGByhAAkp8/bMv uqQblLIH4fcgGUUDm0L5KtAVCMayAMTShD2fZgAEZGX3aq+K6OA+95Z3tM+Rzj3U4ODa HWXr5IPqxfHIjpLzhLA7JVZ/z7wH7PBMefJuN9nUoHBbW5wWOCYUG2l0ooIznkDZ0Fgk oNUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796075535; x=1796680335; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=RvnTuB1WZqYgQ27pLSdsYK9ueD/MaeU285prjtF8SoU=; b=OiZfVPA/AIvbOSZIhBNbFUbcr+jDy5KMURDzh4LsspPbhVFhtWWtoCpwb21Sklxim3 t3VtJpLh1ASimmtyj6RO/H7Yc8LHFHfvFCcYQBMjvJlEKtKhMes3nERT7rixsaiOyg1r 3hvpUf7yPGyPxAMPDJmKmtDii2FZqvVVKW4j2c7UNpCm6cDCW0PQxXq3tZr88Ed1L8VR 82KCzUixbbNRhZ0XMdxrmqRvD6PJ2lrH4tSOw4kS4AhQdbg+BXfxog2k4AvI9yvs1H5Z pQIHOaSz6ZxetzYkSrArb02b2exrVyLLko+/KGlF78lME6ejn0OqF9hzeuJCSMw3Xayt CdTA== X-Gm-Message-State: APuU4Z9d1uhMg6hvEBIhNHH17hjz2LyAcvm1yL6aS4hwhzTprhTwrlLw AgPuhPH4RRiBiPlX2DkuoPNE0TgUIywRWa/K+qAH6mYc6nmCArIWI5LH+idUJqDVO3pkOB6vwN0 MD28hmxA= X-Gm-Gg: AZFdTZeCXr448NXhyOvFTPtBmvTM57AZYbEtEcRpCisT6QF26PcvAeVwILud3iL8cF+ lg/dSDHnG88lCZEK40I34VK1FQfZjSyrPRSLepV2YJu9svXETeaRqjJDI2SeAOn5hJQb+rNeuu7 2k8v9omjVDnnXiWv59c97Z7vOid0GgIn1i8rF8KZaJ0c69r/1/uu/3YuXykolrYCFHq0tuDhwU2 trjU1bCBjs6Stp6hcUGnNhzT8x7yr0hKPZ/dDPf18oCGc0zxbaQ8G1oOm+vgPeekcVPm7Vw3x4J GqW1b7OHcqOOvjadwaNW2lhJzSNUGssxrNBpO0p4+5EsI5VyZuEJSef94TNd9sZt6uBXyfOPAvY yLPr2m9u9pphOO4KVwh23GA1QbNits+WA0JuAYThsG6IqFwfDs/WzBaL48B98HPnvmnuJg7au/v ctrRziVfhdxlrlRT/Jv9LDRiYfrV1XZe3hyJU1fEtdfaOgHglu1cfLmU3C9l6+Ka+Qtmz2moSkw zCh+4KXmm2+d3r1wGfM5t+TK322JLygWRdIb4RzNY9xlu6e4r9J0qW3UynDpRz8hZtIwXBEdlMd pisGnS+uqZy1TRPgHPal5haWpcJIC/0v072f20MgHUYsEQ3030WwQpR0jSstFzceetI7 X-Received: by 2002:a05:6a00:1301:b0:881:be70:4490 with SMTP id d2e1a72fcca58-8c87c38b63emr35258092b3a.28.1796075535292; Mon, 30 Nov 2026 13:52:15 -0800 (PST) Received: from phoenix.lan (204-195-112-43.wavecable.com. [204.195.112.43]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8c872e45756sm18561940b3a.27.2026.11.30.13.52.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2026 13:52:15 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Subject: [PATCH v2 14/38] examples/multi_process: handle SIGINT and SIGTERM in client Date: Mon, 30 Nov 2026 13:49:20 -0800 Message-ID: <20261130215203.886245-15-stephen@networkplumber.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261130215203.886245-1-stephen@networkplumber.org> References: <20261129205006.1440292-1-stephen@networkplumber.org> <20261130215203.886245-1-stephen@networkplumber.org> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Archive: List-Post: List-Help: List-Subscribe: , X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 The packet handling loop in main() never terminates, so the rte_eal_cleanup() after it is unreachable. Clang reports this with -Wunreachable-code. Add a signal handler setting force_quit, as done by the server process and others, and test it in the loop so that cleanup runs on exit. Return zero explicitly rather than falling off the end of main(). Signed-off-by: Stephen Hemminger --- .../client_server_mp/mp_client/client.c | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/examples/multi_process/client_server_mp/mp_client/client.c b/examples/multi_process/client_server_mp/mp_client/client.c index 087c38ef73..2916881541 100644 --- a/examples/multi_process/client_server_mp/mp_client/client.c +++ b/examples/multi_process/client_server_mp/mp_client/client.c @@ -2,6 +2,8 @@ * Copyright(c) 2010-2016 Intel Corporation */ +#include +#include #include #include #include @@ -195,9 +197,18 @@ handle_packet(struct rte_mbuf *buf) } +static volatile bool force_quit; + +static void +signal_handler(int signum) +{ + if (signum == SIGINT || signum == SIGTERM) + force_quit = true; +} + /* * Application main function - loops through - * receiving and processing packets. Never returns + * receiving and processing packets until interrupted */ int main(int argc, char *argv[]) @@ -213,6 +224,9 @@ main(int argc, char *argv[]) if ((retval = rte_eal_init(argc, argv)) < 0) return -1; + + signal(SIGINT, signal_handler); + signal(SIGTERM, signal_handler); argc -= retval; argv += retval; @@ -243,7 +257,7 @@ main(int argc, char *argv[]) printf("\nClient process %d handling packets\n", client_id); printf("[Press Ctrl-C to quit ...]\n"); - for (;;) { + while (!force_quit) { uint16_t i, rx_pkts; rx_pkts = rte_ring_dequeue_burst(rx_ring, pkts, @@ -270,4 +284,6 @@ main(int argc, char *argv[]) /* clean up the EAL */ rte_eal_cleanup(); + + return 0; } -- 2.53.0