Main Page   Compound List   File List   Compound Members   File Members   Related Pages  

watchdog.h File Reference

Go to the source code of this file.

Defines

#define WATCHDOG_DEVICE   "/dev/watchdog"
#define WATCHDOG_RESET_INTERVAL   60

Functions

int reset_watchdog (void)
int setup_watchdog_callback (void)

Variables

gboolean watchdog_enabled
unsigned long watchdog_period
int watchdog_fd


Define Documentation

#define WATCHDOG_DEVICE   "/dev/watchdog"
 

This is the interface to write to in order to reset the timer

#define WATCHDOG_RESET_INTERVAL   60
 

This is the time between watchdog timer resets


Function Documentation

int reset_watchdog void   
 

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

int setup_watchdog_callback void   
 

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.

Returns:
E_INVALID if unable to setup watchdog timer reset callback or if the watchdog period is too small. SUCCESS if device was opened and callback installed

Todo:
Allow watchdog upate values in milliseconds.


Variable Documentation

gboolean watchdog_enabled  
 

Indicates if the watchdog reset feature should be enabled

int watchdog_fd  
 

This is the file descriptor of the watchdog interface

unsigned long watchdog_period  
 

Sets the interval of time between reseting the watchdog timer


Generated on Wed Oct 30 15:21:17 2002 for Application Heartbeat Monitor by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002