---
name: "watchdog"
section: "9"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["linux", "freebsd"]
url: "https://new.carta.tech/watchdog/9"
---

# watchdog(9)

software and hardware watchdog facility

## NAME

**watchdog** – software and hardware watchdog facility

## SYNOPSIS

**#include \<sys/watchdog.h\>**

*void*\

**watchdog\_fn**(*void \*private*, *u\_int cmd*, *int \*error*);

**EVENTHANDLER\_REGISTER**(*watchdog\_list*, *watchdog\_fn*, *private*, *0*);

**EVENTHANDLER\_DEREGISTER**(*watchdog\_list*, *eventhandler\_tag*);

## DESCRIPTION

To implement a watchdog in software or hardware, only a single function needs to be written and registered on the global *watchdog\_list*.

The function must examine the *cmd* argument and act on it as follows:

If *cmd* is zero, the watchdog must be disabled and the *error* argument left untouched. If the watchdog cannot be disabled, the *error* argument must be set to EOPNOTSUPP.

Else the watchdog should be reset and configured to a timeout of (1 \<\< (*cmd* & WD\_INTERVAL)) nanoseconds or larger and the *error* argument be set to zero to signal arming of a watchdog.

If the watchdog cannot be configured to the proposed timeout, it must be disabled and the *error* argument left as is (to avoid hiding the arming of another watchdog).

There is no specification of what the watchdog should do when it times out, but a hardware reset or similar “drastic but certain” behaviour is recommended.

## SEE ALSO

[watchdog(4)](/watchdog/4.md)

## AUTHORS

The **watchdog** facility and this manual page was written Poul-Henning Kamp ⟨*phk@FreeBSD.org*⟩.
