From: Ondřej Votava <ondrej.vot...@cvut.cz> Adds feature to show exit code of processes launched by procd. The exit code is shown for finished process when ubus's service list method is called.
The exit code value is computed according to waitpid(2) and http://tldp.org/LDP/abs/html/exitcodes.html Signed-off-by: Ondřej Votava <ondrej.vot...@cvut.cz> --- service/instance.c | 7 +++---- service/instance.h | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/service/instance.c b/service/instance.c index 13e7d0a..342888a 100644 --- a/service/instance.c +++ b/service/instance.c @@ -563,11 +563,10 @@ instance_delete(struct service_instance *in) static int instance_exit_code(int ret) { - if(WIFEXITED(ret)) { + if (WIFEXITED(ret)) { return WEXITSTATUS(ret); - } - else if (WIFSIGNALED(ret)) { - return 128 + WTERMSIG(ret); + } else if (WIFSIGNALED(ret)) { + return SIGNALLED_OFFSET + WTERMSIG(ret); } return 1; } diff --git a/service/instance.h b/service/instance.h index 05a2fc3..d7b4319 100644 --- a/service/instance.h +++ b/service/instance.h @@ -21,6 +21,7 @@ #include "../utils/utils.h" #define RESPAWN_ERROR (5 * 60) +#define SIGNALLED_OFFSET 128 struct jail { bool procfs; -- 2.21.0 (Apple Git-122.2) _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel