#include <signal.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/time.h>
#include <stdio.h>
#include <syslog.h>
#include "ahm.h"
#include "utils.h"
#include "watchdog.h"
Functions | |
int | reset_watchdog (void) |
int | setup_watchdog_callback (void) |
Variables | |
int | watchdog_fd = -1 |
gboolean | watchdog_enabled = FALSE |
unsigned long | watchdog_period = WATCHDOG_RESET_INTERVAL |
|
This function writes a value to the /dev/watchdog interface. If the device is not opened, it returns without doing anything. If this function is unable to reset the watchdog timer the following message will be logged: Failed to reset watchdog timer |
|
This function sets up the timer for the watchdog update It will open the watchdog device interface, for example, /dev/watchdog and the timer callback function will handle writing to the file (thus reseting the timer). If the timer is so short that this function cannot open the /dev/watchdog interface and install the timer callback, then the timer will expire though not necessarily because of a system error. If the watchdog device cannot be opening, this function returns without setting up the timer. If setting up the timer callback fails, then the watchdog device is closed. It is possible that the timer may expire, depending upon the interval, before the device is closed in this case. It should be noted that the system timer has a resolution of about 10ms, so any update period smaller than this may not work correctly. Currently, only a value of seconds is accepted in a range of 1 second to the max value of a long.
|
|
Indicates if the watchdog reset feature should be enabled |
|
This is the file descriptor of the watchdog interface |
|
Sets the interval of time between reseting the watchdog timer |