(cherry picked from commit 29055464a0) Some adjustments were needed for a tricky multi-inclusion issue related to libioP.h.
29055464a0