1.\" 2.\" Copyright (c) 2004 Poul-Henning Kamp <phk@FreeBSD.org 3.\" All rights reserved. 4.\" 5.\" Redistribution and use in source and binary forms, with or without 6.\" modification, are permitted provided that the following conditions 7.\" are met: 8.\" 1. Redistributions of source code must retain the above copyright 9.\" notice, this list of conditions and the following disclaimer. 10.\" 2. Redistributions in binary form must reproduce the above copyright 11.\" notice, this list of conditions and the following disclaimer in the 12.\" documentation and/or other materials provided with the distribution. 13.\" 14.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR 15.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, 18.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24.\" 25.\" $FreeBSD$ 26.\" 27.Dd February 28, 2004 28.Dt WATCHDOG 9 29.Os 30.Sh NAME 31.Nm watchdog 32.Nd "software and hardware watchdog facility" 33.Sh SYNOPSIS 34.In sys/watchdog.h 35.Ft void 36.Fn watchdog_fn "void *private" "u_int cmd" "int *error" 37.Fn EVENTHANDLER_REGISTER watchdog_list watchdog_fn private 0 38.Sh DESCRIPTION 39To implement a watchdog in software or hardware, only a single 40function needs to be written and registered on the global 41.Va watchdog_list . 42.Pp 43The function must examine the 44.Fa cmd 45argument and act on it as 46follows: 47.Pp 48If 49.Fa cmd 50is zero, the watchdog must be disabled and the 51.Fa error 52argument left untouched. 53.Pp 54Else the watchdog should be reset and configured to a timeout of 55.Pq 1 << Pq Fa cmd No & Dv WD_INTERVAL 56nanoseconds or larger and the 57.Fa error 58argument be set to zero. 59.Pp 60If the watchdog cannot be configured to the proposed timeout, it 61must be disabled and the 62.Fa error 63argument left untouched. 64.Pp 65There is no specification of what the watchdog should do when it 66times out, but a hardware reset or similar 67.Dq "drastic but certain" 68behaviour is recommended. 69.Sh SEE ALSO 70.Xr watchdog 4 71.Sh AUTHORS 72.An -nosplit 73The 74.Nm 75facility and this manual page was written 76.An Poul-Henning Kamp Aq phk@FreeBSD.org . 77