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.
|