Implement support for systems where pipe2 returns ENOSYS

fixes #7065
fixes #6696