Граф коммитов

1468 Коммитов

Автор SHA1 Сообщение Дата
hsbt 52cd994814 * enum.c: fix a typo in documentation.
[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 02:52:14 +00:00
hsbt 6851be0f0c * compile.c: fix typos.
[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-14 02:51:13 +00:00
nobu add73a8713 io.c: encoding in warnings
* 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-13 09:49:25 +00:00
nobu b861d5473c io.c: BOM with non-UTF
* 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-13 09:48:27 +00:00
nobu ce6f0e36a3 io.c: fix stack smashing
* 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-13 09:45:12 +00:00
normal fae144419c IO#advise should not raise Errno::ENOSYS
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-11 22:49:27 +00:00
nobu dec78a7a73 dir.c, io.c: use rb_id_encoding
* 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 18:15:04 +00:00
ko1 2f5b8f0529 * *.c (*_memsize): do not check ptr.
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-12-09 00:38:32 +00:00
nobu 7d92e5cf73 io.c: try to_io first
* 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 12:23:42 +00:00
shugo 94da8b1737 * io.c (argf_getpartial): should not resize str if the second
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-25 01:57:48 +00:00
nobu 13a935b0ba Drop support for BeOS
* 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-24 00:17:11 +00:00
normal 61e5fe0674 use rb_gc_for_fd for more callers
* 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-23 22:50:53 +00:00
normal a936bd5c63 io.c (rb_gc_for_fd): wrapper for retrying FD creation
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-23 21:57:24 +00:00
nobu e29c109d2a Haiku now best effort support
* 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-23 03:54:42 +00:00
normal cee7f6911b io.c: avoid kwarg parsing in C API
* 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-12 02:00:41 +00:00
nobu eb28bd8057 io.c: [DOC] IO#gets [skip ci]
* 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-08 05:08:03 +00:00
nobu 86eda6244d io.c: [DOC] IO#gets [skip ci]
* 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-08 02:08:57 +00:00
nobu 965e9df380 io.c: [DOC] IO#gets [skip ci]
* 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-11-08 01:55:14 +00:00
nobu 67c4c4a069 io.c: fix typo [ci skip]
* 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-25 14:34:08 +00:00
nobu 66e41cbe4f io.c: check ARGV element type
* 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-22 04:13:52 +00:00
kosaki 395dd7867e fix compile error
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-18 01:43:53 +00:00
kosaki 4ad2057f27 * ChangeLog: Good-bye OS/2.
* common.mk: ditto.
* configure.in: ditto.
* dln_find.c: ditto.
* ext/Setup.emx: ditto.
* ext/extmk.rb: ditto.
* ext/socket/extconf.rb: ditto.
* ext/zlib/extconf.rb: ditto.
* file.c: ditto.
* include/ruby/defines.h: ditto.
* io.c: ditto.
* lib/mkmf.rb: ditto.
* missing/os2.c: ditto.
* process.c: ditto.
* ruby.c: ditto.
* NEWS: announce OS/2 is no longer supported.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-18 01:18:34 +00:00
kosaki a0a77c5b33 re-commit r52152
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52159 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-18 00:40:57 +00:00
kosaki ff132bc0f4 Revert r52154
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-18 00:13:52 +00:00
kosaki 50024f9da6 * io.c (fptr_finalize): don't release gvl if fptr is not writable.
writable fd may block on close(2) when it's on NFS. But readonly
  fd doesn't. [Bug #11559]
  result: make benchmark OPTS="-p bm_require_t -e ruby-trunk -e ruby-2.2.2"
    build-ruby:             0.171
    ruby 2.3.0dev(r52151):  0.659
    ruby 2.2.0p95 (r50295): 0.834

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-17 23:31:23 +00:00
nobu 4bc884c4f3 ruby.c: conflicting O_NONBLOCK
* ruby.c (load_file_internal): do not use O_NONBLOCK when
  conflicting with O_ACCMODE.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-17 04:03:23 +00:00
nobu 078b6c9838 encindex.h: ENCINDEX
* encindex.h: separate encoding index constants from internal.h.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-15 05:49:20 +00:00
nobu 67f7e82eed io.c: sys/wait.h
* io.c: BSDs need sys/wait.h for WNOHANG.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51809 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-09 02:40:02 +00:00
nobu f3f10297f0 io.c: no wait when killed
* io.c (rb_io_s_popen): do not wait the child process during being
  killed.  [ruby-core:70671] [Bug #11510]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51798 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-08 14:09:30 +00:00
nobu 0bf7726507 io.c: initialize variable
* io.c (rb_io_each_codepoint): fix use of uninitialized variable.
  [Bug #11444]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51638 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-19 07:57:20 +00:00
nobu 84bf320bea io.c: raise at incomplete char
* io.c (rb_io_each_codepoint): raise an exception at incomplete
  character before EOF when conversion takes place.  [Bug #11444]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-17 02:57:39 +00:00
nobu cfa7550b66 io.c: read more data
* io.c (rb_io_each_codepoint): read more data when read partially.
  [ruby-core:70379] [Bug #11444]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-15 01:15:22 +00:00
naruse 6a5dda00d8 * io.c (rb_io_extract_modeenc): add option parameter `flags'
to append extra oflags to normal mode.
  [Feature #11253] [ruby-core:69539]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-29 01:39:14 +00:00
normal f7c3b6ff72 io.c: IO.copy_stream uses poll on Linux
poll and ppoll have a superior API which doesn't require the
kernel to scan a potentially large bitmap to find a high-numbered
FD [ruby-core:35572].  So favor using poll in case IO.copy_stream
encounters a non-blocking FD.

We cannot reliably use poll on most OSes, because file types (e.g.
FIFOs) which work with select may not work with poll.  Fortunately,
Linux uses a common notification mechanism between all
select/poll/epoll variants, so all file types are equally supported
between the notification mechanisms.

Verified by watching strace on the following scripts:

*** maygvl_copy_stream_wait_read ***
require 'io/nonblock'
r, w = IO.pipe
r.nonblock = true
IO.copy_stream(r, "/dev/null")

*** nogvl_copy_stream_wait_write ***
require 'io/nonblock'
r, w = IO.pipe
w.nonblock = true
IO.copy_stream("/dev/zero", w)

* io.c (nogvl_wait_for_single_fd): new function for Linux
  (maygvl_copy_stream_wait_read): Linux-specific version
  (nogvl_copy_stream_wait_write): use nogvl_wait_for_single_fd
  [ruby-core:70051] [Feature #11377]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51305 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-20 20:33:50 +00:00
normal d4454d0123 io.c (argf_read_nonblock): support `exception: false'
This is a preparation for [ruby-core:69892]
("io.c: avoid kwarg parsing in C API")
since I noticed ARGF.read_nonblock did not properly catch up to
the `exception: false' change.

* io.c (argf_read_nonblock): support `exception: false'
  (io_nonblock_eof): new function
  (io_read_nonblock): use io_nonblock_eof
  (argf_getpartial): accept kwargs hash for `exception: false'
* test/ruby/test_argf.rb (test_read_nonblock): new test
  [ruby-core:70000] [Feature #11358]
* NEWS: add item for ARGF.read_nonblock

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51285 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-17 18:02:53 +00:00
sorah 3876d75585 * ext/socket/basicsocket.c: [DOC] typo (Errno::AGAIN -> Errno::EAGAIN)
* ext/socket/socket.c: ditto

* ext/socket/tcpserver.c: ditto

* ext/socket/udpsocket.c: ditto

* ext/socket/unixserver.c: ditto

* io.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-12 00:21:32 +00:00
normal df4e282eeb delay `exception: false' checks for minor speedup
Delay hash lookups until we are about to hit an exception.  This
gives a minor speedup ratio of 2-3% in the new bm_io_nonblock_noex
benchmark as well as reducing code.

* benchmark/bm_io_nonblock_noex.rb: new benchmark
* ext/openssl/ossl_ssl.c (no_exception_p): new function
  (ossl_start_ssl): adjust for no_exception_p
  (ossl_ssl_connect): adjust ossl_start_ssl call
  (ossl_ssl_connect_nonblock): ditto
  (ossl_ssl_accept): ditto
  (ossl_ssl_accept_nonblock): ditto
  (ossl_ssl_read_internal): adjust for no_exception_p
  (ossl_ssl_write_internal): ditto
  (ossl_ssl_write): adjust ossl_write_internal call
  (ossl_ssl_write_nonblock): ditto
* ext/stringio/stringio.c (strio_read_nonblock):
  delay exception check
* io.c (no_exception_p): new function
  (io_getpartial): call no_exception_p
  (io_readpartial): adjust for io_getpartial
  (get_kwargs_exception): remove
  (io_read_nonblock): adjust for io_getpartial,
  check no_exception_p on EOF
  (io_write_nonblock): call no_exception_p
  (rb_io_write_nonblock): do not check `exception: false'
  (argf_getpartial): adjust for io_getpartial
  [ruby-core:69778] [Feature #11318]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-02 22:22:14 +00:00
nobu cb85fb9c46 io.c: remove unnecessary shared
* io.c (rb_io_reopen): FilePathValue() ensures the path
  NUL-terminated and frozen, so it is unnecessary to make it shared.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-30 14:12:16 +00:00
nobu 347da440cf ensure paths NUL-terminated
* dir.c (check_dirname): ensure path name NUL-terminated for
  SHARABLE_MIDDLE_SUBSTRING.
* io.c (rb_sysopen): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-30 14:11:56 +00:00
nobu 93446fedd3 io.c: reopen OS encoding path
* io.c (rb_io_reopen): freopen(3) with OS encoding path.
  [ruby-core:69780] [Bug #11320]
* win32/file.c (rb_freopen): wrapper of wchar version freopen(3).
  use _wfreopen_s() if available.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51069 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-30 08:28:28 +00:00
normal af9e072c7e io.c: reopen stdio streams correctly when given "w+"
* io.c (rb_io_oflags_modestr): handle O_TRUNC correctly
* test/ruby/test_io.rb (test_reopen_stdio): new test

Patch-by: cremno phobia <cremno@mail.ru>

[ruby-core:69779] [Bug #11319]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51066 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-29 23:24:56 +00:00
hsbt 5d6ca9e950 * include/ruby/ruby.h: $SAFE=2 is now obsolete.
* dir.c, ext/fiddle/handle.c, ext/socket/basicsocket.c, file.c
  gc.c, io.c, process.c, safe.c, signal.c, win32/file.c:
  removed code for $SAFE=2
* test/erb/test_erb.rb, test/fiddle/test_handle.rb
  test/ruby/test_env.rb: removed tests for $SAFE=2.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-18 14:21:03 +00:00
eregon 0ebf2afa81 * io.c (rb_io_s_binread): close fd if seek offset is invalid.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50881 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-13 20:25:10 +00:00
nobu 16f37446f7 io.c: simplify rb_io_modestr_fmode
* io.c (io_encname_bom_p): needs len always.

* io.c (rb_io_modestr_fmode): check BOM only after a colon.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50875 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-13 12:30:35 +00:00
normal cee9f4a499 io.c: reduce size of :wait_*able code paths
* io.c (sym_wait_readable, sym_wait_writable): declare
  (io_getpartial): use sym_wait_readable
  (io_write_nonblock): use sym_wait_writable
  (Init_IO): initialize sym_wait_*able

On 32-bit x86:

   text    data     bss     dec     hex filename
 121003      56     252  121311   1d9df io.o
 121035      56     252  121343   1d9ff io.o.orig

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-04 22:11:19 +00:00
nobu 5c0fb216f7 io.c: refine message
* io.c (prepare_getline_args): refine the expected arity in an
  exception message.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50636 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-25 02:33:36 +00:00
nobu cac2c6d331 Fixes for grammar and style [ci skip]
* io.c (rb_f_select): [DOC] Fixes for grammar and style.
  [Fix GH-906]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-21 01:51:51 +00:00
akr f6b1dd28c9 * internal.h (rb_execarg_parent_end): Declared.
* process.c: "spawn" opens files in the parent process.
  (check_exec_redirect): Add an placeholder for fd in parameters
  for fd_open.
  (check_exec_fds_1): Delete fd_open condition.
  (check_exec_fds): Don't call check_exec_fds_1 with fd_open.
  (rb_execarg_parent_start): Open files specified as "spawn" options
  and add "dup2" options.
  (rb_execarg_parent_end): New function to close opened fds.
  (run_exec_open): Removed.
  (rb_execarg_run_options): Don't call run_exec_open.
  (rb_spawn_internal): Call rb_execarg_parent_end.

* io.c (pipe_open): Call rb_execarg_parent_end.

* ext/pty/pty.c (establishShell): Call rb_execarg_parent_end.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-09 12:44:35 +00:00
akr 9960558337 * internal.h (rb_execarg_parent_start): Renamed from rb_execarg_fixup.
* process.c: Follows the above change.

* io.c: Ditto.

* ext/pty/pty.c: Ditto.




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50193 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-09 11:53:49 +00:00
nobu efbfd90272 io.c: use read/write methods if possible
* io.c (copy_stream_body): use the arguments without conversion if
  having read, readpartial, and write methods, than conversion by
  to_path method.  [ruby-core:68676] [Bug #11015]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-30 02:28:02 +00:00