From patchwork Tue Sep 13 04:02:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denys Dmytriyenko X-Patchwork-Id: 12682 X-Patchwork-Delegate: reatmon@ti.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E61BC6FA8A for ; Tue, 13 Sep 2022 04:02:56 +0000 (UTC) Received: from mailout4.zoneedit.com (mailout4.zoneedit.com [64.68.198.64]) by mx.groups.io with SMTP id smtpd.web12.898.1663041772223068818 for ; Mon, 12 Sep 2022 21:02:52 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: denix.org, ip: 64.68.198.64, mailfrom: denis@denix.org) Received: from localhost (localhost [127.0.0.1]) by mailout4.zoneedit.com (Postfix) with ESMTP id ABDE540D6E for ; Tue, 13 Sep 2022 04:02:51 +0000 (UTC) Received: from mailout4.zoneedit.com ([127.0.0.1]) by localhost (zmo14-pco.easydns.vpn [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kvBZTL-pNSVn for ; Tue, 13 Sep 2022 04:02:51 +0000 (UTC) Received: from mail.denix.org (pool-100-15-80-88.washdc.fios.verizon.net [100.15.80.88]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mailout4.zoneedit.com (Postfix) with ESMTPSA id 9BBDA40D7C for ; Tue, 13 Sep 2022 04:02:47 +0000 (UTC) Received: from thorin.denix (thorin.denix [192.168.30.9]) by mail.denix.org (Postfix) with ESMTP id 1F8E31749D3 for ; Tue, 13 Sep 2022 00:02:46 -0400 (EDT) From: Denys Dmytriyenko To: meta-arago@lists.yoctoproject.org Subject: [master/kirkstone][PATCH 24/52] weston-init: fix killproc for thinlinux so that it doesn't kill itself Date: Tue, 13 Sep 2022 04:02:18 +0000 Message-Id: <20220913040246.2365077-25-denis@denix.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220913040246.2365077-1-denis@denix.org> References: <20220913040246.2365077-1-denis@denix.org> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 13 Sep 2022 04:02:56 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/meta-arago/message/14030 From: Darren Etheridge busybox pidof doesn't omit the current pid as this script is called weston on the target in thinlinux with a busybox based utility load later killproc operations end up killing this script, which leads to the script not actually starting weston. Signed-off-by: Darren Etheridge Signed-off-by: Ryan Eatmon Signed-off-by: Denys Dmytriyenko --- .../recipes-graphics/wayland/weston-init/init | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/meta-arago-distro/recipes-graphics/wayland/weston-init/init b/meta-arago-distro/recipes-graphics/wayland/weston-init/init index 7a80238b..fa3f0372 100644 --- a/meta-arago-distro/recipes-graphics/wayland/weston-init/init +++ b/meta-arago-distro/recipes-graphics/wayland/weston-init/init @@ -9,8 +9,21 @@ ### END INIT INFO killproc() { - pid=`/bin/pidof $1` - [ "$pid" != "" ] && kill $pid + all_pids=`/bin/pidof $1` + + # busybox pidof doesn't ommit the current pid + # as this script is called weston on the target + # in thinlinux with a busybox based utility load + # later killproc operations end up killing this + # script. + for pid in $all_pids + do + if [ "$pid" != "$$" ]; then + kill_pids+=$pid + fi + done + + [ "$kill_pids" != "" ] && kill $kill_pids } read CMDLINE < /proc/cmdline