Feature #936 ยป nread.diff
ruby/io.c 2008-12-27 17:23:27.000000000 +0600 | ||
---|---|---|
return INT2FIX(fd);
|
||
}
|
||
static VALUE
|
||
rb_io_nread(VALUE io) // --gc
|
||
{
|
||
rb_io_t *fptr;
|
||
int fd;
|
||
int ret = -1;
|
||
GetOpenFile(io, fptr);
|
||
fd = fptr->fd;
|
||
if (ioctl (fd, FIONREAD, &ret) != 0)
|
||
return INT2FIX(-1);
|
||
return INT2FIX(ret);
|
||
}
|
||
/*
|
||
* call-seq:
|
||
... | ... | |
rb_define_method(rb_cIO, "sysread", rb_io_sysread, -1);
|
||
rb_define_method(rb_cIO, "fileno", rb_io_fileno, 0);
|
||
rb_define_method(rb_cIO, "nread", rb_io_nread, 0); //--gc
|
||
rb_define_alias(rb_cIO, "to_i", "fileno");
|
||
rb_define_method(rb_cIO, "to_io", rb_io_to_io, 0);
|
||