3d7415f43f0fe6a821d7bc4a341ba371e8a30ef3Lennart Poettering This file is part of systemd.
3d7415f43f0fe6a821d7bc4a341ba371e8a30ef3Lennart Poettering Copyright 2012 Lennart Poettering
3d7415f43f0fe6a821d7bc4a341ba371e8a30ef3Lennart Poettering systemd is free software; you can redistribute it and/or modify it
3d7415f43f0fe6a821d7bc4a341ba371e8a30ef3Lennart Poettering under the terms of the GNU Lesser General Public License as published by
3d7415f43f0fe6a821d7bc4a341ba371e8a30ef3Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
3d7415f43f0fe6a821d7bc4a341ba371e8a30ef3Lennart Poettering (at your option) any later version.
3d7415f43f0fe6a821d7bc4a341ba371e8a30ef3Lennart Poettering systemd is distributed in the hope that it will be useful, but
3d7415f43f0fe6a821d7bc4a341ba371e8a30ef3Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
3d7415f43f0fe6a821d7bc4a341ba371e8a30ef3Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3d7415f43f0fe6a821d7bc4a341ba371e8a30ef3Lennart Poettering Lesser General Public License for more details.
3d7415f43f0fe6a821d7bc4a341ba371e8a30ef3Lennart Poettering You should have received a copy of the GNU Lesser General Public License
3d7415f43f0fe6a821d7bc4a341ba371e8a30ef3Lennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
3d7415f43f0fe6a821d7bc4a341ba371e8a30ef3Lennart Poetteringstatic usec_t watchdog_timeout = USEC_INFINITY;
3d7415f43f0fe6a821d7bc4a341ba371e8a30ef3Lennart Poettering r = ioctl(watchdog_fd, WDIOC_SETOPTIONS, &flags);
3d7415f43f0fe6a821d7bc4a341ba371e8a30ef3Lennart Poettering return log_warning_errno(errno, "Failed to disable hardware watchdog: %m");
3d7415f43f0fe6a821d7bc4a341ba371e8a30ef3Lennart Poettering sec = (int) ((watchdog_timeout + USEC_PER_SEC - 1) / USEC_PER_SEC);
3d7415f43f0fe6a821d7bc4a341ba371e8a30ef3Lennart Poettering r = ioctl(watchdog_fd, WDIOC_SETTIMEOUT, &sec);
3d7415f43f0fe6a821d7bc4a341ba371e8a30ef3Lennart Poettering return log_warning_errno(errno, "Failed to set timeout to %is: %m", sec);
3d7415f43f0fe6a821d7bc4a341ba371e8a30ef3Lennart Poettering watchdog_timeout = (usec_t) sec * USEC_PER_SEC;
3d7415f43f0fe6a821d7bc4a341ba371e8a30ef3Lennart Poettering log_info("Set hardware watchdog to %s.", format_timespan(buf, sizeof(buf), watchdog_timeout, 0));
return -errno;
struct watchdog_info ident;
if (watchdog_fd >= 0)
if (watchdog_fd < 0)
return -errno;
ident.identity,
ident.firmware_version);
return update_timeout();
if (watchdog_fd < 0)
r = open_watchdog();
r = update_timeout();
if (watchdog_fd < 0) {
r = open_watchdog();
if (watchdog_fd < 0)
if (disarm) {