Fixed by Eric Wong. [ruby-core:36150]
(maygvl_copy_stream_wait_readwrite): removed.
(nogvl_copy_stream_sendfile): use nogvl_copy_stream_wait_write and
maygvl_copy_stream_wait_read instead of
maygvl_copy_stream_wait_readwrite.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32019 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
based on the patch by Eric Wong. [ruby-core:36156]
* vm_core.h (rb_thread_call_with_gvl): don't declare here.
* thread.c: include internal.h.
(rb_thread_execute_interrupts): new function.
* internal.h (rb_thread_execute_interrupts): declared.
(rb_thread_call_with_gvl): declared.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/ruby/test_io.rb: Test for File.write, File.binwrite.
* NEWS: News for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31902 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
DEFAULT_TEXTMODE in call of io_set_encoding(), and of write IO is
also set as it in call of io_new_instance() via rb_protect().
so, if DEFAULT_TEXTMODE is not 0, we should check the result of
extract_binmode() and avoid crush of default IO mode and the result.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31859 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
because boron chkbuild test result says, An old linux kernel ignore O_CLOEXEC
silently instead of return an error. It may lead to bring new security risk.
So, we have to be pending it until finish to implement proper fallback logic.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31643 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/ruby/test_io.rb (TestIO#test_o_cloexec): test for File::CLOEXEC.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* thread.c (select_single): select(2) based backend for rb_wait_for_single_fd().
* io.c (make_writeconv): use rb_wait_for_single_fd() instaed of
rb_thread_fd_select().
* io.c (rb_io_wait_readable): ditto.
* thread.c (rb_thread_wait_fd_rw): ditto.
* io.c (wait_readable): removed.
* thread.c (init_set_fd): new helper function.
* include/ruby/io.h (RB_WAITFD_IN, RB_WAITFD_PRI, RB_WAITFD_OUT):
new constant for rb_single_wait_fd().
The patch was written by Eric Wong. [Ruby 1.9 - Feature #4531]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31419 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
from copy_stream_body to rb_io_s_copy_stream. fds of passing
rb_fd_term() have to be guaranteed initialized.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
decorator according to open mode.
* transcode.c (rb_econv_prepare_options): new function, to prepare
econv options with newline flags.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
buffered, the buffers can be full or the file opened with
O_SYNC. IO#syswrite can also be used on blocking IOs
(pipe/socket) just like IO#write.
The patch is written by Eric Wong. [ruby-core:35554]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
close() may block for certain file types (NFS, SO_LINGER
sockets, inotify), so let other threads run. The patch was
created by Eric Wong [ruby-core:35555][Bug #4527]
* io.c (fptr_finalize): ditto.
* io.c (maygvl_fclose): new.
* io.c (nogvl_fclose): ditto.
* io.c (maygvl_close): ditto.
* io.c (nogvl_close): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31230 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
release GVL during calling kernel interface.
Suggested by Eric Wong. [ruby-core:35417][Bug #4463]
* test/ruby/test_io.rb (TestIO#test_fcntl_lock): add new test for
IO.fcntl().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
RSTRING_PTR() for function calls since it evaluates the argument
a couple of times.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
blocking region with GIL released, for fd.
* thread.c (rb_thread_fd_close): implement. [ruby-core:35203]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Therefore we should only check the result is -1 or not. [ruby-core:34062]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
also uses __syscall if available for *BSD on 64bit architecture.
[ruby-core:34062]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e