10 # define rb_io_t OpenFile
14 # define FPTR_TO_FD(fptr) (fileno(GetReadFile(fptr)))
16 # if !HAVE_RB_IO_T || (RUBY_VERSION_MAJOR == 1 && RUBY_VERSION_MINOR == 8)
17 # define FPTR_TO_FD(fptr) fileno(fptr->f)
19 # define FPTR_TO_FD(fptr) fptr->fd
23 static int my_fileno(VALUE io
)
28 if (TYPE(io
) != T_FILE
)
29 io
= rb_convert_type(io
, T_FILE
, "IO", "to_io");
30 GetOpenFile(io
, fptr
);
31 fd
= FPTR_TO_FD(fptr
);
34 rb_raise(rb_eIOError
, "closed stream");