Add support for ppoll and pselect

This is based on huge commit 11952073af22568b from master.

Change-Id: Ib033a75b6bd659a9ccb190f8c3b4ec75aa396731