Esempio n. 1
0
int watchdog_ping(void) {
        int r;

        if (watchdog_fd < 0) {
                r = open_watchdog();
                if (r < 0)
                        return r;
        }

        r = ioctl(watchdog_fd, WDIOC_KEEPALIVE, 0);
        if (r < 0)
                return log_warning_errno(errno, "Failed to ping hardware watchdog: %m");

        return 0;
}
Esempio n. 2
0
int watchdog_set_timeout(usec_t *usec) {
    int r;

    watchdog_timeout = *usec;

    /* If we didn't open the watchdog yet and didn't get any
     * explicit timeout value set, don't do anything */
    if (watchdog_fd < 0 && watchdog_timeout == USEC_INFINITY)
        return 0;

    if (watchdog_fd < 0)
        r = open_watchdog();
    else
        r = update_timeout();

    *usec = watchdog_timeout;

    return r;
}