[LEDE-DEV] [PATCH v3] procd: update procd.sh to disallow signal-numbers, enforce signal-names

Bastian Bittorf bb at npl.de
Fri Jan 13 11:22:51 PST 2017


A given signal-name is now converted to the corresonding number. In general
it's good style to use names (readability) and it's more portable: signal
numbers can be architecture-dependent, so we are more safe giving names.

A real world example is signal 10, which is BUS on ramips and USR1 on PPC.

All users of 'procd_send_signal' must change their code to reflect this.

Signed-off-by: Bastian Bittorf <bb at npl.de>
---

Changelog:
v2: give example in decription and safe 1 line of code
v3: simplify code (do not parse kill-output, but give an argument to kill)
    enforce using of names instead of numbers
    thanks for suggestions to 'Etienne Champetier' and 'Jo-Philipp Wich'


 package/system/procd/files/procd.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/package/system/procd/files/procd.sh b/package/system/procd/files/procd.sh
index 8f18cda..a1b9f2f 100644
--- a/package/system/procd/files/procd.sh
+++ b/package/system/procd/files/procd.sh
@@ -213,9 +213,12 @@ _procd_set_param() {
 			json_add_string "" "$@"
 			json_close_array
 		;;
-		nice|reload_signal)
+		nice)
 			json_add_int "$type" "$1"
 		;;
+		reload_signal)
+			json_add_int "$type" $(kill -l "$1")
+		;;
 		pidfile|user|seccomp|capabilities)
 			json_add_string "$type" "$1"
 		;;
-- 
1.9.1




More information about the Lede-dev mailing list