12bedf807SPoul-Henning Kamp.\" 22bedf807SPoul-Henning Kamp.\" Copyright (c) 2004 Poul-Henning Kamp <phk@FreeBSD.org 32bedf807SPoul-Henning Kamp.\" All rights reserved. 42bedf807SPoul-Henning Kamp.\" 52bedf807SPoul-Henning Kamp.\" Redistribution and use in source and binary forms, with or without 62bedf807SPoul-Henning Kamp.\" modification, are permitted provided that the following conditions 72bedf807SPoul-Henning Kamp.\" are met: 82bedf807SPoul-Henning Kamp.\" 1. Redistributions of source code must retain the above copyright 92bedf807SPoul-Henning Kamp.\" notice, this list of conditions and the following disclaimer. 102bedf807SPoul-Henning Kamp.\" 2. Redistributions in binary form must reproduce the above copyright 112bedf807SPoul-Henning Kamp.\" notice, this list of conditions and the following disclaimer in the 122bedf807SPoul-Henning Kamp.\" documentation and/or other materials provided with the distribution. 132bedf807SPoul-Henning Kamp.\" 142bedf807SPoul-Henning Kamp.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR 152bedf807SPoul-Henning Kamp.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 162bedf807SPoul-Henning Kamp.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 172bedf807SPoul-Henning Kamp.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, 182bedf807SPoul-Henning Kamp.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 192bedf807SPoul-Henning Kamp.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 202bedf807SPoul-Henning Kamp.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 212bedf807SPoul-Henning Kamp.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 222bedf807SPoul-Henning Kamp.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 232bedf807SPoul-Henning Kamp.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 242bedf807SPoul-Henning Kamp.\" 252bedf807SPoul-Henning Kamp.\" $FreeBSD$ 262bedf807SPoul-Henning Kamp.\" 272bedf807SPoul-Henning Kamp.Dd February 28, 2004 286ac051ecSRuslan Ermilov.Dt WATCHDOG 9 292bedf807SPoul-Henning Kamp.Os 302bedf807SPoul-Henning Kamp.Sh NAME 312bedf807SPoul-Henning Kamp.Nm watchdog 326ac051ecSRuslan Ermilov.Nd "software and hardware watchdog facility" 332bedf807SPoul-Henning Kamp.Sh SYNOPSIS 342bedf807SPoul-Henning Kamp.In sys/watchdog.h 356ac051ecSRuslan Ermilov.Ft void 362bedf807SPoul-Henning Kamp.Fn watchdog_fn "void *private" "u_int cmd" "int *error" 376ac051ecSRuslan Ermilov.Fn EVENTHANDLER_REGISTER watchdog_list watchdog_fn private 0 389079fff5SNick Hibma.Fn EVENTHANDLER_DEREGISTER watchdog_list eventhandler_tag 392bedf807SPoul-Henning Kamp.Sh DESCRIPTION 402bedf807SPoul-Henning KampTo implement a watchdog in software or hardware, only a single 412bedf807SPoul-Henning Kampfunction needs to be written and registered on the global 426ac051ecSRuslan Ermilov.Va watchdog_list . 432bedf807SPoul-Henning Kamp.Pp 446ac051ecSRuslan ErmilovThe function must examine the 456ac051ecSRuslan Ermilov.Fa cmd 466ac051ecSRuslan Ermilovargument and act on it as 472bedf807SPoul-Henning Kampfollows: 482bedf807SPoul-Henning Kamp.Pp 496ac051ecSRuslan ErmilovIf 506ac051ecSRuslan Ermilov.Fa cmd 516ac051ecSRuslan Ermilovis zero, the watchdog must be disabled and the 526ac051ecSRuslan Ermilov.Fa error 53ffdb86feSChristian Bruefferargument left untouched. 54ffdb86feSChristian BruefferIf the watchdog cannot be disabled, the 5536eab024SNick Hibma.Fa error 5636eab024SNick Hibmaargument must be set to 5736eab024SNick Hibma.Dv EOPNOTSUPP . 582bedf807SPoul-Henning Kamp.Pp 592bedf807SPoul-Henning KampElse the watchdog should be reset and configured to a timeout of 606ac051ecSRuslan Ermilov.Pq 1 << Pq Fa cmd No & Dv WD_INTERVAL 616ac051ecSRuslan Ermilovnanoseconds or larger and the 626ac051ecSRuslan Ermilov.Fa error 6336eab024SNick Hibmaargument be set to zero to signal arming of a watchdog. 642bedf807SPoul-Henning Kamp.Pp 652bedf807SPoul-Henning KampIf the watchdog cannot be configured to the proposed timeout, it 666ac051ecSRuslan Ermilovmust be disabled and the 676ac051ecSRuslan Ermilov.Fa error 6836eab024SNick Hibmaargument left as is (to avoid hiding the arming of another watchdog). 692bedf807SPoul-Henning Kamp.Pp 702bedf807SPoul-Henning KampThere is no specification of what the watchdog should do when it 716ac051ecSRuslan Ermilovtimes out, but a hardware reset or similar 726ac051ecSRuslan Ermilov.Dq "drastic but certain" 732bedf807SPoul-Henning Kampbehaviour is recommended. 742bedf807SPoul-Henning Kamp.Sh SEE ALSO 752bedf807SPoul-Henning Kamp.Xr watchdog 4 762bedf807SPoul-Henning Kamp.Sh AUTHORS 772bedf807SPoul-Henning Kamp.An -nosplit 786ac051ecSRuslan ErmilovThe 796ac051ecSRuslan Ermilov.Nm 806ac051ecSRuslan Ermilovfacility and this manual page was written 812bedf807SPoul-Henning Kamp.An Poul-Henning Kamp Aq phk@FreeBSD.org . 82