From patchwork Sun Aug 30 12:49:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 1353939 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::438; helo=mail-wr1-x438.google.com; envelope-from=swupdate+bncbcxploxj6ikrbtoav35akgqeawekjqi@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20161025 header.b=ECiGUemK; dkim-atps=neutral Received: from mail-wr1-x438.google.com (mail-wr1-x438.google.com [IPv6:2a00:1450:4864:20::438]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BfY7Q20Txz9sSP for ; Sun, 30 Aug 2020 22:49:20 +1000 (AEST) Received: by mail-wr1-x438.google.com with SMTP id 3sf2032640wrm.4 for ; Sun, 30 Aug 2020 05:49:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1598791758; cv=pass; d=google.com; s=arc-20160816; b=tQNIqeKlK7IMqWXA/f2FS0QCDp9Ej4LF0ebI0Oe/LLay4Zq+k2N/wo0iWMfRSPpocL pmHZ4S9wOklHqdqfEKwBvQkop/enlC16nXNpjLpQYgTXVBaVqFUKemFtZxZ98wNt1VKe kkko5TTldDlk2xaB6bZa1kWC8PO3lDvFVxnSNBe5PDPJ3K8zt+KPJXw5Ied90lOnX4cp StsFwqNWyJ3hDxcJw35r0uhlvIgMJ/PPko4OlFiieesfuXNixqmPLN6H4mhdyLXEUG9R AjZF1dWFX/Jp2kkEop9JVS37trO3IEjHHpb1j07f8CLwt38XjIOg9/UuLdctghJUTZSq yFpg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:mime-version:message-id:date :subject:cc:to:from:sender:dkim-signature; bh=km9wefpcRO0Gpm1vjfvk6EHNO2jKEoyAb2+kukgVIj0=; b=zS5hmK5gceXlaNGa/PoKtAMbVfDyhY2HjgbIbSNpLdmwgTFF3KzxiOusFUMKl56KW9 dhex12qONKiNN0EwqFrU0U9tIXUxzL/vKdaxfdZj96TKG4cslqZN7oO+10uL/hM+tM6k gekvWC3EFBtkaRpgRAvaU6MUA2ipS+7GODIeY3RwyNgVBdi4L3wdonD6bckRfW7Nxez6 msFAK62gktBxUym/Aix2WXHtjKEPKdV/bQ5KOXd5bKSUkEET4jAOtUMrjBgHEkyLLz3g 4cHVja4Fd43bq/1O2tcFJL0sC0GzkaeDbF+t1WpVj0r/Qo9JLlU0Ijci1VxHA1f6GqhL uSXA== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 2001:a60:0:28:0:1:25:1 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=km9wefpcRO0Gpm1vjfvk6EHNO2jKEoyAb2+kukgVIj0=; b=ECiGUemKfUfFRN6ub1AzPoTRuFN+mK/pKDQ1Ml3ptq9jB81TkD91VwQcS3i/Ef9hTc 97DELkYK3cB7Vm2YHq++0/EFYPKA99PhNX6l7p2Ni8nLBx56KKi8yADcZ0/6n+lkUdqq MhSo1eWUVXCEPIUmpCY2JHIj5e2/na8ZLR3KhcNFkvOuUcFR/eQZmLhjX7/kZkAGlj1O AQDqwGFIDHQ5UFsbnvC5CYzMpKDCwlYu/fCyGz8ix/vBgC3L8zLRtPu7CN3ocSfVLnSW hunW9V9c50wfbhh4ICdELtZcIryalp0pC/pX6wXeycRhCpm8Lg8hFKfuDzzMuT8BWJJx T8pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:from:to:cc:subject:date:message-id :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=km9wefpcRO0Gpm1vjfvk6EHNO2jKEoyAb2+kukgVIj0=; b=YsDN2FWD4h4Fb5WqdvnD9+FPMh5zUSGlg9d+x/5IzB/ZXy65RKaeEdg8lClzsnLNLP z2VGOT+aKUNrcQu05S5XiQ1PauC1C/9LgoqD9+h19h2eWk2gZxJxVuVH5aDBUH5SNSqp d16VGyRyHRpYgU31D/VV83dcvce5J8WHGQ5erVsXCl5dEj1sSC/ch1J250kuC8VDWRY3 c7xl4tLot8vxSY5h+r8sfu23bJ7E7XESIOpAZ1rlKJlL5sonv+sZ10ab9WJuZSdQFsY4 qAl9qNzswGoXndDLdtoPQNB9k9jEbufCw/D6nV9XrMstsNWDerL27jqxwUyWw+50lH6x HapQ== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOAM5326IFra4xVKIzQ9gEmrFD+2RTYXb2KcUu8zg7Y2nozRw5/F9AFo bx6exdGRSbDoAXWvO1wipiw= X-Google-Smtp-Source: ABdhPJyXNBK/a5tTu+aqMQFDJ6Hbcu2C2uFadplxLr4JyaJGpEp9/wRf7f/2lG1DlIIe4xjdwubQrg== X-Received: by 2002:a05:600c:24cc:: with SMTP id 12mr7460246wmu.117.1598791758168; Sun, 30 Aug 2020 05:49:18 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a1c:4c:: with SMTP id 73ls1837375wma.0.canary-gmail; Sun, 30 Aug 2020 05:49:17 -0700 (PDT) X-Received: by 2002:a1c:156:: with SMTP id 83mr6980872wmb.49.1598791757283; Sun, 30 Aug 2020 05:49:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598791757; cv=none; d=google.com; s=arc-20160816; b=qlYaV190wsC0CBDYxLZgc1SM5Hh7gDMrBaZ3GlHrbnIDzLEx4LVy/OrJCV9MrcV1sv yHJXPPKKCw3Lffdk0JQfyw/IEvnKDTqDIUAUsTcbSirOBAp1LINvTJat+WvGZ9u3I0ja 0FHjriUmItArmaDRnO/I2vHgU+STA5D2xR6LXYcD/LpO95IJt4aGKr3np1OANa3UNEAD KrZQBm3Qa1njjJ+EqFfkiL1d8AtH0nLCxj+sae4sC04zn4DSYYw1IEnw5wtolSDPjeF/ LV29ZdBYBO/0ixVcgvVjurE6nAE8GY47N0mAq4MbbJaNMuTWKt1N6G1w6Ujo2RNIiusn ZMag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from; bh=A10hiXyeADlZryiJwL+vXGRrqvQDTIwtxss+fX2XdAM=; b=og2I1i8S908PRfwbnXpINHsT+snM4dN/9/3JtsbYFQcsHqh8GBaYMnFtIkKP76oBBH F4ceiQ3JZ/uDP8rwmXYcAEPwi1ETYmexnD/+EENmpH/jBxIrTsF9vgfm4/7P7hbQ5yAY Mf/ClfPuLTfyNOR9WediSXDQxZrnNUE1DgeIPjgkwPknmmM2LDadmURxajKx6xU9gM30 7qB3+9aDYFJPCnswBkCTG4eyubOfmPHciUZR32W/EdD4F0cv5HUZtllHH0e6qEf/cmZi +4b+/T1Vrw0+kH/ol2Ksr/iEutkSR57B7pTreuQwbggSpL09eaCVJRNYf9SQDyeABsf9 2f+g== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 2001:a60:0:28:0:1:25:1 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Received: from mail-out.m-online.net (mail-out.m-online.net. [2001:a60:0:28:0:1:25:1]) by gmr-mx.google.com with ESMTPS id p11si152393wrj.5.2020.08.30.05.49.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 30 Aug 2020 05:49:17 -0700 (PDT) Received-SPF: neutral (google.com: 2001:a60:0:28:0:1:25:1 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) client-ip=2001:a60:0:28:0:1:25:1; Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4BfY7J6sFyz1rrKZ; Sun, 30 Aug 2020 14:49:16 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4BfY7J6bRwz1qxtk; Sun, 30 Aug 2020 14:49:16 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id UROX_WQzO-rD; Sun, 30 Aug 2020 14:49:16 +0200 (CEST) Received: from babic.homelinux.org (host-88-217-136-221.customer.m-online.net [88.217.136.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPS; Sun, 30 Aug 2020 14:49:16 +0200 (CEST) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id A9D114540D64; Sun, 30 Aug 2020 14:49:15 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at babic.homelinux.org Received: from babic.homelinux.org ([127.0.0.1]) by localhost (mail.babic.homelinux.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dv0AFr0ajsOs; Sun, 30 Aug 2020 14:49:09 +0200 (CEST) Received: from paperino.fritz.box (paperino.fritz.box [192.168.178.64]) by babic.homelinux.org (Postfix) with ESMTP id 8320F45403C9; Sun, 30 Aug 2020 14:49:09 +0200 (CEST) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH 1/3] Start network threads before processes Date: Sun, 30 Aug 2020 14:49:06 +0200 Message-Id: <20200830124908.88129-1-sbabic@denx.de> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Original-Sender: sbabic@denx.de X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 2001:a60:0:28:0:1:25:1 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Start core network thread before any process to make IPC working when processes are started. Signed-off-by: Stefano Babic --- core/swupdate.c | 99 +++++++++++++++++++++++-------------------------- 1 file changed, 46 insertions(+), 53 deletions(-) diff --git a/core/swupdate.c b/core/swupdate.c index f3d483b..0d610c4 100644 --- a/core/swupdate.c +++ b/core/swupdate.c @@ -924,59 +924,6 @@ int main(int argc, char **argv) memset(&sa, 0, sizeof(sa)); sa.sa_handler = sigchld_handler; sigaction(SIGCHLD, &sa, NULL); - - /* - * If just a check is required, do not - * start background processes and threads - */ - if (!opt_c) { - /* Start embedded web server */ -#if defined(CONFIG_MONGOOSE) - if (opt_w) { - start_subprocess(SOURCE_WEBSERVER, "webserver", - cfgfname, ac, av, - start_mongoose); - freeargs(av); - } -#endif - -#if defined(CONFIG_SURICATTA) - if (opt_u) { - start_subprocess(SOURCE_SURICATTA, "suricatta", - cfgfname, argcount, - argvalues, start_suricatta); - - freeargs(argvalues); - } -#endif - -#ifdef CONFIG_DOWNLOAD - if (opt_d) { - start_subprocess(SOURCE_DOWNLOADER, "download", - cfgfname, dwlac, - dwlav, start_download); - freeargs(dwlav); - } -#endif - - /* - * Start all processes added in the config file - */ - struct extproc *proc; - - LIST_FOREACH(proc, &swcfg.extprocs, next) { - dwlav = splitargs(proc->exec, &dwlac); - - dwlav[dwlac] = NULL; - - start_subprocess_from_file(SOURCE_UNKNOWN, proc->name, - cfgfname, dwlac, - dwlav, dwlav[0]); - - freeargs(dwlav); - } - } - #ifdef CONFIG_UBIATTACH if (strlen(swcfg.globals.mtdblacklist)) mtd_set_ubiblacklist(swcfg.globals.mtdblacklist); @@ -1026,6 +973,52 @@ int main(int argc, char **argv) network_daemon = start_thread(network_initializer, &swcfg); start_thread(progress_bar_thread, NULL); + + /* Start embedded web server */ +#if defined(CONFIG_MONGOOSE) + if (opt_w) { + start_subprocess(SOURCE_WEBSERVER, "webserver", + cfgfname, ac, av, + start_mongoose); + freeargs(av); + } +#endif + +#if defined(CONFIG_SURICATTA) + if (opt_u) { + start_subprocess(SOURCE_SURICATTA, "suricatta", + cfgfname, argcount, + argvalues, start_suricatta); + + freeargs(argvalues); + } +#endif + +#ifdef CONFIG_DOWNLOAD + if (opt_d) { + start_subprocess(SOURCE_DOWNLOADER, "download", + cfgfname, dwlac, + dwlav, start_download); + freeargs(dwlav); + } +#endif + + /* + * Start all processes added in the config file + */ + struct extproc *proc; + + LIST_FOREACH(proc, &swcfg.extprocs, next) { + dwlav = splitargs(proc->exec, &dwlac); + + dwlav[dwlac] = NULL; + + start_subprocess_from_file(SOURCE_UNKNOWN, proc->name, + cfgfname, dwlac, + dwlav, dwlav[0]); + + freeargs(dwlav); + } } if (opt_i) {