Add back synchronization around IO methods that touch the file.

Part of fixes for #2102.
Bit of RubyIO cleanup.
Only query realFileno once here.
Clean up uses of old select logic.
Fix select logic to only "ready" fds with appropriate operations.

POSIX select removes from the given fd sets all fds that are *not*
ready for that particular operation. That was missing in our
logic, so *all* fds selected on were put into *all* ready lists.

This change passes a set of interest operations into fdIsSet,
allowing us to detect whether the fd is actually ready for the
requested operations.

For #2102.
Deprecate SelectBlob.
Clean up imports.
Ensure fd doesn't null out on us halfway through.