Class: IO
- Inherits:
-
Object
- Object
- IO
- Defined in:
- (unknown)
Instance Method Summary collapse
-
#pathconf(arg) ⇒ Object
pathconf(name) -> Integer.
Instance Method Details
#pathconf(arg) ⇒ Object
pathconf(name) -> Integer
Returns pathname configuration variable using fpathconf().
name should be a constant under Etc
which begins with PC_
.
The return value is an integer or nil. nil means indefinite limit. (fpathconf() returns -1 but errno is not set.)
require 'etc'
IO.pipe {|r, w|
p w.pathconf(Etc::PC_PIPE_BUF) #=> 4096
}
997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 |
# File 'etc.c', line 997 static VALUE io_pathconf(VALUE io, VALUE arg) { int name; long ret; name = NUM2INT(arg); errno = 0; ret = fpathconf(rb_io_descriptor(io), name); if (ret == -1) { if (errno == 0) /* no limit */ return Qnil; rb_sys_fail("fpathconf"); } return LONG2NUM(ret); } |