Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

watchdog(4) [debian man page]

WATCHDOG(4)						   BSD Kernel Interfaces Manual 					       WATCHDOG(4)

NAME
watchdog -- hardware and software watchdog SYNOPSIS
#include <sys/watchdog.h> DESCRIPTION
The watchdog facility is used for controlling hardware and software watchdogs. /dev/fido responds to a single ioctl(2) call, WDIOCPATPAT. It takes a single argument which represents a timeout value specified as a power of two nanoseconds, or-ed with a flag selecting active or passive control of the watchdog. WD_ACTIVE indicates that the watchdog will be kept from timing out from userland, for instance by the watchdogd(8) daemon. WD_PASSIVE indi- cates that the watchdog will be kept from timing out from the kernel. The ioctl(2) call will return success if just one of the available watchdog(9) implementations supports setting the timeout to the specified timeout. This means that at least one watchdog is armed. If the call fails, for instance if none of watchdog(9) implementations support the timeout length, all watchdogs are disabled and must be explicitly re-enabled. To disable the watchdogs pass WD_TO_NEVER. If disarming the watchdog(s) failed an error is returned. The watchdog might still be armed! RETURN VALUES
The ioctl returns zero on success and non-zero on failure. [EOPNOTSUPP] No watchdog present in the kernel (timeout value other than 0). [EOPNOTSUPP] Watchdog could not be disabled (timeout value of 0). [EINVALID] Invalid flag combination passed. [EINVALID] None of the watchdogs supports the requested timeout value. EXAMPLES
#include <paths.h> #include <sys/watchdog.h> #define WDPATH "/dev/" _PATH_WATCHDOG int wdfd = -1; static void wd_init(void) { wdfd = open(WDPATH, O_RDWR); if (wdfd == -1) err(1, WDPATH); } static void wd_reset(u_int timeout) { if (ioctl(wdfd, WDIOCPATPAT, &timeout) == -1) err(1, "WDIOCPATPAT"); } /* in main() */ wd_init(); wd_reset(WD_ACTIVE|WD_TO_8SEC); /* potential freeze point */ wd_reset(WD_TO_NEVER); Enables a watchdog to recover from a potentially freezing piece of code. options SW_WATCHDOG in your kernel config adds a software watchdog in the kernel, dropping to KDB or panic-ing when firing. SEE ALSO
watchdogd(8), watchdog(9) HISTORY
The watchdog code first appeared in FreeBSD 5.1. BUGS
The WD_PASSIVE option has not yet been implemented. AUTHORS
The watchdog facility was written by Poul-Henning Kamp <phk@FreeBSD.org>. The software watchdog code and this manual page were written by Sean Kelly <smkelly@FreeBSD.org>. Some contributions were made by Jeff Roberson <jeff@FreeBSD.org>. BSD
June 25, 2003 BSD

Check Out this Related Man Page

WD_KEEPALIVE(8) 					      System Manager's Manual						   WD_KEEPALIVE(8)

NAME
wd_keepalive - a simplified software watchdog daemon SYNOPSIS
wd_keepalive [-c filename|--config-file filename] DESCRIPTION
This is a simplified version of the watchdog daemon. If configured so it only opens .IR /dev/watchdog , and keeps writing to it often enough to keep the kernel from resetting, at least once per minute. Each write delays the reboot time another minute. After a minute of inactivity the watchdog hardware will cause a reset. In the case of the software watchdog the ability to reboot will depend on the state of the machines and interrupts. The wd_keepalive daemon can be stopped without causing a reboot if the device /dev/watchdog is closed correctly, unless your kernel is com- piled with the CONFIG_WATCHDOG_NOWAYOUT option enabled. Under high system load wd_keepalive might be swapped out of memory and may fail to make it back in in time. Under these circumstances the Linux kernel will reset the machine. To make sure you won't get unnecessary reboots make sure you have the variable realtime set to yes in the configuration file watchdog.conf. This adds real time support to wd_keepalive: it will lock itself into memory and there should be no problem even under the highest of loads. On system running out of memory the kernel will try to free enough memory by killing process. The wd_keepalive daemon itself is exempted from this so-called out-of-memory killer. OPTIONS
Available command line options are the following: -c config-file, --config-file config-file Use config-file as the configuration file instead of the default /etc/watchdog.conf. FILES
/dev/watchdog The watchdog device. /var/run/wd_keepalive.pid The pid file of the running wd_keepalive. SEE ALSO
watchdog.conf(5) watchdog(8) 4th Berkeley Distribution January 2005 WD_KEEPALIVE(8)
Man Page