Log Message: NetBSD 6 has memrchr(3) in libc, resolve a conflict. Add a few missing headers and deal with some of the fallout of compilling with -Wall -Wno-error.