summaryrefslogtreecommitdiff
path: root/io.c
AgeCommit message (Collapse)Author
2016-11-05chomp optionnobu
* io.c (extract_getline_opts): extract chomp option. [Feature #12553] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-26[DOC] replace Fixnum with Integer [ci skip]nobu
* numeric.c: [DOC] update document for Integer class. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-21prefer rb_syserr_failnobu
* dir.c (dir_initialize, dir_read): prefer rb_syserr_fail over rb_sys_fail. * io.c (ruby_dup, rb_sysopen): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56464 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-13io.c: copy_stream to duplex IOnobu
* io.c (copy_stream_body): use IO to write to copy to duplex IO. http://twitter.com/knu/status/786505317974585344 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-11io.c: fix typonobu
* io.c (prep_io): fix typo of struct member name. [ruby-core:77550] [Bug #12829] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56393 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-10io.c: reduce isatty on Cygwin [ci skip]nobu
* io.c (prep_io): reduce isatty call (and its system call) on Cygwin. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56383 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-06io.c: use RB_INTEGER_TYPE_Pnobu
* io.c (fptr_finalize): use dedicated macro RB_INTEGER_TYPE_P. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56352 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-05* io.c: Fixed equivalent ruby code with core implemention.hsbt
[fix GH-1429][ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56344 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-08io.c: check if Integernobu
* io.c (rb_file_initialize): check if fd is an Integer but not a Fixnum. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56112 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-08replace fixnum by integer in documents.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-30* io.c (nogvl_fsync, nogvl_fdatasync): on Windows, just ignore if theusa
fd is associated to non-disk device. if call fsync and/or fdatasync with such fds, it causes Errno::EBADF exception and the behavior is incomatible with ruby 2.1 and earlier unintendedly introduced. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56036 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-29rb_funcallvnobu
* *.c: rename rb_funcall2 to rb_funcallv, except for extensions which are/will be/may be gems. [Fix GH-1406] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55773 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-07* io.c (rb_io_s_read): add description of pipes to the documentationshugo
of IO.read. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55610 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-07io.c: convert arguments just oncenobu
* io.c (rb_io_s_foreach, rb_io_s_readlines): convert arguments just once before reading, instead of conversions for each lines. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-28* addr2line.c: drop to support ATARI ST platform. It was discontinuedhsbt
more than two decades ago. [fix GH-1350] Patch by @cremno * include/ruby/ruby.h: ditto. * io.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-21Restore documentation of ARGFnobu
* io.c (Init_IO): [DOC] define dummy ARGF instead of ARGF.class to re-enable the generation of ARGF documentation. [Fix GH-1358] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-20fix build on no-fork-spawnv platformsnobu
* process.c (rb_execarg_commandline): build command line string from argument vector in rb_execarg. [ruby-core:75611] [Bug #12398] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55091 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-20io.c: conditionally used functionsnobu
* io.c (pipe_atexit): only used on Windows * io.c (rb_execarg_fixup_v): wrapper only used fork or spawnv is available. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55090 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-15io.c: use PRI_OFFT_PREFIX for off_tnobu
* io.c (do_io_advise): use configured PRI_OFFT_PREFIX instead of PRI_OFF_T_PREFIX to format off_t properly on Cygwin. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55009 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-07io.c: remove extra declarationsnobu
* io.c (rb_io_set_encoding): remove extra declarations, rb_std{in,out,err} are defined in this file. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54012 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-06io.c: fix output of Array [ci skip]nobu
* io.c (rb_obj_display): [DOC] fix output of Array, as Array#to_s is same as Array#inspect since 1.9. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54009 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-24parse without $.nobu
* io.c (rb_io_gets_internal): read one line from an IO without setting ARGF.lineno. * parse.y (lex_io_gets): use rb_io_gets_internal not to affect $. global variable. * ruby.c (load_file): no longer reset $. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-31io.c: rb_io_open_genericnobu
* io.c (rb_io_open_generic): split from rb_io_open without argument conversions. * io.c (rb_io_s_binread): get rid of unnecessary object creation and conversion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53698 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-31io.c: constifynobu
* io.c (rb_file_open_generic, pipe_open, pipe_open_s): constify convconfig parameter. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53696 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-19io.c: suppress warningnobu
* io.c (rb_update_max_fd): get rid of unused-value warning. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-10io.c: remove obsolete rb_deferr global variablenormal
This was made obsolete by r4190 back in July 2003. Furthermore, this existed less than 3 months as it was only introduced in r3782. So with absolutely no references to rb_deferr, I doubt any vim plugin would care anymore. ChangeLog: fixup indent of my previous commit, oops :X git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-27IO#readpartial rejects bad argsnormal
Sometimes a sleepy developer will want to swap read_nonblock for readpartial forget to remove "exception: false" * io.c (io_getpartial): remove unused kwarg from template * test/ruby/test_io.rb (test_readpartial_bad_args): new [Bug #11885] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-23rb_readwrite_syserr_failnobu
* io.c (rb_readwrite_syserr_fail): works with the given errno than thread local errno. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53265 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-23prefer rb_syserr_failnobu
* file.c, io.c, util.c: prefer rb_syserr_fail with saved errno over setting errno then call rb_sys_fail, not to be clobbered potentially and to reduce thread local errno accesses. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53264 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-14* enum.c: fix a typo in documentation.hsbt
[ci skip][fix GH-1140] Patch by @jutaz * io.c: ditto. * iseq.c: ditto. * numeric.c: ditto. * process.c: ditto. * string.c: ditto. * vm_trace.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53105 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-14* compile.c: fix typos.hsbt
[ci skip][fix GH-1140] Patch by @jutaz * dir.c: ditto. * gc.c: ditto. * io.c: ditto. * node.h: ditto. * thread_pthread.c: ditto. * vm_insnhelper.c: ditto. * vsnprintf.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-13io.c: encoding in warningsnobu
* io.c (parse_mode_enc): preserve encoding of mode string in warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-13io.c: BOM with non-UTFnobu
* io.c (io_encname_bom_p): check BOM prefix only, not including UTF prefix. * io.c (parse_mode_enc): warn BOM with non-UTF encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53084 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-13io.c: fix stack smashingnobu
* io.c (parse_mode_enc): fix buffer overflow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-11IO#advise should not raise Errno::ENOSYSnormal
As it is just a hint the kernel is free to ignore, IO#advise already succeeds when posix_fadvise is not available build time at all. Following that, if posix_fadvise was available at build time but not implemented in the running kernel, we should also ignore it. * io.c (do_io_advise): do not raise on ENOSYS * test/ruby/test_io.rb (test_advise): do not skip on Errno::ENOSYS (test_advise_pipe): ditto [ruby-core:72066] [Feature #11806] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-09dir.c, io.c: use rb_id_encodingnobu
* dir.c (dir_initialize): rb_id_encoding() returns same ID with caching. * io.c (Init_IO): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53012 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-09* *.c (*_memsize): do not check ptr.ko1
NULL checking is finished Before call of memsize functions. See r52979. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-25io.c: try to_io firstnobu
* io.c (copy_stream_body): try to_io conversion before read, readpartial, and write methods. [ruby-dev:49008] [Bug #11199] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-25* io.c (argf_getpartial): should not resize str if the secondshugo
argument is not given. [ruby-core:71668] [Bug #11738] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52745 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-24Drop support for BeOSnobu
* beos: Drop support for BeOS now that Haiku is stable. [Fix GH-1112] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52731 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-23use rb_gc_for_fd for more callersnormal
* dir.c (dir_initialize): use rb_gc_for_fd for ENOMEM * ext/socket/init.c (rsock_socket): ditto * ext/socket/socket.c (rsock_socketpair): ditto * internal.h (rb_gc_for_fd): prototype * io.c (rb_gc_for_fd): remove static [ruby-core:71623] [Feature #11727] Manpages for opendir(2), socket(2), and socketpair(3posix) describe ENOMEM as a possible error for each of these; handle it consistently with our existing wrappers for open(2)/pipe(2) etc... git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52726 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-23io.c (rb_gc_for_fd): wrapper for retrying FD creationnormal
This simplifies callers and makes error handling more consistent between our pipe, open, fdopen, and dup wrappers. This adds missing ENOMEM handling as documented in the open(2), pipe(2freebsd), and fdopen(3posix) manpages on my system. We also avoid repeatedly accessing `errno` which is implemented in TLS on GNU/Linux systems and more expensive to read than a local variable. We may export this in internal.h for ext/socket/* and dir.c, too. * io.c (rb_gc_for_fd): new helper function (ruby_dup): use rb_gc_for_fd (rb_sysopen): ditto (rb_fdopen): ditto (rb_pipe): ditto [ruby-core:71623] [Feature #11727] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-23Haiku now best effort supportnobu
* configure.in: remove obsolete workarounds for Haiku. * dln.c, file.c, io.c: remove obsolete Haiku workarounds. * thread_pthread.c: add stack bounds detection for Haiku. * signal.c: get stack pointer from signal context on Haiku. [ruby-core:67923] [Bug #10811] [Fix GH-1109] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-12io.c: avoid kwarg parsing in C APInormal
* benchmark/bm_io_nonblock_noex2.rb: new benchmark based on bm_io_nonblock_noex.rb * io.c (io_read_nonblock): move documentation to prelude.rb (io_write_nonblock): ditto (Init_io): private, internal methods for prelude.rb use only * prelude.rb (IO#read_nonblock): wrapper + documentation (IO#write_nonblock): ditto [ruby-core:71439] [Feature #11339] rb_scan_args and hash lookups for kwargs in the C API are clumsy and slow. Instead of improving the C API for performance, use Ruby instead :) Implement IO#read_nonblock and IO#write_nonblock in prelude.rb to avoid argument parsing via rb_scan_args and hash lookups. This speeds up IO#write_nonblock and IO#read_nonblock benchmarks in both cases, including the original non-idiomatic case where the `exception: false' hash is pre-allocated to avoid GC pressure. Now, writing the kwargs in natural, idiomatic Ruby is fastest. I've added the noex2 benchmark to show this. 2015-11-12 01:41:12 +0000 target 0: a (ruby 2.3.0dev (2015-11-11 trunk 52540) [x86_64-linux]) target 1: b (ruby 2.3.0dev (2015-11-11 avoid-kwarg-capi 52540) ----------------------------------------------------------- benchmark results: minimum results in each 10 measurements. Execution time (sec) name a b io_nonblock_noex 2.508 2.382 io_nonblock_noex2 2.950 1.882 Speedup ratio: compare with the result of `a' (greater is better) name b io_nonblock_noex 1.053 io_nonblock_noex2 1.567 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52541 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-08io.c: [DOC] IO#gets [skip ci]nobu
* io.c (rb_io_gets_m): [DOC] add example using limit argument. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52489 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-08io.c: [DOC] IO#gets [skip ci]nobu
* io.c (rb_io_gets_m): [DOC] fix class name and reword as "multibyte". [Fix GH-1085] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-08io.c: [DOC] IO#gets [skip ci]nobu
* io.c (rb_io_gets_m): Update IO#gets doc for characters more than 1 byte. [Fix GH-1085] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-25io.c: fix typo [ci skip]nobu
* io.c (io_readpartial): fix typo, "later" to "latter". [ruby-core:71181] [Bug #11619] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52279 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-22io.c: check ARGV element typenobu
* io.c (argf_next_argv): check ARGV element type, and try conversion if necessary. [ruby-core:71140] [Bug #11610] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52211 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-18fix compile errorkosaki
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e