use retfd for socket
move socket and socketpair to shared code