Project

General

Profile

Feature #11806 ยป 0001-IO-advise-avoids-raising-Errno-ENOSYS.patch

normalperson (Eric Wong), 12/11/2015 08:05 PM

View differences:

io.c
ias.len = len;
rv = (int)rb_thread_io_blocking_region(io_advise_internal, &ias, fptr->fd);
if (rv) {
if (rv && rv != ENOSYS) {
/* posix_fadvise(2) doesn't set errno. On success it returns 0; otherwise
it returns the error code. */
VALUE message = rb_sprintf("%"PRIsVALUE" "
test/ruby/test_io.rb
ret = assert_nothing_raised(lambda { os_and_fs(tf.path) }) {
begin
t.advise(adv, offset, len)
rescue Errno::ENOSYS
skip
rescue Errno::EINVAL => e
if /linux/ =~ RUBY_PLATFORM && (Etc.uname[:release].split('.').map(&:to_i) <=> [3,6]) < 0
next # [ruby-core:65355] tmpfs is not supported
......
# we don't know if other platforms have a real posix_fadvise()
with_pipe do |r,w|
# Linux 2.6.15 and earlier returned EINVAL instead of ESPIPE
assert_raise(Errno::ESPIPE, Errno::EINVAL, Errno::ENOSYS) { r.advise(:willneed) }
assert_raise(Errno::ESPIPE, Errno::EINVAL, Errno::ENOSYS) { w.advise(:willneed) }
assert_raise(Errno::ESPIPE, Errno::EINVAL) { r.advise(:willneed) }
assert_raise(Errno::ESPIPE, Errno::EINVAL) { w.advise(:willneed) }
end
end if /linux/ =~ RUBY_PLATFORM
-
    (1-1/1)