move most functions from vnstatd.c to daemon.c in order to enable testability