summaryrefslogtreecommitdiff
path: root/io.c
AgeCommit message (Collapse)Author
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
2012-06-20* internal.h (struct rb_execarg) moved and renamed fromakr
struct rb_exec_arg in intern.h. * include/ruby/intern.h (struct rb_exec_arg): refer Data object which contains struct rb_execarg. * process.c: use struct rb_execarg instead of struct rb_exec_arg except functions declared in intern.h. (rb_exec_arg_addopt): extract a pointer to struct rb_execarg from struct rb_exec_arg. (rb_exec_arg_init): ditto. (rb_exec_arg_fixup): ditto. (rb_run_exec_options_err): ditto. (rb_run_exec_options): ditto. (rb_exec_err): ditto. (rb_exec): ditto. * io.c: use struct rb_execarg instead of struct rb_exec_arg. * ext/pty/pty.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-20* internal.h (rb_execarg_new): declared.akr
(rb_execarg_get): ditto. * process.c (mark_exec_arg): new function. (free_exec_arg): ditto. (memsize_exec_arg): ditto. (exec_arg_data_type): defined. (rb_execarg_new): new function. (rb_execarg_get): ditto. (rb_f_exec): use rb_execarg_new. (rb_spawn_internal): ditto. (rb_f_spawn): ditto. * io.c (pipe_open_v): use rb_execarg_new. (pipe_open_s): ditto. * ext/pty/pty.c (establishShell): use rb_execarg_new. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-12* include/ruby/intern.h (rb_exec_arg_init): deprecated.akr
(rb_exec_arg_addopt): ditto. (rb_exec_arg_fixup): ditto. (rb_run_exec_options): ditto. (rb_run_exec_options_err): ditto. * internal.h (rb_execarg_init): declared. (rb_execarg_addopt): ditto. (rb_execarg_fixup): ditto. (rb_execarg_run_options): ditto. * process.c: call rb_execarg_addopt, rb_execarg_fixup, rb_execarg_run_options, rb_execarg_init. (rb_execarg_addopt): renamed from rb_exec_arg_addopt. (rb_exec_arg_addopt): stub to call rb_execarg_addopt. (rb_execarg_init): renamed from rb_exec_arg_init. (rb_exec_arg_init): stub to call rb_execarg_init. (rb_execarg_fixup): renamed from rb_exec_arg_fixup. (rb_exec_arg_fixup): stub to call rb_execarg_fixup. (rb_execarg_run_options): renamed from rb_run_exec_options_err. (rb_run_exec_options_err): stub to call rb_execarg_run_options. (rb_run_exec_options): call rb_execarg_run_options. * io.c: call rb_execarg_addopt, rb_execarg_fixup, rb_execarg_run_options, rb_execarg_init. * ext/pty/pty.c (establishShell): call rb_execarg_init and rb_execarg_fixup. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36039 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-10* process.c (rb_fork_ruby): new function.akr
(rb_f_fork): use rb_fork_ruby instead of rb_fork. (rb_daemon): ditto. * io.c (pipe_open): use rb_fork_ruby instead of rb_fork. * internal.h (rb_fork_ruby): declared. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-10* io.c (popen_exec): don't call rb_thread_atfork_before_exec. useakr
rb_exec_async_signal_safe instead of rb_exec_err. (pipe_open): use rb_fork_async_signal_safe instead of rb_fork_err. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-08* process.c: don't check the availability of FD_CLOEXEC. It shouldakr
be available if fork() is available. * io.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05* internal.h (rb_exec_arg_init): change return type to void.akr
* process.c (rb_exec_arg_init): don't return a value. (rb_exec_arg_prepare): ditto. (rb_spawn_process): don't take the prog argument. extract the information from earg. (rb_spawn_internal): follow rb_spawn_process change. (rb_f_spawn): ditto. * io.c (pipe_open): don't take the prog argument. extract the information from eargp. (pipe_open_v): follow pipe_open change. (pipe_open_s): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35928 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05* internal.h (rb_exec_arg): use union to represent command invocationakr
with/without shell. * process.c: follow the rb_exec_arg change. * io.c (pipe_open): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05obj_init_copynobu
* object.c (rb_obj_init_copy): should check if trusted too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05* process.c: add comments about async-signal-safe.akr
* io.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05* io.c: Edited documentation for IO and File open and new anddrbrain
Kernel#open for consistency and clarity. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-04* internal.h (ARGVSTR2ARGC): defined.akr
(ARGVSTR2ARGV): defined. * process.c (proc_exec_v): use ARGVSTR2ARGV. (rb_spawn_process): use ARGVSTR2ARGC and ARGVSTR2ARGV. * io.c (pipe_open): use ARGVSTR2ARGV. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-04unused variablesnobu
* io.c (pipe_open): argc and argv are not used on win32. * process.c (rb_spawn_process): remove already useless variables. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-04* io.c (pipe_open): follow up changes in r35889.usa
* process.c (proc_spawn_n): now uses char ** instead of VALUE *. * process.c (rb_spawn_process): prog is now VALUE of String, not char *. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e