SnabbCo/snabbswitch — pull request #232 by eugeneia (2014-07-25 18:08:17+00:00)
Title: Added watchdog module.

This adds the module `lib.watchdog.watchdog` whose purpose is to provide a simple process supervision service. The idea is to set up a "watchdog" with a specified timeout. Unless the timeout is reset in time, the watchdog will kill the process because it is assumed that the offending process is hanging.

The implementation works as follows (roughly speaking): The process periodically resets an `alarm(3)`, resetting the previous alarm each time. If it fails to reset the alarm, it will receive a `SIGALRM` which it does not handle, and thus it is killed.

For a detailed usage description see the file `src/watchdog/README.md`.

*NOTE:* This pull request also introduces a new way to write tests. It adjusts `src/Makefile` to look for executables named `selftest.sh` in the `src/` directory and run them as tests.