类 IO
公共实例方法
pathconf(name) → Integer 点击切换源代码
使用 fpathconf() 返回路径名配置变量。
name 应该是一个以 PC_ 开头的 Etc 下的常量。
返回值是一个整数或 nil。 nil 表示无限限制。(fpathconf() 返回 -1 但未设置 errno。)
require 'etc' IO.pipe {|r, w| p w.pathconf(Etc::PC_PIPE_BUF) #=> 4096 }
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);
}