Android's Watchdog daemon

    Android framework's Watchdog (Java implementation) is meant to handle cases when the framework ends up in an unresponsive state. However, this doesn't help handle kernel or other OEM specific driver issues. Chip vendors usually provide a hardware watchdog to hard reset the system to handle software failures. The hardware watchdog just waits to be reset by software within a specific duration and force resets the system if otherwise. The hardware watchdog is just handled by a vendor specific watchdog driver and it exposes IOCTL APIs for user space to set timeout interval, reset the watchdog etc. So does Android provide any support?

    Its supported by a daemon process (/sbin/watchdogd) and OEMs could use this to fine tune timeout intervals or even completely disable it. watchdogd is really a symbolic link to init process.

    lrwxrwxrwx root     root              1969-12-31 19:00 watchdogd -> ../init

   Once started, it opens the watchdog device (/dev/watchdog) and sets the default or specified timeout interval (WDIOC_SETTIMEOUT) and periodically writes into the device to ping the hardware watchdog. AOSP doesn't have the logic to start this daemon and the emulator too doesn't have the device. Trying to start the daemon fails in the emulator.

    adb shell
    #./sbin/watchdogd

<3>init: watchdogd: Failed to open /dev/watchdog: No such file or directory

   However, OEMs could start the daemon by updating the init.rc script to start the daemon after boot up and set out an appropriate timeout.

No comments: