Difference between /dev/watchdog and /dev/watchdog[0-9]

watchdog

On my (embedded) system I have multiple watchdog character devices:

# ls -al /dev/watchdog*
crw------- 1 imp  root  10, 130 Apr 26 07:43 /dev/watchdog
crw------- 1 root root 253,   0 Apr 26 07:44 /dev/watchdog0
crw------- 1 root root 253,   1 Apr 26 07:44 /dev/watchdog1

# dmesg | grep -i watchdog
[    2.342104] omap_wdt: OMAP Watchdog Timer Rev 0x01: initial timeout 60 sec
[    6.713125] softdog: Software Watchdog Timer: 0.08 initialized. soft_noboot=0 soft_margin=120 sec soft_panic=0 (nowayout=1)

I'm pretty sure that /dev/watchdog0 is the hardware watchdog and /dev/watchdog1 is the software watchdog, but why is there also a /dev/watchdog ?

Background: The software watchdog is configured with nowayout flag, so, once it has been feeded it won't stop anymore until reboot. However, writing to /dev/watchdog doesn't seem to trigger the software watchdog and doesn't give me the important nowayout feature. I could use /dev/watchdog1 directly, but then I'd need some reliable way to identify the correct software watchdog device filename…

Best Answer

I had the same question. According to the kernel documentation:

  • id: [...] id 0 is special. It has both a /dev/watchdog0 cdev (dynamic major, minor 0) as well as the old /dev/watchdog miscdev. The id is set automatically when calling watchdog_register_device.

In other words, /dev/watchdog and /dev/watchdog0 both point to the same device. Any additional watchdogs will be numbered greater than 0 and will have only a single device node.

Related Question