aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
Commit message (Collapse)AuthorAgeFilesLines
* * io.c: use select() appropriately for sendfile().akr2011-06-121-17/+12
| | | | | | | | | | | 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
* * io.c (io_getc): should be 7bit if ascii. fixes #4557nobu2011-06-111-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32000 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c: fix IO.copy_stream interrupt handling.akr2011-06-091-22/+82
| | | | | | | | | | | | | | | | 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
* * io.c (io_fflush): windows -- call fsync() only when the FD is tied tousa2011-06-031-1/+5
| | | | | | | file, because if the FD is pipe, it blocks. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_s_write, rb_io_s_binwrite): return!!!usa2011-06-021-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c: Add File.write, File.binwrite. [Feature #1081] [ruby-core:21701]sorah2011-06-021-0/+126
| | | | | | | | * 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
* * io.c (io_flush, rb_io_flush): need to fsync() when ruby calls internalusa2011-06-021-3/+3
| | | | | | | flush. [ruby-core:36670] [Bug #4813] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31901 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* doco: p outputs newline regardless of record separatorryan2011-06-011-3/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31883 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (io_encoding_set): should honor already set ecflags since itnobu2011-05-311-5/+3
| | | | | | might be set by mode option. fixed #4804 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* no space inside parensnobu2011-05-311-8/+8
| | | | | | * io.c: remove spaces before closing parens. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_s_pipe): potential bug. the mode of read IO is set asusa2011-05-311-0/+8
| | | | | | | | | | 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
* * io.c (fill_cbuf): return MORE_CHAR_SUSPENDED when cbuf is not empty.naruse2011-05-271-0/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (fill_cbuf): Fix test-all crash.kosaki2011-05-271-1/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (validate_enc_binmode): do not clear textmode flag ifnobu2011-05-271-0/+2
| | | | | | default. fixed #4732 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (fill_cbuf): finish reading at EOF.nobu2011-05-271-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_extract_modeenc): accept combination hash andkosaki2011-05-211-1/+1
| | | | | | | | | | File::Constants. (eg. File.open('yo', :mode => File::WRONLY)) [Feature #4742][ruby-core:36338] * test/ruby/test_io.rb (TestIO#test_open_mode): new test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* revert O_CLOEXEC patch series completely.kosaki2011-05-191-4/+0
| | | | | | | | | | 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
* * remove trailing spaces.nobu2011-05-151-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (select_internal): remove unused variable (interrupt_flag).kosaki2011-05-121-35/+32
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (Init_IO): Added File::CLOEXEC constant. [ruby-core:22893] [Feature ↵kosaki2011-05-041-0/+4
| | | | | | | | | | #1291] * 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
* * io.c (rb_f_select): remove useless ifdef.kosaki2011-05-041-8/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_wait_for_single_fd): new.kosaki2011-05-041-40/+2
| | | | | | | | | | | | | | | | | | | | * 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
* * include/ruby/intern.h (rb_thread_select): mark as deprecated.kosaki2011-04-301-4/+4
| | | | | | | | | | | | | * ext/io/wait/wait.c (wait_readable): use rb_thread_fd_select instead of rb_thread_select. * ext/socket/init.c (wait_connectable0): ditto. * ext/readline/readline.c (readline_event): ditto. * io.c (rb_io_wait_readable, wait_readable, rb_io_wait_writable, wait_writable): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31394 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (copy_stream_body, rb_io_s_copy_stream): move rb_fd_init()kosaki2011-04-301-1/+1
| | | | | | | | | 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
* * io.c (make_writeconv): do not add textmode newline decorator if anynobu2011-04-291-1/+2
| | | | | | newline decorator is set already. fixes #4618, fixes #4619 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_extract_modeenc, rb_f_backquote): set default textnobu2011-04-271-2/+5
| | | | | | | mode. fixes #4619 * io.c (pipe_open): set universal newline decorator if needed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31367 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (validate_enc_binmode, rb_io_extract_modeenc): set newlinenobu2011-04-261-13/+29
| | | | | | | | 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
* * io.c (rb_f_syscall): reduce warning: "HAVE___SYSCALL" is not defined.kazu2011-04-141-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31272 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_fdatasync): remove unused variable.kazu2011-04-131-1/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c: revert r31230.kosaki2011-04-111-43/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_syswrite): While local FS writes are usuallykosaki2011-04-041-1/+1
| | | | | | | | | | | 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
* * configure.in: disable fdatasync again on Mac OS X.kosaki2011-04-031-2/+3
| | | | | | | | [ruby-core:35493][Bug #4500] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31232 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (io_reopen): IO#close releases GVL if possible.kosaki2011-04-031-4/+43
| | | | | | | | | | | | | | | | | 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
* * io.c (io_cntl): use rb_thread_io_blocking_region() insteadkosaki2011-03-051-1/+1
| | | | | | | | rb_thread_blocking_region(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (io_cntl, nogvl_io_cntl): IO.fcntl() and IO.ioctl()kosaki2011-03-041-13/+32
| | | | | | | | | | | | 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
* * io.c (io_cntl): change 'cmd' type to int. ioctl and fcntl need tokosaki2011-03-041-3/+3
| | | | | | | | | be passed int. * io.c (rb_io_ctl): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * prevent temporary objects from GC, and should not usenobu2011-02-201-2/+3
| | | | | | | 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
* * thread.c (rb_thread_io_blocking_region): new function to runnobu2011-02-121-4/+5
| | | | | | | 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
* * io.c (rb_io_s_sysopen): use NUM2MODET() instead NUM2UINT().kosaki2011-02-081-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_fdatasync): Use fsync(2) if if the underlyingkosaki2011-02-021-4/+8
| | | | | | | | operating system does not support fdatasync(2). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30762 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c (struct argf): char behaves like an unsigned char by default on AIX.kanemoto2011-01-301-1/+1
| | | | | | | http://publib.boulder.ibm.com/infocenter/comphelp/v111v131/index.jsp?topic=/com.ibm.xlcpp111.aix.doc/language_ref/ch.html git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30726 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_open): Use NUM2MODET() instead NUM2UINT().kosaki2011-01-281-2/+2
| | | | | | | | * io.c (rb_scan_open_args): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (argf_next_argv): go advance when the next file cannot benobu2011-01-131-1/+1
| | | | | | read. [ruby-core:34446] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_f_syscall): Add warning messages. [ruby-core:34062]kosaki2011-01-121-0/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_f_syscall): Some syscall return unsigned or pointer value.kosaki2011-01-121-1/+2
| | | | | | | | 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
* * io.c (rb_f_syscall): Add 64bit Linux support. Some syscall takeskosaki2011-01-121-0/+12
| | | | | | | | long type arguments. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (Kernel.#syscall): implemented on LP64/LLP64 environments too.yugui2011-01-091-48/+72
| | | | | | | 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
* fix spaces.akr2011-01-081-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (maygvl_copy_stream_wait_readwrite): define if USE_SENDFILEnobu2010-12-291-16/+16
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix a typokazu2010-12-271-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30410 b2dd03c8-39d4-4d8f-98ff-823fe69b080e