From 9ff3d9dec9c1bb1783591de212c9deb5d542f98f Mon Sep 17 00:00:00 2001 From: normal Date: Fri, 11 Dec 2015 22:49:27 +0000 Subject: IO#advise should not raise Errno::ENOSYS As it is just a hint the kernel is free to ignore, IO#advise already succeeds when posix_fadvise is not available build time at all. Following that, if posix_fadvise was available at build time but not implemented in the running kernel, we should also ignore it. * io.c (do_io_advise): do not raise on ENOSYS * test/ruby/test_io.rb (test_advise): do not skip on Errno::ENOSYS (test_advise_pipe): ditto [ruby-core:72066] [Feature #11806] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'io.c') diff --git a/io.c b/io.c index d5bd2fc84f..c8c13f85ea 100644 --- a/io.c +++ b/io.c @@ -8586,7 +8586,7 @@ do_io_advise(rb_io_t *fptr, VALUE advice, off_t offset, off_t len) 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" " -- cgit v1.2.3