(CFACT-70) maintenance - refactor usage of kstat to a wrapper

kstat APIs are used by solaris and other systems like free bsd to fetch kernel statistics. This patch refactors the kstat invocations into a simpler wrapper that handles both errors and data retrieval.
I just noticed that all you have are explicit instantiations and there's no actual definition for `template <typename T> T value(...)`.  This is a an odd way of doing overloading by return-type, especially when there can't be a generic implementation due to the required access in what I presume to be a union (`i32`, `i64`, `str.addr.ptr`, etc).  This is fine as is; if someone uses a type that doesn't have an explicit instantiation then they won't be able to link.