summaryrefslogtreecommitdiff
path: root/io.c
AgeCommit message (Collapse)Author
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
2012-06-27adjust style.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36232 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-27popen: shell commands with envvars and execoptsnobu
* io.c (is_popen_fork): check if fork and raise NotImplementedError if unavailable. * io.c (rb_io_s_popen): allow environment variables hash and exec options as flat parameters, not in an array arguments. [Feature#6651] [EXPERIMENTAL] * process.c (rb_execarg_extract_options): extract exec options, but no exceptions on non-exec options and returns them as a Hash. * process.c (rb_execarg_setenv): set environment variables. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36229 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-26Revert r36213 "popen: shell commands with envvar"nobu
* io.c (rb_io_s_popen): revert r36213 "popen: shell commands with envvar" because it disabled to let single command bypass shell. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-25popen: shell commands with envvarnobu
* io.c (is_popen_fork): check if fork and raise NotImplementedError if unavailable. * io.c (rb_io_s_popen): allow shell commands with modified environment variables. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-24io.c: spawnvnobu
* io.c (pipe_open): merge win32 code using spawnv(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36209 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-23* process.c: use the name "sargp" for struct rb_execarg variablesakr
consistently for saving process attributes. * io.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-22* process.c: use the name "eargp" for struct rb_execarg variablesakr
consistently except for saving process attributes. * io.c: ditto. * ext/pty/pty.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-21needless RB_GC_GUARD removed.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-21* process.c (rb_execarg_addopt): take a VALUE argument instead ofakr
struct rb_execarg. (rb_exec_arg_addopt): follow the rb_execarg_addopt change. (check_exec_options_i): ditto. * io.c (pipe_open): follow the rb_execarg_addopt change. * internal.h (rb_execarg_addopt): follow the definition change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36167 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-21remove unused variables.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-20* process.c (rb_execarg_fixup): take a VALUE argument instead ofakr
struct rb_execarg. * internal.h (rb_execarg_fixup): follow the definition change. * io.c (pipe_open): follow rb_execarg_fixup change. * ext/pty/pty.c (establishShell): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36157 b2dd03c8-39d4-4d8f-98ff-823fe69b080e