STRUCT WATCHDOG_DEVICE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– NAME πŸ’–

okay so this is struct watchdog_device, bestie β€” straight from the Kernel API Manual, section 9. It’s literally the structure that defines a watchdog device, and yes, she’s iconic. Periodt. πŸŽ€βœ¨

πŸŽ€ SYNOPSIS πŸŽ€

no cap, here’s the whole struct exactly as it appears β€” do not touch the formatting, she’s sensitive:

       struct watchdog_device {
           int id;
           struct device *parent;
           const struct attribute_group **groups;
           const struct watchdog_info *info;
           const struct watchdog_ops *ops;
           const struct watchdog_governor *gov;
           unsigned int bootstatus;
           unsigned int timeout;
           unsigned int pretimeout;
           unsigned int min_timeout;
           unsigned int max_timeout;
           unsigned int min_hw_heartbeat_ms;
           unsigned int max_hw_heartbeat_ms;
           struct notifier_block reboot_nb;
           struct notifier_block restart_nb;
           struct notifier_block pm_nb;
           void *driver_data;
           struct watchdog_core_data *wd_data;
           unsigned long status;
         #define WDOG_ACTIVE             0       ;
         #define WDOG_NO_WAY_OUT         1       ;
         #define WDOG_STOP_ON_REBOOT     2       ;
         #define WDOG_HW_RUNNING         3       ;
         #define WDOG_STOP_ON_UNREGISTER 4       ;
         #define WDOG_NO_PING_ON_SUSPEND 5       ;
           struct list_head deferred;
        };

πŸ’… Members πŸ’…

okay bestie, let’s go member by member, because every field matters and we are not skipping a single one:

  • id β€” The watchdog’s ID. (Allocated by watchdog_register_device.) πŸ’–
  • parent β€” The parent bus device. 🚌
  • groups β€” List of sysfs attribute groups to create when creating the watchdog device. ✨
  • info β€” Pointer to a watchdog_info structure. πŸ“‹
  • ops β€” Pointer to the list of watchdog operations. πŸ› οΈ
  • gov β€” Pointer to watchdog pretimeout governor. πŸ‘‘
  • bootstatus β€” Status of the watchdog device at boot. πŸŒ…
  • timeout β€” The watchdog device’s timeout value (in seconds). ⏳
  • pretimeout β€” The watchdog device’s pre_timeout value. ⏰
  • min_timeout β€” The watchdog device’s minimum timeout value (in seconds). πŸ₯Ί
  • max_timeout β€” The watchdog device’s maximum timeout value (in seconds) as configurable from user space. Only relevant if max_hw_heartbeat_ms is not provided. πŸ”₯
  • min_hw_heartbeat_ms β€” Hardware limit for minimum time between heartbeats, in milli-seconds. πŸ’“
  • max_hw_heartbeat_ms β€” Hardware limit for maximum timeout, in milli-seconds. Replaces max_timeout if specified. πŸ’₯
  • reboot_nb β€” The notifier block to stop watchdog on reboot. πŸ”„
  • restart_nb β€” The notifier block to register a restart function. 🫢
  • pm_nb β€” The notifier block to stop watchdog on suspend and restart it on resume. πŸ˜΄βž‘οΈπŸƒ
  • driver_data β€” Pointer to the driver’s private data. πŸ”
  • wd_data β€” Pointer to watchdog core internal data. 🧠
  • status β€” Field that contains the device’s internal status bits. πŸ“Š
  • deferred β€” Entry in wtd_deferred_reg_list which is used to register early initialized watchdogs. 🐣

🌸 Description 🌸

The watchdog_device structure contains all information about a watchdog timer device. That’s the whole vibe: one struct, all the watchdog tea. πŸ«–πŸ’…

The driver_data field may not be accessed directly. Nope, absolutely not, bestie β€” that’s a hard no. It must be accessed via the watchdog_set_drvdata and watchdog_get_drvdata helpers. That’s the rule, iykyk. πŸš«πŸ”‘

πŸ”₯ SEE ALSO πŸ”₯

  • Kernel file ./include/linux/watchdog.h β€” go read it, it’s giving source-of-truth energy. πŸ“–βœ¨
  • struct watchdog_ops(9) β€” the companion page, slay. πŸ‘―β€β™€οΈ

okay bye bestie 🫢 mwah πŸ’‹ β€” source/version footer says ./include/linux, date October 2026, and the manual title is struct watchdog_device(9). Slay and stay watched. 🌈✨

πŸ“¦ where this page comes from