* [PATCH v1] tools/hv: reduce resouce usage in hv_get_dns_info helper
@ 2024-12-02 12:04 Olaf Hering
2024-12-07 7:17 ` Wei Liu
0 siblings, 1 reply; 2+ messages in thread
From: Olaf Hering @ 2024-12-02 12:04 UTC (permalink / raw)
To: linux-hyperv, linux-kernel
Cc: K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui
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 <olaf@aepfle.de>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v1] tools/hv: reduce resouce usage in hv_get_dns_info helper
2024-12-02 12:04 [PATCH v1] tools/hv: reduce resouce usage in hv_get_dns_info helper Olaf Hering
@ 2024-12-07 7:17 ` Wei Liu
0 siblings, 0 replies; 2+ messages in thread
From: Wei Liu @ 2024-12-07 7:17 UTC (permalink / raw)
To: Olaf Hering
Cc: linux-hyperv, linux-kernel, K. Y. Srinivasan, Haiyang Zhang,
Wei Liu, Dexuan Cui
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 <olaf@aepfle.de>
The resource saving is not a lot, but nonetheless:
Acked-by: Wei Liu <wei.liu@kernel.org>
> ---
> 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
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-12-07 7:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-02 12:04 [PATCH v1] tools/hv: reduce resouce usage in hv_get_dns_info helper Olaf Hering
2024-12-07 7:17 ` Wei Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).