From: Shane Wegner <shane@cm.nu>
To: linux-kernel@vger.kernel.org
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Patch: softdog and WDIOS_DISABLECARD
Date: Wed, 2 May 2001 00:33:59 -0700 [thread overview]
Message-ID: <20010502003359.A20841@cm.nu> (raw)
Hi,
I have found a potential problem with the current
implementation of the software watchdog. I have
CONFIG_WATCHDOG_NOWAYOUT set for a reliable watchdog.
However, there are instances where I want to explicitly
shut it down. The problem with disabling
CONFIG_WATCHDOG_NOWAYOUT is that events other than an
explicit shutdown can disable the timer. A SIGSEGV
perhaps or the daemon being killed by the OOM handler. In
cases like this, the system should reboot IMO.
This small patch adds the appropriate options to enable and
disable the timer explicitly.
--- softdog.c.orig Wed May 2 00:15:56 2001
+++ softdog.c Wed May 2 00:15:19 2001
@@ -130,6 +130,7 @@
static struct watchdog_info ident = {
identity: "Software Watchdog",
};
+ int rv;
switch (cmd) {
default:
return -ENOIOCTLCMD;
@@ -140,6 +141,25 @@
case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS:
return put_user(0,(int *)arg);
+ case WDIOC_SETOPTIONS:
+ if(copy_from_user(&rv, (int*) arg, sizeof(int)))
+ return -EFAULT;
+
+ if (rv & WDIOS_DISABLECARD) {
+ lock_kernel();
+ del_timer(&watchdog_ticktock);
+ unlock_kernel();
+ return 0;
+ }
+
+ if (rv & WDIOS_ENABLECARD) {
+ lock_kernel();
+ mod_timer(&watchdog_ticktock, jiffies +
+ (soft_margin * HZ));
+ unlock_kernel();
+ return 0;
+ }
+
case WDIOC_KEEPALIVE:
mod_timer(&watchdog_ticktock, jiffies+(soft_margin*HZ));
return 0;
--
Shane Wegner: shane@cm.nu
http://www.cm.nu/~shane/
PGP: 1024D/FFE3035D
A0ED DAC4 77EC D674 5487
5B5C 4F89 9A4E FFE3 035D
next reply other threads:[~2001-05-02 7:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-05-02 7:33 Shane Wegner [this message]
2001-05-02 11:41 ` Patch: softdog and WDIOS_DISABLECARD Alan Cox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20010502003359.A20841@cm.nu \
--to=shane@cm.nu \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox