try {
ChannelDescriptor descriptor = ChannelDescriptor.getDescriptorByFileno(runtime.getFilenoExtMap(fileno));
if (descriptor == null) throw runtime.newErrnoEBADFError();
descriptor.checkOpen();
if (options != null && !(options instanceof RubyHash)) {
throw context.runtime.newTypeError(options, runtime.getHash());
}