xref: /freebsd/share/man/man9/watchdog.9 (revision 06c3fb27)
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.Dd February 28, 2004
26.Dt WATCHDOG 9
27.Os
28.Sh NAME
29.Nm watchdog
30.Nd "software and hardware watchdog facility"
31.Sh SYNOPSIS
32.In sys/watchdog.h
33.Ft void
34.Fn watchdog_fn "void *private" "u_int cmd" "int *error"
35.Fn EVENTHANDLER_REGISTER watchdog_list watchdog_fn private 0
36.Fn EVENTHANDLER_DEREGISTER watchdog_list eventhandler_tag
37.Sh DESCRIPTION
38To implement a watchdog in software or hardware, only a single
39function needs to be written and registered on the global
40.Va watchdog_list .
41.Pp
42The function must examine the
43.Fa cmd
44argument and act on it as
45follows:
46.Pp
47If
48.Fa cmd
49is zero, the watchdog must be disabled and the
50.Fa error
51argument left untouched.
52If the watchdog cannot be disabled, the
53.Fa error
54argument must be set to
55.Dv EOPNOTSUPP .
56.Pp
57Else the watchdog should be reset and configured to a timeout of
58.Pq 1 << Pq Fa cmd No & Dv WD_INTERVAL
59nanoseconds or larger and the
60.Fa error
61argument be set to zero to signal arming of a watchdog.
62.Pp
63If the watchdog cannot be configured to the proposed timeout, it
64must be disabled and the
65.Fa error
66argument left as is (to avoid hiding the arming of another watchdog).
67.Pp
68There is no specification of what the watchdog should do when it
69times out, but a hardware reset or similar
70.Dq "drastic but certain"
71behaviour is recommended.
72.Sh SEE ALSO
73.Xr watchdog 4
74.Sh AUTHORS
75.An -nosplit
76The
77.Nm
78facility and this manual page was written
79.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org .
80