将“V”写入看门狗设备文件的含义

nat*_*han 4 linux watchdog embedded-linux

我们做的时候是什么意思echo V > /dev/watchdog?一篇文章说它可以防止意外停止看门狗。我不清楚这个目的。

whh*_*000 5

根据内核文档,这称为“魔术关闭”功能 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.
Run Code Online (Sandbox Code Playgroud)