Port back some patches on futex, to fix problems with process-shared mutexes

Signed-off-by: Christophe Chapuis <chris.chapuis@gmail.com>