From patchwork Sat May 30 01:32:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Bailey X-Patchwork-Id: 1301101 X-Patchwork-Delegate: ynezz@true.cz Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=meshplusplus.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20170209 header.b=HRc+9BR9; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=meshplusplus-com.20150623.gappssmtp.com header.i=@meshplusplus-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=u5RGL/00; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49YkTn0MMnz9sSJ for ; Sat, 30 May 2020 11:33:16 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Subject:To:Message-ID:Date:From:MIME-Version:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=d0Lspq+ObRqvMHYP7WVzycBik1sl8CyNIcyvlTMzVkc=; b=HRc +9BR9ymZwiYaRREaDTvwlviQtkocAU07CdUeqwu64GFeh08vSE8x/H9dCVzxKXlIijFxZcHzhIufZ FyW2S8QEqfe/IgHRdezxlBJvNckM7H2yYVFGsCulPPqjgxeBoaGHKW6cbzjXgZ3GmaLisvbxiQUVu 3e6MppYStsORpjdsb63h57PXMU86vKgqL+x4eHkKhrO+gbgn/pPDtMkY6MAm0qzJroCc9fzQPlvlN 4YXHO0IudjZFpmmd86u6VLpIiTa0B1AFSSvGEQ9ZlVs8hnpNnlc7Zp4GJXoJxEWzaJ0DL+nWjoDeF YoF3BRbz+7uyEZIo9X20In16wckt8zA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jeqN9-0004Se-Cq; Sat, 30 May 2020 01:33:15 +0000 Received: from mail-il1-x133.google.com ([2607:f8b0:4864:20::133]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jeqN2-0004Mf-GA for openwrt-devel@lists.openwrt.org; Sat, 30 May 2020 01:33:10 +0000 Received: by mail-il1-x133.google.com with SMTP id t8so3788161ilm.7 for ; Fri, 29 May 2020 18:33:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meshplusplus-com.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=IQEXfUYY61OuGSktrDerblONwsQGwrvI5VzXHSSoyQU=; b=u5RGL/00TAxtSbYAWoPt1R5+ixaOqQJdlKNysOwnQoSrso3QuW/HryIW9HhJ5wJ1KB hBYtNGUorZ7PDavVc8uoMdxIxOgqw3jtyB1JCVZXfniYMMOZaStt+DbMLYdgsGYPTOAn SI75ce7wCHrs13Vq64xzxde/j083Q98IUQSq5HgBKqYRkFzlADgwAUOYACWfMvRbygQW ArVK7l9jYQmBgK3o8yBYpWO9WtSn2THlWnBGDe5J6E0fseC4mTuS3hZN5SNtYjBp8P9L x23uJm7IruFjTtKd1eI2mqNcG2oV+EQiqVcyw8oSZLKJNmeQxpPMUr5CqUxGZpdewLjA qdAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=IQEXfUYY61OuGSktrDerblONwsQGwrvI5VzXHSSoyQU=; b=pckm4gGMeRZkzKZbrlSQesfhd5cHT15m2pDe2HyGjbn0TGzQdV8F8Ls91xfxd1WXGW Rox62ei9DEazswDcg97MiVhhTJYfInKb4Ch/nPBSnFH20Po0VQ67U5j20Nbtzy8dSof+ jnEyUaCFu5nJNx8GDTzvlE/tjO+ADOqbWlKzBGdXG/RcLzDTxYo6E3pHndNeTL5Wq+LT y4tBU02kwNuAeNJz365lmhQXHpwZmQv8+O7saFsxJkXeRkwNhXxKQV4sJMR+p86KHbdl Ohu4HPcZ374dGDCJ1GlK42n8G24UpRN2dItejFGiiyMCb3wxgsFnborVuj16BtGGsCsY csAQ== X-Gm-Message-State: AOAM530D0xOM5UbiTtTXeVoDxvrE7VEfGYG2/bg7BX5lYgSmwiLbZYoC vuHhB0DeExbex3kghsXs6veOvamYShcbDTq/l36VxemSFJM= X-Google-Smtp-Source: ABdhPJz94lSKeV5h0a+MTQT8HInfdESv4+aXLBO8EJOhR6hN1Oj8vYek5RwmZjxRqpiG6JaKovZBkoYwRtp+qLTs7d0= X-Received: by 2002:a92:c809:: with SMTP id v9mr10154276iln.209.1590802385826; Fri, 29 May 2020 18:33:05 -0700 (PDT) MIME-Version: 1.0 From: Daniel Bailey Date: Fri, 29 May 2020 18:32:55 -0700 Message-ID: To: openwrt-devel@lists.openwrt.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200529_183308_542451_3641912A X-CRM114-Status: GOOD ( 13.90 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:133 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 HTML_MESSAGE BODY: HTML included in message -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid Subject: [OpenWrt-Devel] [PATCH 1/2] procd: add service instance watchdog X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Daniel Bailey Date: Fri, 29 May 2020 17:37:25 -0700 Subject: [PATCH] procd: add service instance watchdog Added instance watchdog which will eventually either terminate or respawn an instance depending on the instance respawn setting. Added service ubus method 'watchdog' which services the watchdog timer and allows update of the instance watchdog mode instance. Three modes: disabled, passive, active. Presently, only disabled and passive modes are implemented. Disabled: cancels watchdog timer set for a given instance. Passive: sets a instance timer which must be serviced or the instance will be stopped/restarted depending upon the instance respawn value when the timer expires. Active (to be implemented): requires an additional service 'endpoint' parameter. Upon watchdog timer expiry, procd will query the endpoint to determine whether the instance is alive. If the instance does not answer, procd will terminate or respawn the instance depending on the instance respawn setting. Signed-off-by: Daniel Bailey --- service/instance.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++ service/instance.h | 15 ++++++++++ service/service.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 151 insertions(+) + return UBUS_STATUS_OK; +} + static int container_handle_console(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, @@ -797,6 +864,7 @@ static struct ubus_method main_object_methods[] = { UBUS_METHOD("validate", service_handle_validate, validate_policy), UBUS_METHOD("get_data", service_get_data, get_data_policy), UBUS_METHOD("state", service_handle_state, service_state_attrs), + UBUS_METHOD("watchdog", service_handle_watchdog, service_watchdog_policy), }; static struct ubus_object_type main_object_type = -- 2.25.1 diff --git a/service/instance.c b/service/instance.c index 142208a..8560a95 100644 --- a/service/instance.c +++ b/service/instance.c @@ -65,6 +65,7 @@ enum { INSTANCE_ATTR_EXTROOT, INSTANCE_ATTR_OVERLAYDIR, INSTANCE_ATTR_TMPOVERLAYSIZE, + INSTANCE_ATTR_WATCHDOG, __INSTANCE_ATTR_MAX }; @@ -95,6 +96,7 @@ static const struct blobmsg_policy instance_attr[__INSTANCE_ATTR_MAX] = { [INSTANCE_ATTR_EXTROOT] = { "extroot", BLOBMSG_TYPE_STRING }, [INSTANCE_ATTR_OVERLAYDIR] = { "overlaydir", BLOBMSG_TYPE_STRING }, [INSTANCE_ATTR_TMPOVERLAYSIZE] = { "tmpoverlaysize", BLOBMSG_TYPE_STRING }, + [INSTANCE_ATTR_WATCHDOG] = { "watchdog", BLOBMSG_TYPE_ARRAY }, }; enum { @@ -546,6 +548,11 @@ instance_start(struct service_instance *in) fcntl(epipe[0], F_SETFD, FD_CLOEXEC); } + if (in->watchdog.mode != INSTANCE_WATCHDOG_MODE_DISABLED) { + uloop_timeout_set(&in->watchdog.timeout, in->watchdog.freq * 1000); + DEBUG(2, "Started instance %s::%s watchdog timer : timeout = %d\n", in->srv->name, in->name, in->watchdog.freq); + } + service_event("instance.start", in->srv->name, in->name); } @@ -693,6 +700,7 @@ instance_exit(struct uloop_process *p, int ret) in->exit_code = instance_exit_code(ret); uloop_timeout_cancel(&in->timeout); + uloop_timeout_cancel(&in->watchdog.timeout); service_event("instance.stop", in->srv->name, in->name); if (in->halt) { @@ -752,6 +760,19 @@ instance_restart(struct service_instance *in) uloop_timeout_set(&in->timeout, in->term_timeout * 1000); } +static void +instance_watchdog(struct uloop_timeout *t) +{ + struct service_instance *in = container_of(t, struct service_instance, watchdog.timeout); + + DEBUG(3, "instance %s::%s watchdog timer expired\n", in->srv->name, in->name); + + if (in->respawn) + instance_restart(in); + else + instance_stop(in, true); +} + static bool string_changed(const char *a, const char *b) { return !((!a && !b) || (a && b && !strcmp(a, b))); @@ -817,6 +838,12 @@ instance_config_changed(struct service_instance *in, struct service_instance *in if (!blobmsg_list_equal(&in->errors, &in_new->errors)) return true; + if (in->watchdog.mode != in_new->watchdog.mode) + return true; + + if (in->watchdog.freq != in_new->watchdog.freq) + return true; + return false; } @@ -1170,6 +1197,36 @@ instance_config_parse(struct service_instance *in) DEBUG(3, "unknown syslog facility '%s' given, using default (LOG_DAEMON)\n", blobmsg_get_string(tb[INSTANCE_ATTR_FACILITY])); } + if (tb[INSTANCE_ATTR_WATCHDOG]) { + int i = 0; + uint32_t vals[2] = { 0, 30 }; + + blobmsg_for_each_attr(cur2, tb[INSTANCE_ATTR_WATCHDOG], rem) { + if (i >= 2) + break; + + vals[i] = atoi(blobmsg_get_string(cur2)); + i++; + } + + // TODO(danielb): change mode integers to strings (0 = disabled, 1 = passive, 2 = active) + if (vals[0] >= 0 && vals[0] < __INSTANCE_WATCHDOG_MODE_MAX) { + in->watchdog.mode = vals[0]; + DEBUG(3, "setting watchdog mode (%d)\n", vals[0]); + } else { + in->watchdog.mode = 0; + DEBUG(3, "unknown watchdog mode (%d) given, using default (0)\n", vals[0]); + } + + if (vals[1] > 0) { + in->watchdog.freq = vals[1]; + DEBUG(3, "setting watchdog timeout (%d)\n", vals[0]); + } else { + in->watchdog.freq = 30; + DEBUG(3, "invalid watchdog timeout (%d) given, using default (30)\n", vals[1]); + } + } + return true; } @@ -1255,6 +1312,7 @@ instance_free(struct service_instance *in) instance_free_stdio(in); uloop_process_delete(&in->proc); uloop_timeout_cancel(&in->timeout); + uloop_timeout_cancel(&in->watchdog.timeout); trigger_del(in); watch_del(in); instance_config_cleanup(in); @@ -1308,6 +1366,9 @@ instance_init(struct service_instance *in, struct service *s, struct blob_attr * blobmsg_list_simple_init(&in->limits); blobmsg_list_simple_init(&in->errors); blobmsg_list_simple_init(&in->jail.mount); + + in->watchdog.timeout.cb = instance_watchdog; + in->valid = instance_config_parse(in); } @@ -1425,5 +1486,12 @@ void instance_dump(struct blob_buf *b, struct service_instance *in, int verbose) if (verbose && in->trigger) blobmsg_add_blob(b, in->trigger); + if (in->watchdog.mode != INSTANCE_WATCHDOG_MODE_DISABLED) { + void *r = blobmsg_open_table(b, "watchdog"); + blobmsg_add_u32(b, "mode", in->watchdog.mode); + blobmsg_add_u32(b, "timeout", in->watchdog.freq); + blobmsg_close_table(b, r); + } + blobmsg_close_table(b, i); } diff --git a/service/instance.h b/service/instance.h index 4400cd4..590f931 100644 --- a/service/instance.h +++ b/service/instance.h @@ -23,6 +23,19 @@ #define RESPAWN_ERROR (5 * 60) #define SIGNALLED_OFFSET 128 +typedef enum instance_watchdog { + INSTANCE_WATCHDOG_MODE_DISABLED, + INSTANCE_WATCHDOG_MODE_PASSIVE, + INSTANCE_WATCHDOG_MODE_ACTIVE, + __INSTANCE_WATCHDOG_MODE_MAX, +} instance_watchdog_mode_t; + +struct watchdog { + instance_watchdog_mode_t mode; + uint32_t freq; + struct uloop_timeout timeout; +}; + struct jail { bool procfs; bool sysfs; @@ -94,6 +107,8 @@ struct service_instance { struct blobmsg_list file; struct blobmsg_list limits; struct blobmsg_list errors; + + struct watchdog watchdog; }; void instance_start(struct service_instance *in); diff --git a/service/service.c b/service/service.c index fcf0215..d9249a3 100644 --- a/service/service.c +++ b/service/service.c @@ -727,6 +727,73 @@ service_get_data(struct ubus_context *ctx, struct ubus_object *obj, return 0; } +enum { + SERVICE_WATCHDOG_MODE, + SERVICE_WATCHDOG_TIMEOUT, + SERVICE_WATCHDOG_NAME, + SERVICE_WATCHDOG_INSTANCE, + __SERVICE_WATCHDOG_MAX, +}; + +static const struct blobmsg_policy service_watchdog_policy[__SERVICE_WATCHDOG_MAX] = { + [SERVICE_WATCHDOG_MODE] = { "mode", BLOBMSG_TYPE_INT32 }, + [SERVICE_WATCHDOG_NAME] = { "name", BLOBMSG_TYPE_STRING }, + [SERVICE_WATCHDOG_TIMEOUT] = { "timeout", BLOBMSG_TYPE_INT32 }, + [SERVICE_WATCHDOG_INSTANCE] = { "instance", BLOBMSG_TYPE_STRING }, +}; + +static int +service_handle_watchdog(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, + struct blob_attr *msg) +{ + struct blob_attr *tb[__SERVICE_WATCHDOG_MAX] = {0}; + struct service *s; + struct blob_attr *cur; + struct service_instance *in; + + blobmsg_parse(service_watchdog_policy, __SERVICE_WATCHDOG_MAX, tb, blobmsg_data(msg), blobmsg_data_len(msg)); + cur = tb[SERVICE_WATCHDOG_NAME]; + if (!cur) + return UBUS_STATUS_NOT_FOUND; + + s = avl_find_element(&services, blobmsg_data(cur), s, avl); + if (!s) + return UBUS_STATUS_NOT_FOUND; + + cur = tb[SERVICE_WATCHDOG_INSTANCE]; + if (!cur) + return UBUS_STATUS_NOT_FOUND; + + in = vlist_find(&s->instances, blobmsg_data(cur), in, node); + if (!in) { + ERROR("instance %s not found\n", blobmsg_get_string(cur)); + return UBUS_STATUS_NOT_FOUND; + } + + // TODO(danielb): change mode from u32 to string (0 = disabled, 1 = passive, 2 = active) + if (tb[SERVICE_WATCHDOG_MODE]) + in->watchdog.mode = blobmsg_get_u32(tb[SERVICE_WATCHDOG_MODE]); + + if (tb[SERVICE_WATCHDOG_TIMEOUT]) + in->watchdog.freq = blobmsg_get_u32(tb[SERVICE_WATCHDOG_TIMEOUT]); + + if (in->watchdog.mode == INSTANCE_WATCHDOG_MODE_DISABLED) + uloop_timeout_cancel(&in->watchdog.timeout); + else + uloop_timeout_set(&in->watchdog.timeout, in->watchdog.freq * 1000); + + blob_buf_init(&b, 0); + blobmsg_add_string(&b, "name", blobmsg_get_string(tb[SERVICE_WATCHDOG_NAME])); + blobmsg_add_string(&b, "instance", blobmsg_get_string(tb[SERVICE_WATCHDOG_INSTANCE])); + blobmsg_add_u32(&b, "mode", in->watchdog.mode); + blobmsg_add_u32(&b, "timeout", in->watchdog.freq); + + ubus_send_reply(ctx, req, b.head); + From patchwork Sat May 30 01:32:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Bailey X-Patchwork-Id: 1301100 X-Patchwork-Delegate: ynezz@true.cz Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=meshplusplus.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20170209 header.b=UD6ekA1J; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=meshplusplus-com.20150623.gappssmtp.com header.i=@meshplusplus-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=VjITYVj+; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49YkTk641Bz9sPK for ; Sat, 30 May 2020 11:33:14 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Subject:To:Message-ID:Date:From:MIME-Version:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=i+uXmW78BOPUz3GDtLfvkwcRUFXLC7GbX4kU/OoXZLY=; b=UD6 ekA1JNG5/iGbF+TRPWQ5nmapcqjddC4uFjOO6IMS7SuisLPJhhIAwHYEnZEMAj4Jjfwez0YocenjB bAti67Zd+Xl0cRI2sqcRn3ihFE1Nz3ifh+m5Zp1wQ97fSLFr2hZOc7F7HtkR5WXMtSj4ZcRR1ogBT xxjrJ/vqgXgUSpzn7lYYRsFCTVzrzHU573gzcvLaNGThSd+Vvzwkpam89inb5fx8sOu74QjQoP6Cu 3yOukrdKjbfNbkY9TcxN1CmoYLWtuDXo+3i9cVmUOb8nTuizoOxlHAzN652ts/667MsANvRk0y32R ylrrboj5dAxu0BXYEW9c07rQ+CTrIjw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jeqN4-0004Nr-UO; Sat, 30 May 2020 01:33:10 +0000 Received: from mail-il1-x12a.google.com ([2607:f8b0:4864:20::12a]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jeqN1-0004Mc-Si for openwrt-devel@lists.openwrt.org; Sat, 30 May 2020 01:33:09 +0000 Received: by mail-il1-x12a.google.com with SMTP id j3so4272003ilk.11 for ; Fri, 29 May 2020 18:33:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meshplusplus-com.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=rSS9526Ut0gV7yFFtuYIRgMfHoGkGb0N3cE0otMelZo=; b=VjITYVj+kCxH+My7HPLbtLCW3bVozcRasRJI20nUOrccvDVPNeaLZFGxTJVFuZe7Cb 04Vb5DqsmFTh1P9j6L9PrTBHswZcc2FLJnNwzqlqVZnPG/roccI2GEC+g6fEHj+3FbqE JmX9jOtXUIdSNUETLwW/2dm06zyU8yp7S3vknXW/zYEO6m9ZdI7wIBxQMt0h7KR5yHoW cKE5NxFxabov1JMBiWaj40ovJuU1kqePneg3nqZsAlWzJaps/G+vHpqAwr+AW/tt5IN+ y9KPcWMNmjhZxEZJm5CKKz7jqdudlwViGUhvxvd0qYVNq/ViUmv6cHMzCRyQPudoWPdr GWRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=rSS9526Ut0gV7yFFtuYIRgMfHoGkGb0N3cE0otMelZo=; b=X4txjJV93BnhjP+VbsclRrKUxpurjtZpAcCFIzuDh5SdzyuZvEyySLYoVmTkTznvLP Ub6mFKsUID7o9J/o2so4lF3J1sfmrOZaGM4SCUxNAf2ylGL7lOWv+Q9zU9isIHvsR9Nk bNDrH9xd3IxE4Dkyiuqo6mRdeMHRDo6S3ShE0eOTAoqThTDIL2qFizEw4dg8hPX15L57 nd7tx6BTVWOSwzTBITq9Sl6WDRlLfTp1cqbSCQQJwmn+qrmVm3BSIEYv3/rSgSQIlOrH cS/qpU03KXEnJE3UU1aABv4lWna7pl2Xi7xv856SF90wadzMvRnQofdEW1WgYcWOVLC4 UsXA== X-Gm-Message-State: AOAM5338HG9lcXr720WNO8bF+Db8lvYJSjnt0WYhPDj6K3UphSyl7sSS 5C+V4zuPfLLscqFOkNHoYmH2l9fICjz3mpK6ovrBcbNEhzE= X-Google-Smtp-Source: ABdhPJxVXJN14qYp9mgBQl55FzTd5vFIykWgrwwj2ii9OYYR7JaQ3/SWsgGdsEq1cYUtbBtXH6P3KDMk8fvXmq5riTI= X-Received: by 2002:a92:5e4a:: with SMTP id s71mr9104845ilb.119.1590802384714; Fri, 29 May 2020 18:33:04 -0700 (PDT) MIME-Version: 1.0 From: Daniel Bailey Date: Fri, 29 May 2020 18:32:53 -0700 Message-ID: To: openwrt-devel@lists.openwrt.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200529_183308_001613_6DDE8E8B X-CRM114-Status: UNSURE ( 8.61 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:12a listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 HTML_MESSAGE BODY: HTML included in message -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid Subject: [OpenWrt-Devel] [PATCH 2/2] procd: allow optional watchdog instance parameter X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Daniel Bailey Date: Thu, 28 May 2020 20:39:35 -0700 Subject: [PATCH] procd: allow optional watchdog instance parameter Optional instance watchdog timeout and watchdog mode be set by adding procd_set_param $mode $timeout $mode is an integer [0-2] representing instance watchdog mode of operation: 0 = disabled 1 = passive mode, e.g. client must poke watchdog via ubus 2 = active mode, e.g. client must provide watchdog endpoint Signed-off-by: Daniel Bailey --- package/system/procd/files/procd.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.25.1 diff --git a/package/system/procd/files/procd.sh b/package/system/procd/files/procd.sh index dd6dc1c58d..3a1f413f85 100644 --- a/package/system/procd/files/procd.sh +++ b/package/system/procd/files/procd.sh @@ -186,7 +186,7 @@ _procd_add_jail() { json_add_string name "$1" shift - + for a in $@; do case $a in log) json_add_boolean "log" "1";; @@ -247,7 +247,7 @@ _procd_set_param() { env|data|limits) _procd_add_table "$type" "$@" ;; - command|netdev|file|respawn|watch) + command|netdev|file|respawn|watch|watchdog) _procd_add_array "$type" "$@" ;; error) @@ -378,7 +378,7 @@ _procd_append_param() { env|data|limits) _procd_add_table_data "$@" ;; - command|netdev|file|respawn|watch) + command|netdev|file|respawn|watch|watchdog) _procd_add_array_data "$@" ;; error)