[LEDE-DEV] [PATCH] procd: update procd.sh to support both: signal-names and signal-numbers
Bastian Bittorf
bb at npl.de
Fri Jan 13 07:52:47 PST 2017
It is automatically detected if the input is a number. If not,
the name is converted to the corresonding number. In general it's
good style to use names and it's more portable: signal numbers can
be architecture-dependent, so we are more safe giving names.
Signed-off-by: Bastian Bittorf <bb at npl.de>
---
package/system/procd/files/procd.sh | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/package/system/procd/files/procd.sh b/package/system/procd/files/procd.sh
index 8f18cda..695d815 100644
--- a/package/system/procd/files/procd.sh
+++ b/package/system/procd/files/procd.sh
@@ -200,6 +200,7 @@ _procd_add_jail_mount_rw() {
_procd_set_param() {
local type="$1"; shift
+ local obj old_obj signal
case "$type" in
env|data|limits)
@@ -213,9 +214,18 @@ _procd_set_param() {
json_add_string "" "$@"
json_close_array
;;
- nice|reload_signal)
+ nice)
json_add_int "$type" "$1"
;;
+ reload_signal)
+ signal="$1"
+ test "$signal" -eq "$signal" 2>/dev/null || {
+ set -- $( kill -l ) NOT_FOUND
+ for obj in "$@"; do test "$signal" = "$obj" && break; old_obj="$obj"; done
+ signal="${old_obj%)}"
+ }
+ json_add_int "$type" "$signal"
+ ;;
pidfile|user|seccomp|capabilities)
json_add_string "$type" "$1"
;;
--
1.9.1
More information about the Lede-dev
mailing list