Search code examples
linuxembedded-linuxwatchdog

Meaning of writing 'V' to watchdog device file


What does it mean when we do echo V > /dev/watchdog? One article said it can prevent stopping watchdog accidentally. I am not clear about this purpose.


Solution

  • According to the Kernel documentation this is called the 'Magic Close' feature https://www.kernel.org/doc/Documentation/watchdog/watchdog-api.txt

    Magic Close feature:
    
    If a driver supports "Magic Close", the driver will not disable the
    watchdog unless a specific magic character 'V' has been sent to
    /dev/watchdog just before closing the file.  If the userspace daemon
    closes the file without sending this special character, the driver
    will assume that the daemon (and userspace in general) died, and will
    stop pinging the watchdog without disabling it first.  This will then
    cause a reboot if the watchdog is not re-opened in sufficient time.