From patchwork Tue Jan 1 23:44:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Heimpold X-Patchwork-Id: 1019860 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=heimpold.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="GzpZtQwf"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=heimpold.de header.i=@heimpold.de header.b="FMEiKu/D"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43TrS23FhYz9rxp for ; Wed, 2 Jan 2019 10:46:42 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=IkHzNLfQoR/AFrL4e54nZlWJ6PPZIp64vXypIK8RYMU=; b=GzpZtQwfCOR27p uxmXoqFzw4MWIJvw3QDaenUMDhGljC4ojp6h+/o3mtG0hftnMEU+q4Gho3JPBnxryg5CC7wnkpYKb /f11v8cR94QjBA/UVEj5OjRj6C430ifnF9uM8AMUaZ1l2wFI4kpyTUKePZ1g4RN9vPsTJGovHFaZL RWAUFTmUfcdw87rdfQnPHFw6XdQfnLBFObe3OWkn3TSxKUzriIDHeWIEnqQoVzawPy1l8DmIn3Z/k 8wLCiDoPbe4Z1iRCf3RFy831n1Uc0CPiHmGe/4Hq/kjnp6B707XCCdweuCX930rm91VfaJ7zwudkj vHqpaQ0388FOAVuTJceA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1geTjx-0005TL-Bs; Tue, 01 Jan 2019 23:46:29 +0000 Received: from mo6-p00-ob.smtp.rzone.de ([2a01:238:20a:202:5300::11]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1geTig-00030b-CD for openwrt-devel@lists.openwrt.org; Tue, 01 Jan 2019 23:45:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1546386303; s=strato-dkim-0002; d=heimpold.de; h=References:In-Reply-To:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=MJwPEN0udEdfuv1ffuRhNz2+fZuRO8DfBJmWVp/aAg8=; b=FMEiKu/DS+iF/L0cUPGaMMe1LtoTwJu/0T5I8LzZqnxqgFq3qVYG8R/JFqkFPMhs/f JqvO9XUoIcQ3fljwDwrG79CLRvlBB5X93vxgkJz8WPpjgmOa9zntIUuKRiCX0fYADdXt i/Aopqr1DPu4/ORf2uVi7oU3oynvh1vFBwFOn+X7ABbnbx5jOe1M5KxslladriP/O/sp 944RMOOjJnua6L5zhaNYK0Agai1nNlLkwu+d1G3YA20k2onRBal8wImn0Xlb+E4jG7dP TQLefTKhUCMoLd9LKwRVFyYnFshCNb+j6iyDJXonY1+XMmRdTs8wCQ215lhv7z5SMFn4 Y00Q== X-RZG-AUTH: ":O2kGeEG7b/pS1EW8QnKjhhg/vO4pzqdNytq77N6ZKUSN7PfdWTGbO3oK8Gj1rLTl4HJ2UQ==" X-RZG-CLASS-ID: mo00 Received: from tonne.mhei.heimpold.itr by smtp.strato.de (RZmta 44.9 DYNA|AUTH) with ESMTPSA id y05b79v01Nj3HZo (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Wed, 2 Jan 2019 00:45:03 +0100 (CET) Received: from kerker.mhei.heimpold.itr (kerker.mhei.heimpold.itr [192.168.8.1]) by tonne.mhei.heimpold.itr (Postfix) with ESMTP id 7063C1C7A9A; Wed, 2 Jan 2019 00:45:02 +0100 (CET) From: Michael Heimpold To: openwrt-devel@lists.openwrt.org Date: Wed, 2 Jan 2019 00:44:53 +0100 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190101_154510_929986_426142CF X-CRM114-Status: UNSURE ( 8.15 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.9 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a01:238:20a:202:5300:0:0:11 listed in] [list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain Subject: [OpenWrt-Devel] [PATCH 1/7] procd: simplify code in procd_inittab_run X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Heimpold MIME-Version: 1.0 Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org This is a trial to make it more obvious what the historically grown code is actually doing. Signed-off-by: Michael Heimpold --- v2: use Jo-Philipp Wich's proposal inittab.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/inittab.c b/inittab.c index 55554b9..c9e6c13 100644 --- a/inittab.c +++ b/inittab.c @@ -259,12 +259,9 @@ void procd_inittab_run(const char *handler) list_for_each_entry(a, &actions, list) if (!strcmp(a->handler->name, handler)) { - if (a->handler->multi) { - a->handler->cb(a); - continue; - } a->handler->cb(a); - break; + if (!a->handler->multi) + break; } } From patchwork Tue Jan 1 23:44:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Heimpold X-Patchwork-Id: 1019854 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=heimpold.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="fDwzsDsO"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=heimpold.de header.i=@heimpold.de header.b="oA5gQyMS"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43TrQt10sVz9rxp for ; Wed, 2 Jan 2019 10:45:42 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qL6GlXF4h7peM8jUF8CHqxwwvrTMenz8vBfv44u+Jsk=; b=fDwzsDsOPE2UwW xQ1EGrm/K0KqOYU2huFUqVhuidhluOOM0phxLOyHb6sok/+AhUyFN5wlEk9Hg4NqwC5Sfpvw5xGNP 4m1p/FT9Jd2S0mNVnRIJNR/y1+PzZrGkYYvnygae5tEFHvsy7nZ471MrYPDUOsv7Tf9biuo1uOoiO wdVS90GDjtbMh9GJBNih+FR0iB+imRRCYE7Etzp2KFU54CLJoY9Phdd60Ng7IhDKGT/1f1M/6XdyG 6032BmfC+mCRgiINPyfBO2nwwDH/84tnANu3klPhtDV6Zh3msZkhxqpOw1WUMshZf9tIQzz7t6Kbe jW1PAtKN4n5qblE8x5FA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1geTj7-0004V7-Dy; Tue, 01 Jan 2019 23:45:37 +0000 Received: from mo6-p00-ob.smtp.rzone.de ([2a01:238:20a:202:5300::10]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1geTig-00030W-Ep for openwrt-devel@lists.openwrt.org; Tue, 01 Jan 2019 23:45:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1546386303; s=strato-dkim-0002; d=heimpold.de; h=References:In-Reply-To:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=i7kwSUd8d9y8+vIkYA4yo96Dweue8dCGSbe/zNX82S0=; b=oA5gQyMSFq8wc50cHVyLk5u40EbeMMJVtfuuqPqJJq4D67CM+mkZFKFtyUC7vi+dOG p0MDdSXYLovjca0EXsANwSgKLI5rVdJRBVDH6gHS4AiEHSRXwSR+EVFtP8oVYQ/APEf3 Syo1TAm7bKbPAKGBzJm2LAbyGdFYgbe8OOpThRFwEu5cKxSQrgDFS+T4RFZFJplLa5zq xTp0LD2SaZrKDLDQMNhewMhp51vF305qgwMNmyFyZQG6PWH94PJnn5XTDyty7XuhbQBd 3O/C29YIGE/JVcAAR606SU8mYCG/1LU9OkpMf9zafpoxsP11qUYJa5PAyYBRyfSn1id8 NZFQ== X-RZG-AUTH: ":O2kGeEG7b/pS1EW8QnKjhhg/vO4pzqdNytq77N6ZKUSN7PfdWTGbO3oK8Gj1rLTl4HJ2UQ==" X-RZG-CLASS-ID: mo00 Received: from tonne.mhei.heimpold.itr by smtp.strato.de (RZmta 44.9 DYNA|AUTH) with ESMTPSA id y05b79v01Nj3HZn (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Wed, 2 Jan 2019 00:45:03 +0100 (CET) Received: from kerker.mhei.heimpold.itr (kerker.mhei.heimpold.itr [192.168.8.1]) by tonne.mhei.heimpold.itr (Postfix) with ESMTP id 8389E1C7A9B; Wed, 2 Jan 2019 00:45:02 +0100 (CET) From: Michael Heimpold To: openwrt-devel@lists.openwrt.org Date: Wed, 2 Jan 2019 00:44:54 +0100 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190101_154510_923764_3FAF3662 X-CRM114-Status: UNSURE ( 9.84 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.9 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a01:238:20a:202:5300:0:0:10 listed in] [list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain Subject: [OpenWrt-Devel] [PATCH 2/7] procd: guard fork_worker calls X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Heimpold MIME-Version: 1.0 Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Usually respawn(), askfirst(), askconsole() and rcrespawn() are run only one time to start a worker child for the given inittab entry. In case we want to allow calling these functions several times, we need to ensure that we do not start multiple workers at the same time for the same inittab item. For this, we can re-use the remembered pid of the worker child, however, we need to reset this pid to allow a new instance in case the previous child exited. Signed-off-by: Michael Heimpold --- inittab.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/inittab.c b/inittab.c index c9e6c13..b8552e9 100644 --- a/inittab.c +++ b/inittab.c @@ -120,14 +120,17 @@ static void child_exit(struct uloop_process *proc, int ret) { struct init_action *a = container_of(proc, struct init_action, proc); - DEBUG(4, "pid:%d\n", proc->pid); - uloop_timeout_set(&a->tout, a->respawn); + DEBUG(4, "pid:%d, exitcode:%d\n", proc->pid, ret); + proc->pid = 0; + + uloop_timeout_set(&a->tout, a->respawn); } static void respawn(struct uloop_timeout *tout) { struct init_action *a = container_of(tout, struct init_action, tout); - fork_worker(a); + if (!a->proc.pid) + fork_worker(a); } static void rcdone(struct runqueue *q) @@ -163,7 +166,8 @@ static void askfirst(struct init_action *a) a->respawn = 500; a->proc.cb = child_exit; - fork_worker(a); + if (!a->proc.pid) + fork_worker(a); } static void askconsole(struct init_action *a) @@ -197,7 +201,8 @@ static void askconsole(struct init_action *a) a->respawn = 500; a->proc.cb = child_exit; - fork_worker(a); + if (!a->proc.pid) + fork_worker(a); } static void rcrespawn(struct init_action *a) @@ -206,7 +211,8 @@ static void rcrespawn(struct init_action *a) a->respawn = 500; a->proc.cb = child_exit; - fork_worker(a); + if (!a->proc.pid) + fork_worker(a); } static struct init_handler handlers[] = { From patchwork Tue Jan 1 23:44:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Heimpold X-Patchwork-Id: 1019856 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=heimpold.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="aY/HIjPC"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=heimpold.de header.i=@heimpold.de header.b="s3iTwepI"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43TrRF6n4rz9rxp for ; Wed, 2 Jan 2019 10:46:01 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=I4rIvXBzMq1bXKr8yNyruvLibW3otGatPHySQBZE8SY=; b=aY/HIjPCHztmq7 IaGivLV8dVqpS/Wj6V62Q99dqxK+U68SvpFk7AOqHLl/j7/CRgpJYHpu89toBb1FW+TANMElrbsOn Kgp5vtkUq7CvzVpiM6t3M+tYXhiWBgmbMIzed4IOQuk+Me0unfx0dg/m6k3EHaxIVCFMS13TJh4L8 khfAtiVbKvvtxOC3o6PpgwKaeUFUk8KVMa4co959BzE8dOicZWGA1JwaSjBmR6obVrH6cqF0/xg6I UGBZaKVe5+S9JlQUtqiZWN8aDlkTrto5oLY1iRWk4yprqg153wkesoQEMYSyKe7k0yuWrMLxkiJ2K tjmON7PWncmGKLFN+TUA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1geTjJ-0004ji-Uu; Tue, 01 Jan 2019 23:45:49 +0000 Received: from mo6-p00-ob.smtp.rzone.de ([2a01:238:20a:202:5300::11]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1geTig-00030V-E3 for openwrt-devel@lists.openwrt.org; Tue, 01 Jan 2019 23:45:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1546386303; s=strato-dkim-0002; d=heimpold.de; h=References:In-Reply-To:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=65ptUHhBAp6kr+PgzgyjbpHHfFXL6DMTu4pzKLti4hA=; b=s3iTwepIJmKzwYMijZ2hF4ra4OIzXmvUEGgsPKR1vFOzzDoB4oTQvMN217AF8u8jBD FZMFzug4qVK6YfUeBFOW8Wb2Ho5rsAhryZLhiARqqhwInw5AuRUJlC/26ALI7I0mHtN6 ymRU/2UDx0tfQw4IZuBiOdn0TS++dnz9U4xg+dwdGTirbp4D4vpxKJXJMR5Vzpo8QjUF AjROp53/stpclbcHFBv95MY93eWkMwif2vaNopvPQnox1A3LnJvVqdz1iBQyMtgAWQcr lHI7ffyLZKGxPn5ygBy0dBqe7ZMCh53zftE9OaARv2IQ4GKeJNISBel9rHKPNl/t2paO VuoA== X-RZG-AUTH: ":O2kGeEG7b/pS1EW8QnKjhhg/vO4pzqdNytq77N6ZKUSN7PfdWTGQORRBv+ASfYPl1MvNNIX2auzOwM9p4BBr44tR1BG9NeeWg9zWig==" X-RZG-CLASS-ID: mo00 Received: from tonne.mhei.heimpold.itr by smtp.strato.de (RZmta 44.9 AUTH) with ESMTPSA id y05b79v01Nj3HZp (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Wed, 2 Jan 2019 00:45:03 +0100 (CET) Received: from kerker.mhei.heimpold.itr (kerker.mhei.heimpold.itr [192.168.8.1]) by tonne.mhei.heimpold.itr (Postfix) with ESMTP id 93F1E1C7AAF; Wed, 2 Jan 2019 00:45:02 +0100 (CET) From: Michael Heimpold To: openwrt-devel@lists.openwrt.org Date: Wed, 2 Jan 2019 00:44:55 +0100 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190101_154510_925877_F0A5FE30 X-CRM114-Status: UNSURE ( 7.65 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.9 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a01:238:20a:202:5300:0:0:11 listed in] [list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain Subject: [OpenWrt-Devel] [PATCH 3/7] procd: skip respawn in case device disappeared X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Heimpold MIME-Version: 1.0 Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Signed-off-by: Michael Heimpold --- inittab.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/inittab.c b/inittab.c index b8552e9..18023f5 100644 --- a/inittab.c +++ b/inittab.c @@ -123,6 +123,11 @@ static void child_exit(struct uloop_process *proc, int ret) DEBUG(4, "pid:%d, exitcode:%d\n", proc->pid, ret); proc->pid = 0; + if (!dev_exist(a->id)) { + DEBUG(4, "Skipping respawn: device '%s' does not exist anymore\n", a->id); + return; + } + uloop_timeout_set(&a->tout, a->respawn); } From patchwork Tue Jan 1 23:44:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Heimpold X-Patchwork-Id: 1019853 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=heimpold.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="B9Dkxcj9"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=heimpold.de header.i=@heimpold.de header.b="or/jVPRU"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43TrQm3N0qz9rxp for ; Wed, 2 Jan 2019 10:45:36 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cIrirmLGMVd6RQLM1EY6gAwp8uqN/1iYVt8wKk8cjpQ=; b=B9Dkxcj9cBEHg4 tTp9BK1fdNuR1YVavUCWYKlT04awN5WoLujUNGoqwE/NKxBa/1upToq17aYKSYGSnLJKv9s7JDWJ1 jmaEWE8+45DLl3FLrW018JAaBizoFFURk4MTUKuo7qDJqMGTR+vSqUKSY7QvlTXUwPhAooou9AiZW pxPu09Y/oP7wPL46p/++gA+UIvwx/QDuYjEJO9CrezyQUeubkoQD4RWOJ3dNbstjNSd9GhT3kxolZ iUDJXYXxoDEmpSgKwdwVW4UJxWiLym8Rk+LDi2/tE3I3/tKvtfFP1yn/3muJu0+RrHhIwGgrygCW2 uE+ihYpQjVFtsn5hAyWw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1geTiv-0004Hd-Lh; Tue, 01 Jan 2019 23:45:25 +0000 Received: from mo6-p00-ob.smtp.rzone.de ([2a01:238:20a:202:5300::2]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1geTig-00030S-Ah for openwrt-devel@lists.openwrt.org; Tue, 01 Jan 2019 23:45:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1546386303; s=strato-dkim-0002; d=heimpold.de; h=References:In-Reply-To:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=Wv8grdURwv5blfM9ol67Z0sU+YRPBh682u38FQvZkJg=; b=or/jVPRU/l+2TNxxisjmVzfo6Xjpcz4QitEkxcLF5pJC+ffLRHV8WkdoJgV2+4DrDp zaQ/JqGydgvlgNhFSw5Xt+f7tsuZ/PCuETsm/SVC8u6XKW+8rspF4UQj7uUwZNXU9gYT RQKtDyy9abgVFWBCq816eie+eiuRBrSnlaEhR5ASsRVoxEZspCrv3dJnz5FopjHMUA9o BmEW47ONxJUcQO0LPkKMT84utcztbb3R/rYPMiDKjY6knf0i1TcjVNE/YDc/JB2oA8GQ KshMkLab4UwwYsIo2PaJzGv8XyVkOONjw2+QYO37z+CFBu3f8QUjUTxUAzTjge0BSEa4 8T2Q== X-RZG-AUTH: ":O2kGeEG7b/pS1EW8QnKjhhg/vO4pzqdNytq77N6ZKUSN7PfdWTGbO3oK8Gj1rLTl4HJ2UQ==" X-RZG-CLASS-ID: mo00 Received: from tonne.mhei.heimpold.itr by smtp.strato.de (RZmta 44.9 DYNA|AUTH) with ESMTPSA id y05b79v01Nj3HZq (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Wed, 2 Jan 2019 00:45:03 +0100 (CET) Received: from kerker.mhei.heimpold.itr (kerker.mhei.heimpold.itr [192.168.8.1]) by tonne.mhei.heimpold.itr (Postfix) with ESMTP id A440A1C7ABD; Wed, 2 Jan 2019 00:45:02 +0100 (CET) From: Michael Heimpold To: openwrt-devel@lists.openwrt.org Date: Wed, 2 Jan 2019 00:44:56 +0100 Message-Id: <71d5124a90a8975fb846a55486244dd71a25507a.1546385477.git.mhei@heimpold.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190101_154510_902253_F2ABE3FE X-CRM114-Status: UNSURE ( 8.89 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.9 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a01:238:20a:202:5300:0:0:2 listed in] [list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain Subject: [OpenWrt-Devel] [PATCH 4/7] procd: shift arguments for askfirst only once X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Heimpold MIME-Version: 1.0 Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org In case we want to process an inittab item multiple times (e.g. in case of hotplugging) we must not shift the arguments for askfirst multiple times. So check whether we already did it. Signed-off-by: Michael Heimpold --- inittab.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/inittab.c b/inittab.c index 18023f5..45118f4 100644 --- a/inittab.c +++ b/inittab.c @@ -165,9 +165,12 @@ static void askfirst(struct init_action *a) } a->tout.cb = respawn; - for (i = MAX_ARGS - 1; i >= 1; i--) - a->argv[i] = a->argv[i - 1]; - a->argv[0] = ask; + /* shift arguments only if not yet done */ + if (a->argv[0] != ask) { + for (i = MAX_ARGS - 1; i >= 1; i--) + a->argv[i] = a->argv[i - 1]; + a->argv[0] = ask; + } a->respawn = 500; a->proc.cb = child_exit; @@ -200,9 +203,12 @@ static void askconsole(struct init_action *a) } a->tout.cb = respawn; - for (i = MAX_ARGS - 1; i >= 1; i--) - a->argv[i] = a->argv[i - 1]; - a->argv[0] = ask; + /* shift arguments only if not yet done */ + if (a->argv[0] != ask) { + for (i = MAX_ARGS - 1; i >= 1; i--) + a->argv[i] = a->argv[i - 1]; + a->argv[0] = ask; + } a->respawn = 500; a->proc.cb = child_exit; From patchwork Tue Jan 1 23:44:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Heimpold X-Patchwork-Id: 1019859 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=heimpold.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="K+aA6CYB"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=heimpold.de header.i=@heimpold.de header.b="PorFSqLG"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43TrRd0Nfxz9rxp for ; Wed, 2 Jan 2019 10:46:21 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=m8yOrviH26ALSKyu6gw8eORIQtzkiIpGOzUDcoW0BNM=; b=K+aA6CYBQFft3C l9N2ctPceKPpQOqnyenqOf/R+h/NY56zWt2mmvoLMXkbv1EBjlg731mxxX2H4RUirkEhjh73rytrN wHIzyuRPakCqsaSezHwda3hlcTujQaQmv8AsA0q7UOntq3CgGVagh+I5Z9DDYs8QWIkPCTl8Knyjn Ll9IkRkBmhRoxilb6yu0NmCaN1g9154RYKgVoTSK3tZsIe8K5H0AeaSFHbKvoh7HyHlqXMYQvq8jo r6D8xYVLhzWgR3bDxJ963kuO2fpUthtNZ1STeDOKs18uBTzAXlxBwFtyiuexRNlEoBhnaI4KfuF1q aR5+BIGE5V1MMPFj1Vjg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1geTjl-0005GM-3W; Tue, 01 Jan 2019 23:46:17 +0000 Received: from mo6-p01-ob.smtp.rzone.de ([2a01:238:20a:202:5301::4]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1geTig-00032t-Dq for openwrt-devel@lists.openwrt.org; Tue, 01 Jan 2019 23:45:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1546386303; s=strato-dkim-0002; d=heimpold.de; h=References:In-Reply-To:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=5r3B2jL2mkv+rJyRhmyJePq+AH9C0nL1+y1uo4VV+2k=; b=PorFSqLGyWpt8kv5RvAOU7HyNJue0vMEBvR5nfhYaK+COTZSV9V1XGINK7A0170HXe fCH1PNu7J2lzv6BR84rbggffisow+6SYChDJe9spEDam+DE1+kWUBqexDL/C3366QnIU wbY0xH+w2BZfNAvF5pks9Tbz7XlyF9QdTafaT07mxqgFig187ENhB06lOy5v2XMbz6Zv t7+HW2UkZEe1CE087zH2g8Lm43VF2Qs0KvId3Q4fuoJo2neuWnA/IPjIOv9fnglkrDIE XcrBOYIV4XT3qx+jNJVi26sp4tiQT2rLKngNHyKmirQHX9lz+RySFctp+gCposCfLRj9 TFaw== X-RZG-AUTH: ":O2kGeEG7b/pS1EW8QnKjhhg/vO4pzqdNytq77N6ZKUSN7PfdWTGQORRBv+ASfYPl1MvNNIX2auzOwM9p4BBr44tR1BG9NeeWg9zWig==" X-RZG-CLASS-ID: mo00 Received: from tonne.mhei.heimpold.itr by smtp.strato.de (RZmta 44.9 AUTH) with ESMTPSA id y05b79v01Nj3HZt (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Wed, 2 Jan 2019 00:45:03 +0100 (CET) Received: from kerker.mhei.heimpold.itr (kerker.mhei.heimpold.itr [192.168.8.1]) by tonne.mhei.heimpold.itr (Postfix) with ESMTP id B76B01C7ABE; Wed, 2 Jan 2019 00:45:02 +0100 (CET) From: Michael Heimpold To: openwrt-devel@lists.openwrt.org Date: Wed, 2 Jan 2019 00:44:57 +0100 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190101_154510_931674_6D6CB5B3 X-CRM114-Status: UNSURE ( 8.39 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.9 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a01:238:20a:202:5301:0:0:4 listed in] [list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain Subject: [OpenWrt-Devel] [PATCH 5/7] procd: add start-console support X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Heimpold MIME-Version: 1.0 Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org This adds a hotplug function to (re-)start inittab entries with askfirst or respawn. At the moment the devices used with these actions must be present during boot otherwise such lines are skipped. However, this prevents having inittab entries with consoles for e.g. USB gadget devices which only appear after kernel module loading and after configuring them with configfs. While it was possible to only scan the inittab for the desired item to start, I assume the inittab to be short and re-running the whole list will be negligible. Signed-off-by: Michael Heimpold --- plug/hotplug.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/plug/hotplug.c b/plug/hotplug.c index 80e6e4d..6b5960a 100644 --- a/plug/hotplug.c +++ b/plug/hotplug.c @@ -297,12 +297,27 @@ send_to_kernel: exit(-1); } +static void handle_start_console(struct blob_attr *msg, struct blob_attr *data) +{ + char *dev = blobmsg_get_string(blobmsg_data(data)); + + DEBUG(2, "Start console request for %s\n", dev); + + procd_inittab_run("respawn"); + procd_inittab_run("askfirst"); + + DEBUG(2, "Done starting console for %s\n", dev); + + exit(-1); +} + enum { HANDLER_MKDEV = 0, HANDLER_RM, HANDLER_EXEC, HANDLER_BUTTON, HANDLER_FW, + HANDLER_START_CONSOLE, }; static struct cmd_handler { @@ -336,6 +351,10 @@ static struct cmd_handler { .name = "load-firmware", .handler = handle_firmware, }, + [HANDLER_START_CONSOLE] = { + .name = "start-console", + .handler = handle_start_console, + }, }; static void queue_next(void) From patchwork Tue Jan 1 23:44:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Heimpold X-Patchwork-Id: 1019852 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=heimpold.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="lkwETiMO"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=heimpold.de header.i=@heimpold.de header.b="qNZOjwH9"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43TrQR6tQCz9rxp for ; Wed, 2 Jan 2019 10:45:19 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hQe7XqaTnNW8uCUNQn6Hsq9gqmmtRoHtR37G6RMrXDA=; b=lkwETiMOexBwJm pTdJOAtUwEXpbtASOtjqPXVVn4V+AGVi9dX99Wyq6yujz30kQ0DCa21pCjSn4QOwqUIWNndZC0bh8 yLU5NvGa9nzWITf6+rY1giLe2f4HQpeXxVKp5ydppLB+AiP5/alC0G9D8acVTx3nvvFyAOzJWX7Op BVbtcLaVLMOAbjnfUABzKKEfyIG3i0iS8iVCUWmO5WPmwA4jir8cOhxPWPxcbA7mgNP1gBTEHM9g4 y+jPMPqJ7i/MrvFHtn8UGBQag0RZ4LFBrasCT7fIN74WeQHZY8W3LMspvukDu6TbpKcGjOa7N/QqY ktUf047D97xVcm7mOJ/A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1geTil-00047A-El; Tue, 01 Jan 2019 23:45:15 +0000 Received: from mo6-p00-ob.smtp.rzone.de ([2a01:238:20a:202:5300::3]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1geTig-00032H-Ee for openwrt-devel@lists.openwrt.org; Tue, 01 Jan 2019 23:45:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1546386303; s=strato-dkim-0002; d=heimpold.de; h=References:In-Reply-To:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=hD7mGVbBWdlvCnQhduHnbF4NXJbA2g8V2cjHJ+bWq8g=; b=qNZOjwH9Pr21AXt2gDGZsl18S7hqt7D9XNJZPicxOdxCFG3vuQudEyCa8DoAfzSSIc m4WBjhNefPdeDUj0Apa9ytybhBR0YR1FL3IG1Hd0GHtP7HJeKfShI1Z0n77BUzGu86ZY XVJfTHQ2R0Lj768OjfJqByZJ7d5eHWzy8ztrN5O0YEuWS7dz0EVojrrEbafGmqEDK4IL whWNWJtb6h/fOfbdzaA5Ewgei2XYsVzJY6NgLTp8KiHomTW8EYGRopVwYXyyxovmaZlI oTtf9IxbPsJePXkarITIbmLAYov9BI6lky3JvySCtfNTwesnLUuCIrnMNAp93NA04drf VJtg== X-RZG-AUTH: ":O2kGeEG7b/pS1EW8QnKjhhg/vO4pzqdNytq77N6ZKUSN7PfdWTGQORRBv+ASfYPl1MvNNIX2auzOwM9p4BBr44tR1BG9NeeWg9zWig==" X-RZG-CLASS-ID: mo00 Received: from tonne.mhei.heimpold.itr by smtp.strato.de (RZmta 44.9 AUTH) with ESMTPSA id y05b79v01Nj3HZr (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Wed, 2 Jan 2019 00:45:03 +0100 (CET) Received: from kerker.mhei.heimpold.itr (kerker.mhei.heimpold.itr [192.168.8.1]) by tonne.mhei.heimpold.itr (Postfix) with ESMTP id CFF391C7ABF; Wed, 2 Jan 2019 00:45:02 +0100 (CET) From: Michael Heimpold To: openwrt-devel@lists.openwrt.org Date: Wed, 2 Jan 2019 00:44:58 +0100 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190101_154510_917767_C2D047E5 X-CRM114-Status: UNSURE ( 6.84 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.9 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a01:238:20a:202:5300:0:0:3 listed in] [list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain Subject: [OpenWrt-Devel] [PATCH 6/7] procd: add upgraded binary to .gitignore X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Heimpold MIME-Version: 1.0 Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Signed-off-by: Michael Heimpold --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 9d80a74..eaf1ef4 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ procd askfirst udevtrigger init +upgraded/upgraded .* Makefile CMakeCache.txt From patchwork Tue Jan 1 23:44:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Heimpold X-Patchwork-Id: 1019858 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=heimpold.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="hwkblXpk"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=heimpold.de header.i=@heimpold.de header.b="RlC0+rEr"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43TrRN3CC7z9rxp for ; Wed, 2 Jan 2019 10:46:08 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zlBSBGfnXuJYYo2lo1Tcq9Zni3f5/Qo/gVMjy8IUHGM=; b=hwkblXpkqUFZ9Q n41RgMDxsZVTMpuLfVkktxS1QJ728HKBjDQh6WUhfAp08ad0pPzbSLpq4vVW4LVIWhAm71EXO10mB 9GEJElDulp2njv9LmkIAkhXXntkjtnzc3LO0AbJYla10cBAd2kjAFy/019glR8R2iOgIHXq8lsU3n eUyoDz45j8LxjTG9bZhcBjT3VW/zKrY/BlkR0Q/3GCEchNv3RmeeA86st0JbhzwOIOBb58dpR+8Mg nikYgkqm4BVc2iSrFVOcPn1pECBX4723Ga7LK+zs0EcGTS5TSoMGYmtCE4bd5pGIWkNV9QOFJ7Pno hD87KGxI9NMd5TkeGniw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1geTjY-00050T-Gw; Tue, 01 Jan 2019 23:46:04 +0000 Received: from mo6-p01-ob.smtp.rzone.de ([2a01:238:20a:202:5301::7]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1geTig-00033O-EO for openwrt-devel@lists.openwrt.org; Tue, 01 Jan 2019 23:45:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1546386303; s=strato-dkim-0002; d=heimpold.de; h=References:In-Reply-To:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=t3rTtFw3yB91MqIaWV5S8CrJr5SbgQFl1fOmOyqBDLQ=; b=RlC0+rEr7gwF08QlRX2JDw2jHuC8JwiAOORyyoZg4g0yw6WMNRxhXAFqd4JVaLPsPA Fgi/Eg/qtRGARjIwA4OS8McP5jMOvOzimL+xpo6hmgnZCMQNMp/BraQn7i1h7xwfWEeL SF1v/l3TgNFvoa+UJrXcwDLMyG6Aj5FCqgLqVXWIM/4pxTy606LEGNgvvoR+qaYCkKdt AIAxpodZY+DhZGiUUscC2jLoMJ/DuAQYGyGvtSHAp+8pQJuc0JGY9VzRPQB/OUgUbfrt zIebPOU3szMspsTJJtH4NO3cMfcUVtA/8a4y6zDV/1gHKkxKLAw4rYp+Y6nJ8dVuSrwk qGGA== X-RZG-AUTH: ":O2kGeEG7b/pS1EW8QnKjhhg/vO4pzqdNytq77N6ZKUSN7PfdWTGbO3oK8Gj1rLTl4HJ2UQ==" X-RZG-CLASS-ID: mo00 Received: from tonne.mhei.heimpold.itr by smtp.strato.de (RZmta 44.9 DYNA|AUTH) with ESMTPSA id y05b79v01Nj3HZs (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Wed, 2 Jan 2019 00:45:03 +0100 (CET) Received: from kerker.mhei.heimpold.itr (kerker.mhei.heimpold.itr [192.168.8.1]) by tonne.mhei.heimpold.itr (Postfix) with ESMTP id E2EF41C7AC1; Wed, 2 Jan 2019 00:45:02 +0100 (CET) From: Michael Heimpold To: openwrt-devel@lists.openwrt.org Date: Wed, 2 Jan 2019 00:44:59 +0100 Message-Id: <2ae55c8d3fb44a81f471c1ccc911ef21ddffb74a.1546385477.git.mhei@heimpold.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190101_154510_918757_6BE2F808 X-CRM114-Status: GOOD ( 11.02 ) X-Spam-Score: -0.9 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a01:238:20a:202:5301:0:0:7 listed in] [list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain Subject: [OpenWrt-Devel] [PATCH 7/7] procd: replace exit(-1) with exit(EXIT_FAILURE) X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Heimpold MIME-Version: 1.0 Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Signed-off-by: Michael Heimpold --- initd/init.c | 2 +- initd/preinit.c | 6 +++--- initd/zram.c | 4 ++-- plug/coldplug.c | 3 ++- plug/hotplug.c | 14 +++++++------- upgraded/upgraded.c | 2 +- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/initd/init.c b/initd/init.c index 0349e6e..8d012f6 100644 --- a/initd/init.c +++ b/initd/init.c @@ -91,7 +91,7 @@ main(int argc, char **argv) execvp(kmod[0], kmod); ERROR("Failed to start kmodloader: %m\n"); - exit(-1); + exit(EXIT_FAILURE); } if (pid <= 0) { ERROR("Failed to start kmodloader instance: %m\n"); diff --git a/initd/preinit.c b/initd/preinit.c index fbb36df..0b0d291 100644 --- a/initd/preinit.c +++ b/initd/preinit.c @@ -23,7 +23,7 @@ #include #include - +#include #include #include "init.h" @@ -135,7 +135,7 @@ preinit(void) if (!plugd_proc.pid) { execvp(plug[0], plug); ERROR("Failed to start plugd: %m\n"); - exit(-1); + exit(EXIT_FAILURE); } if (plugd_proc.pid <= 0) { ERROR("Failed to start new plugd instance: %m\n"); @@ -157,7 +157,7 @@ preinit(void) if (!preinit_proc.pid) { execvp(init[0], init); ERROR("Failed to start preinit: %m\n"); - exit(-1); + exit(EXIT_FAILURE); } if (preinit_proc.pid <= 0) { ERROR("Failed to start new preinit instance: %m\n"); diff --git a/initd/zram.c b/initd/zram.c index b41bfd9..2f92b3f 100644 --- a/initd/zram.c +++ b/initd/zram.c @@ -65,7 +65,7 @@ early_insmod(char *module) modprobe[1] = path; execvp(modprobe[0], modprobe); ERROR("Can't exec %s: %m\n", modprobe[0]); - exit(-1); + exit(EXIT_FAILURE); } if (pid <= 0) { @@ -108,7 +108,7 @@ mount_zram_on_tmp(void) if (!pid) { execvp(mkfs[0], mkfs); ERROR("Can't exec %s: %m\n", mkfs[0]); - exit(-1); + exit(EXIT_FAILURE); } else if (pid <= 0) { ERROR("Can't exec %s: %m\n", mkfs[0]); return -1; diff --git a/plug/coldplug.c b/plug/coldplug.c index c6a89c3..e2d1074 100644 --- a/plug/coldplug.c +++ b/plug/coldplug.c @@ -16,6 +16,7 @@ #include #include +#include #include #include "../procd.h" @@ -55,7 +56,7 @@ void procd_coldplug(void) if (!udevtrigger.pid) { execvp(argv[0], argv); ERROR("Failed to start coldplug: %m\n"); - exit(-1); + exit(EXIT_FAILURE); } if (udevtrigger.pid <= 0) { diff --git a/plug/hotplug.c b/plug/hotplug.c index 6b5960a..ed61490 100644 --- a/plug/hotplug.c +++ b/plug/hotplug.c @@ -206,7 +206,7 @@ static void handle_exec(struct blob_attr *msg, struct blob_attr *data) argv[i] = NULL; execvp(argv[0], &argv[0]); } - exit(-1); + exit(EXIT_FAILURE); } static void handle_button_start(struct blob_attr *msg, struct blob_attr *data) @@ -231,7 +231,7 @@ static void handle_firmware(struct blob_attr *msg, struct blob_attr *data) if (!file || !dir || !dev) { ERROR("Request for unknown firmware %s/%s\n", dir, file); - exit(-1); + exit(EXIT_FAILURE); } path = alloca(strlen(dir) + strlen(file) + 2); @@ -256,11 +256,11 @@ send_to_kernel: load = open(loadpath, O_WRONLY); if (!load) { ERROR("Failed to open %s: %m\n", loadpath); - exit(-1); + exit(EXIT_FAILURE); } if (write(load, "1", 1) == -1) { ERROR("Failed to write to %s: %m\n", loadpath); - exit(-1); + exit(EXIT_FAILURE); } close(load); @@ -268,7 +268,7 @@ send_to_kernel: fw = open(syspath, O_WRONLY); if (fw < 0) { ERROR("Failed to open %s: %m\n", syspath); - exit(-1); + exit(EXIT_FAILURE); } len = s.st_size; @@ -294,7 +294,7 @@ send_to_kernel: DEBUG(2, "Done loading %s\n", path); - exit(-1); + exit(EXIT_FAILURE); } static void handle_start_console(struct blob_attr *msg, struct blob_attr *data) @@ -308,7 +308,7 @@ static void handle_start_console(struct blob_attr *msg, struct blob_attr *data) DEBUG(2, "Done starting console for %s\n", dev); - exit(-1); + exit(EXIT_FAILURE); } enum { diff --git a/upgraded/upgraded.c b/upgraded/upgraded.c index 0b82f20..db98701 100644 --- a/upgraded/upgraded.c +++ b/upgraded/upgraded.c @@ -56,7 +56,7 @@ static void sysupgrade(char *path, char *command) /* Child */ execvp(args[0], args); fprintf(stderr, "Failed to exec sysupgrade\n"); - _exit(-1); + _exit(EXIT_FAILURE); } uloop_process_add(&upgrade_proc);