From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 122164C79; Sat, 7 Dec 2024 07:17:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733555858; cv=none; b=YCyk3a1kRmThbWrP2L47P78TRyWq24WPxvTo7bMnpko4R7TZz4gy1oDeDvcAJqsETdJWOd0PBj9sgmzdX8gvLQCE8ZEiigMzvrlVccTDRxHbMdy19u+isMhBPA+B3261N5/D1nnUm0RNrzZiEdaQQTA5B3s6jqXAAnKQxY8aNE4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733555858; c=relaxed/simple; bh=zzO/0Si0mDzTUHUMMIco8TyztL00M6LvmoCEmzGWkY8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=M2Q40xvkYaLauCa+ApL7RGOW//g/AqrFdKsqw6FXXt7uyifqRwJmyvgwA9tnakmD0vJ9UjWWpsGlSkIfvbB8DW/3+JAFjyr7S91B+zD9bWT2KbL3TVhgogdbnF2l/l6U6fFw/2Ty9idI77QpdKm6zJJKfhkCxN011g7UNvf8qm0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JBgv3zx9; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JBgv3zx9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5BFA8C4CECD; Sat, 7 Dec 2024 07:17:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733555857; bh=zzO/0Si0mDzTUHUMMIco8TyztL00M6LvmoCEmzGWkY8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=JBgv3zx9ShqueUxc0ml896JXjUOW2lDRx00E78k57mndpxaTXxNOrwS/ei1IAjeeJ QthwVKp3Qo+h9Yp+WKjjWdLPnvdD0RBWVMPK8RosbsrVWKBpRu1GYnP3bsGLasLYp6 bTb1kYXmGEaKjqWRhmm++eFvmq+dkXD9im4nIdlz8l17n1kgkXYjSLNjGtUXfP13RF DlQ3SvVDK5CViXIjzU9As6th0lC1kXuMTV160eSWG4ToRXwmc1Nt+7OMUvvZAorevl TWemyunAxxSYIDz7JGAmPCXHE3VB0bvLiKZYd7YUAxgnXbRHnsQHiffLf4SxZs9fca BW8C2MRqR3iVQ== Date: Sat, 7 Dec 2024 07:17:36 +0000 From: Wei Liu To: Olaf Hering Cc: linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui Subject: Re: [PATCH v1] tools/hv: reduce resouce usage in hv_get_dns_info helper Message-ID: References: <20241202120432.21115-1-olaf@aepfle.de> Precedence: bulk X-Mailing-List: linux-hyperv@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20241202120432.21115-1-olaf@aepfle.de> On Mon, Dec 02, 2024 at 01:04:10PM +0100, Olaf Hering wrote: > Remove the usage of cat. Replace the shell process with awk with 'exec'. > Also use a generic shell because no bash specific features will be used. > > Signed-off-by: Olaf Hering The resource saving is not a lot, but nonetheless: Acked-by: Wei Liu > --- > tools/hv/hv_get_dns_info.sh | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/tools/hv/hv_get_dns_info.sh b/tools/hv/hv_get_dns_info.sh > index 058c17b46ffc..268521234d4b 100755 > --- a/tools/hv/hv_get_dns_info.sh > +++ b/tools/hv/hv_get_dns_info.sh > @@ -1,4 +1,4 @@ > -#!/bin/bash > +#!/bin/sh > > # This example script parses /etc/resolv.conf to retrive DNS information. > # In the interest of keeping the KVP daemon code free of distro specific > @@ -10,4 +10,4 @@ > # this script can be based on the Network Manager APIs for retrieving DNS > # entries. > > -cat /etc/resolv.conf 2>/dev/null | awk '/^nameserver/ { print $2 }' > +exec awk '/^nameserver/ { print $2 }' /etc/resolv.conf 2>/dev/null >