#include <libsimpleio/libwatchdog.h> void WATCHDOG_open(const char *name, int32_t *fd, int32_t *error); void WATCHDOG_close(int32_t fd, int32_t *error); void WATCHDOG_get_timeout(int32_t fd, int32_t *timeout, int32_t *error); void WATCHDOG_set_timeout(int32_t fd, int32_t newtimeout, int32_t *timeout, int32_t *error); void WATCHDOG_kick(int32_t fd, int32_t *error);Link with -lsimpleio.
WATCHDOG_open() opens a watchdog timer device. The device node name, usually /dev/watchdog, must be passed in the name parameter. Upon success, a file descriptor for the watchdog timer device is returned in *fd.
WATCHDOG_close() closes a previously opened watchdog timer device. Note that this may result in watchdog timer expiration and subsequent system reset.
WATCHDOG_get_timeout() may be used to discover the current watchdog timeout period. Upon success, the watchdog period in seconds will be returned in *timeout.
WATCHDOG_set_timeout() may be used to change the watchdog timeout period. The requested new timeout period in seconds must be passed in newtimeout. Upon success, the actual new watchdog period in seconds will be returned in *timeout. Note that the new watchdog period may be different from that requested. For example, if the watchdog timer device has a granularity of one minute, requesting a timeout of 45 seconds will result in an actual timeout of 60 seconds. Also note that the particular watchdog timer device may not allow increasing the timeout or may not allow changing it at all.
WATCHDOG_kick() may be used to reset the watchdog timer.