HDFS-5642: shuffle around #include of pthread.h.
HDFS-5642: guard use of gcc format attribute behind #ifdef.