Fix posix errno.
Move headers of service call code.
Delete needless macros.