diff options
author | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2016-10-20 00:10:27 -0300 |
---|---|---|
committer | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2016-10-20 00:10:27 -0300 |
commit | d0b2f91bede3bd5e3d24dd6803e56eee959c1797 (patch) | |
tree | 7fee4ab0509879c373c4f2cbd5b8a5be5b4041ee /Documentation/watchdog | |
parent | e914f8eb445e8f74b00303c19c2ffceaedd16a05 (diff) |
Linux-libre 4.8.2-gnupck-4.8.2-gnu
Diffstat (limited to 'Documentation/watchdog')
-rw-r--r-- | Documentation/watchdog/hpwdt.txt | 5 | ||||
-rw-r--r-- | Documentation/watchdog/src/watchdog-test.c | 39 | ||||
-rw-r--r-- | Documentation/watchdog/watchdog-kernel-api.txt | 9 |
3 files changed, 32 insertions, 21 deletions
diff --git a/Documentation/watchdog/hpwdt.txt b/Documentation/watchdog/hpwdt.txt index a40398cce..7a9f635d0 100644 --- a/Documentation/watchdog/hpwdt.txt +++ b/Documentation/watchdog/hpwdt.txt @@ -1,9 +1,9 @@ -Last reviewed: 04/04/2016 +Last reviewed: 05/20/2016 HPE iLO NMI Watchdog Driver NMI sourcing for iLO based ProLiant Servers Documentation and Driver by - Thomas Mingarelli <thomas.mingarelli@hpe.com> + Thomas Mingarelli The HPE iLO NMI Watchdog driver is a kernel module that provides basic watchdog functionality and the added benefit of NMI sourcing. Both the @@ -95,4 +95,3 @@ Last reviewed: 04/04/2016 -- Tom Mingarelli - (thomas.mingarelli@hpe.com) diff --git a/Documentation/watchdog/src/watchdog-test.c b/Documentation/watchdog/src/watchdog-test.c index fcdde8fc9..6983d0509 100644 --- a/Documentation/watchdog/src/watchdog-test.c +++ b/Documentation/watchdog/src/watchdog-test.c @@ -2,6 +2,7 @@ * Watchdog Driver Test Program */ +#include <errno.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -13,6 +14,7 @@ #include <linux/watchdog.h> int fd; +const char v = 'V'; /* * This function simply sends an IOCTL to the driver, which in turn ticks @@ -23,6 +25,7 @@ static void keep_alive(void) { int dummy; + printf("."); ioctl(fd, WDIOC_KEEPALIVE, &dummy); } @@ -33,8 +36,13 @@ static void keep_alive(void) static void term(int sig) { + int ret = write(fd, &v, 1); + close(fd); - fprintf(stderr, "Stopping watchdog ticks...\n"); + if (ret < 0) + printf("\nStopping watchdog ticks failed (%d)...\n", errno); + else + printf("\nStopping watchdog ticks...\n"); exit(0); } @@ -42,12 +50,14 @@ int main(int argc, char *argv[]) { int flags; unsigned int ping_rate = 1; + int ret; + + setbuf(stdout, NULL); fd = open("/dev/watchdog", O_WRONLY); if (fd == -1) { - fprintf(stderr, "Watchdog device not enabled.\n"); - fflush(stderr); + printf("Watchdog device not enabled.\n"); exit(-1); } @@ -55,36 +65,30 @@ int main(int argc, char *argv[]) if (!strncasecmp(argv[1], "-d", 2)) { flags = WDIOS_DISABLECARD; ioctl(fd, WDIOC_SETOPTIONS, &flags); - fprintf(stderr, "Watchdog card disabled.\n"); - fflush(stderr); + printf("Watchdog card disabled.\n"); goto end; } else if (!strncasecmp(argv[1], "-e", 2)) { flags = WDIOS_ENABLECARD; ioctl(fd, WDIOC_SETOPTIONS, &flags); - fprintf(stderr, "Watchdog card enabled.\n"); - fflush(stderr); + printf("Watchdog card enabled.\n"); goto end; } else if (!strncasecmp(argv[1], "-t", 2) && argv[2]) { flags = atoi(argv[2]); ioctl(fd, WDIOC_SETTIMEOUT, &flags); - fprintf(stderr, "Watchdog timeout set to %u seconds.\n", flags); - fflush(stderr); + printf("Watchdog timeout set to %u seconds.\n", flags); goto end; } else if (!strncasecmp(argv[1], "-p", 2) && argv[2]) { ping_rate = strtoul(argv[2], NULL, 0); - fprintf(stderr, "Watchdog ping rate set to %u seconds.\n", ping_rate); - fflush(stderr); + printf("Watchdog ping rate set to %u seconds.\n", ping_rate); } else { - fprintf(stderr, "-d to disable, -e to enable, -t <n> to set " \ + printf("-d to disable, -e to enable, -t <n> to set " \ "the timeout,\n-p <n> to set the ping rate, and \n"); - fprintf(stderr, "run by itself to tick the card.\n"); - fflush(stderr); + printf("run by itself to tick the card.\n"); goto end; } } - fprintf(stderr, "Watchdog Ticking Away!\n"); - fflush(stderr); + printf("Watchdog Ticking Away!\n"); signal(SIGINT, term); @@ -93,6 +97,9 @@ int main(int argc, char *argv[]) sleep(ping_rate); } end: + ret = write(fd, &v, 1); + if (ret < 0) + printf("Stopping watchdog ticks failed (%d)...\n", errno); close(fd); return 0; } diff --git a/Documentation/watchdog/watchdog-kernel-api.txt b/Documentation/watchdog/watchdog-kernel-api.txt index 917eeeabf..7f31125c1 100644 --- a/Documentation/watchdog/watchdog-kernel-api.txt +++ b/Documentation/watchdog/watchdog-kernel-api.txt @@ -82,8 +82,9 @@ It contains following fields: * max_timeout: the watchdog timer's maximum timeout value (in seconds), as seen from userspace. If set, the maximum configurable value for 'timeout'. Not used if max_hw_heartbeat_ms is non-zero. -* min_hw_heartbeat_ms: Minimum time between heartbeats sent to the chip, - in milli-seconds. +* min_hw_heartbeat_ms: Hardware limit for minimum time between heartbeats, + in milli-seconds. This value is normally 0; it should only be provided + if the hardware can not tolerate lower intervals between heartbeats. * max_hw_heartbeat_ms: Maximum hardware heartbeat, in milli-seconds. If set, the infrastructure will send heartbeats to the watchdog driver if 'timeout' is larger than max_hw_heartbeat_ms, unless WDOG_ACTIVE @@ -166,6 +167,10 @@ they are supported. These optional routines/operations are: info structure). * status: this routine checks the status of the watchdog timer device. The status of the device is reported with watchdog WDIOF_* status flags/bits. + WDIOF_MAGICCLOSE and WDIOF_KEEPALIVEPING are reported by the watchdog core; + it is not necessary to report those bits from the driver. Also, if no status + function is provided by the driver, the watchdog core reports the status bits + provided in the bootstatus variable of struct watchdog_device. * set_timeout: this routine checks and changes the timeout of the watchdog timer device. It returns 0 on success, -EINVAL for "parameter out of range" and -EIO for "could not write value to the watchdog". On success this |