Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

/sys/class/watchdog

FieldValue
Subsystemwatchdog subsystem (watchdog core + drivers); implementation files not in cached tree
Config gatenot verifiable from the cached sources (cached tree has no Kconfig or driver files); class absent on the live host (no watchdog device registered)
ABI documentationDocumentation/ABI/testing/sysfs-class-watchdog (13 What entries)
SinceAugust 2015 for the core files; pretimeout December 2016; pretimeout governors February 2017; access_cs0 August 2019; options and fw_version April 2023
Live (5.10.134 host)class absent: not in live-sys/class-list.txt, /sys/class/watchdog missing (verified); no watchdog hardware in the container
Ledger IDSYSC-watchdog

What it represents

One directory per watchdog device (watchdog0, watchdog1, …). A watchdog must be petted within its timeout or the machine reboots; the class exposes the device identity, timeout bookkeeping, boot-time status (did the last reset come from the watchdog?) and the nowayout and pretimeout policy knobs. The actual arming interface is the character device /dev/watchdogN with the WDIOC_* ioctls (declared in /usr/include/linux/watchdog.h, present on the host).

Relationship to the device model

Each class device is backed by a watchdog_device registered through the watchdog core; sysfs attributes mirror selected ioctls - the ABI says so explicitly (bootstatus “equivalent to WDIOC_GETBOOTSTATUS”, status “equivalent to WDIOC_GETSTATUS”, timeleft “equivalent to WDIOC_GETTIMELEFT”). Pretimeout support splits the alarm into two stages: a governor (chosen via pretimeout_governor) decides what happens at the pretimeout point before the final reset. access_cs0 exists only on the AST2400/AST2500 Aspeed SoCs after an alternate-flash boot, and the ABI restricts it to watchdog1 (wdt2).

Attributes

AttributeR/WUnit/formatConditional?Source
watchdogn/identityROidentity string of the devicewatchdog deviceABI, August 2015
watchdogn/bootstatusROstatus at boot (WDIOC_GETBOOTSTATUS equivalent)watchdog deviceABI, August 2015
watchdogn/statusROinternal status bits (WDIOC_GETSTATUS equivalent)watchdog deviceABI, August 2015
watchdogn/stateROactive/inactive statuswatchdog deviceABI, August 2015
watchdogn/timeleftROseconds left before reset (WDIOC_GETTIMELEFT equivalent)watchdog deviceABI, August 2015
watchdogn/timeoutROcurrent programmed timeout (ABI text: read only)watchdog deviceABI, August 2015
watchdogn/nowayoutRWread 0/1; write 1 enables nowayout; cannot be undonewatchdog deviceABI, August 2015
watchdogn/pretimeoutROseconds before timeout when the pretimeout interrupt fires; optional featurepretimeout-capableABI, December 2016
watchdogn/pretimeout_available_governorsROgovernors available for this watchdogpretimeout-capableABI, February 2017
watchdogn/pretimeout_governorRWcurrent pretimeout governor; write selects itpretimeout-capableABI, February 2017
watchdogn/optionsROoptions of the watchdog devicewatchdog deviceABI, April 2023
watchdogn/fw_versionROfirmware version of the watchdog devicewatchdog deviceABI, April 2023
watchdog1/access_cs0RWnon-zero write clears boot code selection and timeout counter; restores CS0 access after alt-flash bootAST2400/2500 alternate bootABI, August 2019

Safety and writes

nowayout is a one-way latch: once written 1, the watchdog can never be stopped again (the ABI says writing 0 either does nothing or returns a permission error). pretimeout_governor changes what happens on the pretimeout event. Reading everything is safe. Note the ABI marks timeout and pretimeout as read-only files; runtime retuning happens through the /dev ioctls (WDIOC_SETOPTIONS, set-timeout), not these files, per the ABI text.

References

  • Documentation/ABI/testing/sysfs-class-watchdog (cached copy; 13 What entries)
  • /usr/include/linux/watchdog.h (host header, verified: WDIOC_GETSTATUS/GETBOOTSTATUS/SETOPTIONS/GETTIMELEFT)
  • Implementation: not in cached tree
  • Coverage: ledger
  • Live check: /sys/class/watchdog absent (kernel 5.10.134, read-only enumeration)