Daemon stats for Linux and Mac (untested for Windows)

I've used ifdefs for cross platform support.
After we figure out a good way to integrate this into the build system, we can make separate source files for each platform and let the build system compile what's right.

Windows code is untested atm. I'll get to it soon.