Bug #34380: preserve errno for stream_select and stream_socket_pair

When the system calls underneath stream_select() and stream_socket_pair()
fail, errno is logged but is not preserved. This change preservers errno in
posix_globals to allow the caller to query posix_get_last_error() to determine
the cause of the failure.

Previously there wasn't any way to differentiate between a signal interrupt
(EINTR) and other errors, making proper error handling/recovery difficult or
impossible.