include cleanups: remove unused headers and add feature test macros
global cleanup to use the new syscall interface
initial check-in, version 0.5.0