[OpenWrt-Devel] [PATCH] [netifd/scripts] support numeric and symbolic values for signal in proto_kill_command()

John Crispin blogic at openwrt.org
Thu Oct 16 02:42:54 EDT 2014


Hi Bastian,

On 16/10/2014 08:37, Bastian Bittorf wrote:
> [netifd/scripts] support numeric and symbolic values for signal in proto_kill_command()
>
> instead of let the caller do the conversion of symbolic to numeric,
> do the conversion internally - the old mode (numeric) is still supported
looking at the code and your subject they dont match.

to me it seems that what you want to say is

"make netifd scripts recognize signal strings such as INT/TERM/KILL/..."

    John



> Signed-off-by: Bastian Bittorf <bittorf at bluebottle.com>
> ---
>  scripts/netifd-proto.sh |   15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/netifd-proto.sh b/scripts/netifd-proto.sh
> index ce316c4..6625053 100644
> --- a/scripts/netifd-proto.sh
> +++ b/scripts/netifd-proto.sh
> @@ -286,11 +286,22 @@ proto_run_command() {
>  }
>  
>  proto_kill_command() {
> -	local interface="$1"; shift
> +	local interface="$1"
> +	local signal="$2"
>  
>  	json_init
>  	json_add_int action 2
> -	[ -n "$1" ] && json_add_int signal "$1"
> +
> +	case "$signal" in
> +		[0-9]|[0-9][0-9])
> +			json_add_int signal "$signal"
> +		;;
> +		[a-zA-Z]*)
> +			signal="$( kill -l "$signal" )"
> +			json_add_int signal "$signal"
> +		;;
> +	esac
> +
>  	_proto_notify "$interface"
>  }
>  
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list