>> dup2(oldfd, newfd) closes oldfd.(I guess that's what he meant).
> No, it doesn't close oldfd.
> It may close newfd if it was already open.
Anyway, only dup2() should probably release the GIL.
One reasonable heuristic is to check the man page: if the syscall can
return EINTR, then the GIL should be released.