the watchdog is pinged within a certain time, this time is called the
timeout or margin. The simplest way to ping the watchdog is to write
some data to the device. So a very simple watchdog daemon would look
-like this:
-
-#include <stdlib.h>
-#include <fcntl.h>
-
-int main(int argc, const char *argv[]) {
- int fd=open("/dev/watchdog",O_WRONLY);
- if (fd==-1) {
- perror("watchdog");
- exit(1);
- }
- while(1) {
- write(fd, "\0", 1);
- sleep(10);
- }
-}
+like this source file: see Documentation/watchdog/src/watchdog-simple.c
A more advanced driver could for example check that a HTTP server is
still responding before doing the write call to ping the watchdog.
some of the drivers support the configuration option "Disable watchdog
shutdown on close", CONFIG_WATCHDOG_NOWAYOUT. If it is set to Y when
compiling the kernel, there is no way of disabling the watchdog once
-it has been started. So, if the watchdog dameon crashes, the system
+it has been started. So, if the watchdog daemon crashes, the system
will reboot after the timeout has passed.
Some other drivers will not disable the watchdog, unless a specific
support the GETBOOTSTATUS call.
Some drivers can measure the temperature using the GETTEMP ioctl. The
-returned value is the temperature in degrees farenheit.
+returned value is the temperature in degrees fahrenheit.
int temperature;
ioctl(fd, WDIOC_GETTEMP, &temperature);
Finally the SETOPTIONS ioctl can be used to control some aspects of
the cards operation; right now the pcwd driver is the only one
-supporting thiss ioctl.
+supporting this ioctl.
int options = 0;
ioctl(fd, WDIOC_SETOPTIONS, options);
Timeout default varies according to frequency, supports
SETTIMEOUT
- Watchdog can not be turned off, CONFIG_WATCHDOG_NOWAYOUT
+ Watchdog cannot be turned off, CONFIG_WATCHDOG_NOWAYOUT
does not make sense
GETSUPPORT returns the watchdog_info struct, and
GETSTATUS returns the supported options. GETBOOTSTATUS
returns a 1 if the last reset was caused by the
- watchdog and a 0 otherwise. This watchdog can not be
+ watchdog and a 0 otherwise. This watchdog cannot be
disabled once it has been started. The wdt_period kernel
parameter selects which bit of the time base changing
from 0->1 will trigger the watchdog exception. Changing