genpipe.c: support select() and poll()