summaryrefslogtreecommitdiff
path: root/io.c
AgeCommit message (Collapse)Author
2013-02-13io.c: FOREACH_ARGFnobu
* io.c (FOREACH_ARGF): loop for ARGF. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-13io.c: simplifynobu
* io.c (rb_io_getline_fast, rb_io_each_{byte,codepoint}): simplify loops. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39219 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-10add doc. for IO#close_on_exec=.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39184 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-15io.c: no envp if no spawnvenobu
* io.c (pipe_open): envp is not used if only spawnv is defined right now. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-06* bootstraptest/test_io.c: add a test for [ruby-dev:46834].yugui
* io.c (rb_cloexec_fcntl_dupfd) Use an emulation with dup(2) when fcntl(2) and/or F_DUPFD is unavailable. Suggested by akr. * configure.in (HAVE_FCNTL): NativeClient does not provide fcntl(2). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-04* io.c (rb_cloexec_fcntl_dupfd): improve #ifdef condition.kosaki
* io.c (rb_maygvl_fd_fix_cloexec): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-03* io.c (rb_cloexec_fcntl_dupfd): Fix failures inyugui
bootstrap_test/test_io.rb. NativeClient does not support F_DUPFD but supports dup2(2). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-29adjust stylenobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-25error.c: rb_write_error_strnobu
* error.c (compile_err_append, compile_warn_print, warn_print): use rb_write_error_str() instead of writing to rb_stderr directly. * io.c (rb_write_error_str): a stopgap measure not to unblock GVL. warning from require seems to still have race condition errors. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-22Deprecate #{lines,bytes,chars,codepoints} of IO-likes.knu
* io.c (rb_io_lines, rb_io_bytes, rb_io_chars, rb_io_codepoints): Deprecate IO#{lines,bytes,chars,codepoints} and those of ARGF. [Feature #6670] * ext/stringio/stringio.c (strio_lines, strio_bytes, strio_chars) (strio_codepoints): Deprecate StringIO#{lines,bytes,chars,codepoints}. [Feature #6670] * ext/zlib/zlib.c (rb_gzreader_lines, rb_gzreader_bytes): Deprecate Zlib::GzipReader#{lines,bytes}. [Feature #6670] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-22* io.c (rb_io_wait_writable): use rb_thread_check_ints() insteadkosaki
of rb_thread_fd_writable(). * io.c (rb_io_wait_readable): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38555 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-18* io.c (rb_io_wait_writable): don't use rb_thread_wait_fd()kosaki
because it is for waiting until io readable. * io.c (rb_io_wait_writable): always use rb_thread_fd_writable() instaed of bare rb_wait_for_single_fd(). we shouldn't ignore return value. * io.c (rb_io_wait_readable): ditto. always use rb_thread_wait_fd(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-17* io.c (io_flush_buffer_sync2): avoid to return 0. becausekosaki
rb_thread_call_without_gvl2 uses 0 internally. * io.c (io_flush_buffer_async2): adapt the above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38422 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-15* io.c (finish_writeconv): uses rb_write_internal2 ifkosaki
fptr->write_lock have. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38401 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-15* thread.c (rb_mutex_owned_p): remove static.kosaki
* io.c (io_flush_buffer): don't hold mutex if already have. Now recursive lock may occur when following scenario. fptr_finalize -> finish_writeconv_sync -> finish_writeconv -> io_fflush. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38400 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-15* io.c (io_flush_buffer): uses io_flush_buffer_async2 instead ofkosaki
io_flush_buffer_async. * io.c (io_flush_buffer_async2): new helper function for io_flush_buffer. It uses rb_thread_call_without_gvl2() instead of rb_thread_io_blocking_region. * io.c (io_flush_buffer_sync2): new helper function for io_flush_buffer_async2. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-15* io.c (internal_write_func2): new helper function for rb_write_internal2().kosaki
* io.c (rb_write_internal2): new function. it uses rb_thread_call_without_gvl2() instaed of rb_thread_io_blocking_region(). * io.c (rb_binwrite_string): uses rb_write_internal2 instead of rb_write_internal. [Bug #7134] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-15* io.c (rb_io_wait_writable): add to call rb_thread_wait_fd()kosaki
likes rb_io_wait_readable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-15* io.c (rb_io_wait_writable): don't call rb_thread_fd_writable()kosaki
when EINTR. EINTR mean signal interrupt was happen. We don't need any wait. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-05* thread.c (rb_uninterruptible): helper function for providingkosaki
temporary async_interrupt_timing(Object => :defer) * io.c (rb_f_p): use rb_uninterruptible. * io.c (rb_f_p_internal): helper function for rb_f_p(). * io.c (struct rb_f_p_arg): new struct for rb_f_p_internal. * test/ruby/test_thread.rb (test_async_interrupt_and_p): test for the above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-05* io.c (io_binwrite): check interrupt before io issue.kosaki
* test/ruby/test_thread.rb (test_async_interrupt_and_io): test for the above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-02* array.c, enum.c, insns.def, io.c, numeric.c, parse.y, process.c,ko1
range.c: use prepared IDs. A patch from charliesome (Charlie Somerville). [Bug #7495] * common.mk: add dependency to id.h. * common.mk: replace ID_H_INCLUDES with id.h. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-01io.c: recurse for the argumentnobu
* io.c (rb_io_puts): recurse for the argument itself, not converted array elements. [ruby-core:42444] [Bug #5986] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38120 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-28* thread.c (struct rb_mutex_struct): add allow_trap field.kosaki
* internal.h (rb_mutex_allow_trap): added. * thread.c (rb_mutex_lock, rb_mutex_unlock): check mutex->allow_trap. * thread.c (mutex_sleep): remove trap check because it uses rb_mutex_lock and rb_mutex_unlock internally. * thread.c (rb_mutex_allow_trap): new helper function for the above. * io.c (io_binwrite): mark fptr->write_lock as writable in trap. * test/ruby/test_signal.rb (test_trap_puts): test for the above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-28* io.c (FMODE_SYNCWRITE): removed unused macro.kosaki
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-26* io.c (argf_each_codepoint): add missing ARGF#codepoints [Bug #7438]naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-20* io.c (Init_IO): removed all rb_file_const() into file.c.kosaki
* file.c (Init_File): replace with rb_file_const() with rb_define_const() because RDoc don't care rb_file_const. [Bug #5530] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-09* io.c (IO#new):zzak
Fix indentation from r37444 [ruby-core:48052] [Bug #7179] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-03* io.c (IO#new):zzak
Documentation for IO#open modes and formatting [ruby-core#48052] [Bug #7179] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37443 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-30* process.c (redirect_dup2): set standard handles when new fd is stdio,usa
because if there is no allocated console at the moment Windows does not automatically associate it for child process's standard handle. this is adhoc workaround. reported by Martin Thiede at [ruby-core:48542] [Bug #7239]. * io.c (rb_cloexec_dup2): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37388 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-20* include/ruby/ruby.h: add C APIs.nari
VALUE rb_newobj_of(VALUE klass, VALUE flags) #define NEWOBJ_OF(obj,type,klass,flags) These allow to change a allocation strategy depending on klass or flags. * gc.c: ditto * array.c: use new C API. * bignum.c: ditto * class.c: ditto * complex.c: ditto * ext/socket/ancdata.c: ditto * ext/socket/option.c: ditto * hash.c: ditto * io.c: ditto * marshal.c: ditto * numeric.c: ditto * object.c: ditto * random.c: ditto * range.c: ditto * rational.c: ditto * re.c: ditto * string.c: ditto * struct.c: ditto [Feature #7177][Feature #7047] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-03io.c: improved IO#reopennobu
* io.c (rb_io_reopen): improvement to accept optional arguments. a patch by Glass_saga (Masaki Matsushita) in [ruby-core:47806]. [Feature #7103] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-28io.c: IO#reopen int modenobu
* io.c (rb_io_reopen): accept File::Constants as well as mode string. based on the patch by Glass_saga (Masaki Matsushita) in [ruby-core:47694]. [Feature #7067] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37041 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-16io.c: io_set_read_lengthnobu
* io.c (io_set_read_length): if the read length equals to the buffer string size then nothing to do. or ensure the string modifiable before setting the length only when the former is shorter. based on the patch in [ruby-core:47541] by Hiroshi Shirosaki. [ruby-core:46586] [Bug #6764] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-09* ext/socket/basicsocket.c (rsock_bsock_send):kosaki
avoid unnecessary select() calls before doing I/O Patch by Eric Wong. [Feature #4538] [ruby-core:35586] * ext/socket/init.c (rsock_s_recvfrom): ditto. * ext/socket/init.c (rsock_s_accept): ditto. * ext/socket/udpsocket.c (udp_send): ditto. * io.c (io_fflush): ditto. * io.c (io_binwrite): ditto. * io.c (rb_io_syswrite): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-09* io.c (nogvl_close, maygvl_close, nogvl_fclose, maygvl_fclose):kosaki
suppress integer <-> pointer cast warnings. [Feature #4570] [ruby-core:35711] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-09* io.c (rb_io_close): notify fd close before releasing gvl.kosaki
* io.c (fptr_finalize): modify fptr->mode before releasing gvl. remove unnecessary rb_thread_fd_close(). [Feature #4570] [ruby-core:35711] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36942 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-09* io.c (nogvl_close, maygvl_close, nogvl_fclose, maygvl_fclose):kosaki
new functions. * io.c (fptr_finalize): release GVL if possible. Patched by Eric Wong. [Feature #4570] [ruby-core:35711] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36932 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-09* io.c (io_bufread): removed unnecessary rb_thread_wait_fd().kosaki
Patch by Eric Wong. [Bug #6629] [ruby-core:45789] * io.c (rb_io_sysread): ditto. * io.c (copy_stream_fallback_body): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-01* io.c: fix typo in io/console example.eregon
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36875 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-30* io.c (rb_io_close): call rb_last_status_clear.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36856 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-29* internal.h (rb_last_status_clear): declared.akr
* process.c (rb_last_status_clear): exported. (rb_f_system): call rb_last_status_clear. * io.c (rb_f_backquote): call rb_last_status_clear. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-15Kernel#inspect: improve consistency and do not call #to_s.eregon
* object.c (rb_obj_inspect): Kernel#inspect: do not call #to_s. A class can now benefit from the nice default #inspect even if it defines #to_s. Also, there is no more unexpected change in #inspect result. * NEWS: Add note about the change. * bignum.c, io.c, numeric.c, object.c, proc.c, vm.c (Init_*): Adapt internal structures (by aliasing #inspect to #to_s) so they don't rely on the removed behavior (#inspect calling overridden #to_s). * test/ruby/test_object.rb (test_inspect): add tests for Kernel#inspect. * lib/pp.rb (class PP): do not call #to_s anymore, as #inspect no more does (mame). * test/test_pp.rb (class PPInspectTest): remove related assertion (mame). [ruby-core:43238][Feature #6130] * test/drb/drbtest.rb (DRbCore#teardown, DRbAry#teardown): adapt DRb tests with the new change (shirosaki). [ruby-core:47182][Bug #6866] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-15Revert r36699 and r36700. [Feature #6130]naruse
Revert "Kernel#inspect: improve consistency and do not call #to_s." Revert "update PP with recent Kernel#inspect change. Patch by Yusuke Endoh." r36699 cause test-all failure on test/drb/test_drb.rb and test/drb/test_drbssl.rb. Run test-all before commit. Moreover its ChangeLog formst is wrong: see CommitterHowto https://bugs.ruby-lang.org/projects/ruby/wiki/CommitterHowto#ChangeLog git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-14Kernel#inspect: improve consistency and do not call #to_s.eregon
A class can now benefit from the nice default #inspect even if it defines #to_s. Also, there is no more unexpected change in #inspect result. Internal structures have been adapted so they don't rely on the removed behavior (#inspect calling overridden #to_s). * object.c (rb_obj_inspect): Kernel#inspect: do not call #to_s. * test/ruby/test_object.rb (test_inspect): add tests for Kernel#inspect. * bignum.c, io.c, numeric.c, object.c, proc.c, vm.c (Init_*): alias #inspect to #to_s where it was expected. [ruby-core:43238][Feature #6130] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-05io.c: suppress unused variable warningsnobu
* io.c (pipe_open): suppress warnings agains variable which are used when spawnv is available but fork is not. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36632 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-27process.c: try conversion at redirectionnobu
* io.c (rb_io_check_io): make public. * process.c (check_exec_redirect): try conversion to IO on redirect parameters. [ruby-core:44181] [Bug #6269] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-11get rid of warningsnobu
* io.c (sysopen_func, rb_sysopen_internal): cast through VALUE to get rid of warnings. fixup of r36355. * process.c (rb_waitpid_blocking, rb_waitpid): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36361 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-10rb_thread_call_without_gvlnobu
* include/ruby/thread.h: new header file for thread stuff. * thread.c (rb_thread_call_without_gvl): export. [Feature#4328] returns void* instead of VALUE. [Feature #5543] * thread.c (rb_thread_blocking_region): deprecate. [ruby-core:46295] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-09* dln.c: Simplify and make consistent an ifdef for Mac OS X.kosaki
* ext/socket/rubysocket.h: ditto. * ext/tk/stubs.c: ditto. * io.c: ditto. * process.c: ditto. * signal.c: ditto. * vm_dump.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e