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

1364 Коммитов

Автор SHA1 Сообщение Дата
nobu 42a2f89b39 io.c: use built-in encoding indexes
* internal.h: add UTF-{16,32}{BE,LE}.
* io.c (io_strip_bom): use built-in encoding indexes in internal.h.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-02 08:22:34 +00:00
nobu 637d668bca win32: UTF-8 spawn
* io.c (spawnv, spawn): use UTF-8 spawn family.  [Bug #1771]
* process.c (proc_exec_sh, proc_spawn_cmd, proc_spawn_sh): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-30 01:59:21 +00:00
charliesome fff3589899 * compile.c (make_name_for_block): use PRIsVALUE in format string
instead of %s and RSTRING_PTR to protect objects from being garbage
  collected too soon
* encoding.c (str_to_encindex): ditto
* hash.c (rb_hash_fetch_m): ditto
* io.c (rb_io_reopen): ditto
* parse.y (reg_fragment_check_gen): ditto
* parse.y (reg_compile_gen): ditto
* parse.y (ripper_assert_Qundef): ditto
* re.c (rb_reg_raise): ditto
* ruby.c (set_option_encoding_once): ditto
* vm_eval.c (rb_throw_obj): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41597 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-24 11:31:21 +00:00
shugo 1f828497d1 * safe.c (rb_set_safe_level, safe_setter): raise an ArgumentError
when $SAFE is set to 4.  $SAFE=4 is now obsolete.
  [ruby-core:55222] [Feature #8468]

* object.c (rb_obj_untrusted, rb_obj_untrust, rb_obj_trust):
  Kernel#untrusted?, untrust, and trust are now deprecated.
  Their behavior is same as tainted?, taint, and untaint,
  respectively.

* include/ruby/ruby.h (OBJ_UNTRUSTED, OBJ_UNTRUST): OBJ_UNTRUSTED()
  and OBJ_UNTRUST() are aliases of OBJ_TAINTED() and OBJ_TAINT(),
  respectively.

* array.c, class.c, debug.c, dir.c, encoding.c, error.c, eval.c,
  ext/curses/curses.c, ext/dbm/dbm.c, ext/dl/cfunc.c,
  ext/dl/cptr.c, ext/dl/dl.c, ext/etc/etc.c, ext/fiddle/fiddle.c,
  ext/fiddle/pointer.c, ext/gdbm/gdbm.c, ext/readline/readline.c,
  ext/sdbm/init.c, ext/socket/ancdata.c, ext/socket/basicsocket.c,
  ext/socket/socket.c, ext/socket/udpsocket.c,
  ext/stringio/stringio.c, ext/syslog/syslog.c, ext/tk/tcltklib.c,
  ext/win32ole/win32ole.c, file.c, gc.c, hash.c, io.c, iseq.c,
  load.c, marshal.c, object.c, proc.c, process.c, random.c, re.c,
  safe.c, string.c, thread.c, transcode.c, variable.c,
  vm_insnhelper.c, vm_method.c, vm_trace.c: remove code for
  $SAFE=4.

* test/dl/test_dl2.rb, test/erb/test_erb.rb,
  test/readline/test_readline.rb,
  test/readline/test_readline_history.rb, test/ruby/test_alias.rb,
  test/ruby/test_array.rb, test/ruby/test_dir.rb,
  test/ruby/test_encoding.rb, test/ruby/test_env.rb,
  test/ruby/test_eval.rb, test/ruby/test_exception.rb,
  test/ruby/test_file_exhaustive.rb, test/ruby/test_hash.rb,
  test/ruby/test_io.rb, test/ruby/test_method.rb,
  test/ruby/test_module.rb, test/ruby/test_object.rb,
  test/ruby/test_pack.rb, test/ruby/test_rand.rb,
  test/ruby/test_regexp.rb, test/ruby/test_settracefunc.rb,
  test/ruby/test_struct.rb, test/ruby/test_thread.rb,
  test/ruby/test_time.rb: remove tests for $SAFE=4.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-12 14:20:51 +00:00
nobu ab64f23771 io.c: fix 7bit coderange condition
* io.c (io_getc): fix 7bit coderange condition, check if ascii read
  data instead of read length. [ruby-core:55444] [Bug #8516]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41250 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-12 03:44:48 +00:00
akr bd15d4ca78 * internal.h (numberof): Gathered from various files.
* array.c, math.c, thread_pthread.c, iseq.c, enum.c, string.c, io.c,
  load.c, compile.c, struct.c, eval.c, gc.c, parse.y, process.c,
  error.c, ruby.c: Remove the definitions of numberof.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-07 10:01:19 +00:00
nobu 6db56c86c9 fill rdocs
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-02 03:12:04 +00:00
ktsj edb98f8b91 fix typos. Patch by k_takata.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-19 03:10:21 +00:00
ko1 83aba04862 * include/ruby/ruby.h: constify RBasic::klass and add
RBASIC_CLASS(obj) macro which returns a class of `obj'.
  This change is a part of RGENGC branch [ruby-trunk - Feature #8339].
* object.c: add new function rb_obj_reveal().
  This function reveal interal (hidden) object by rb_obj_hide().
  Note that do not change class before and after hiding.
  Only permitted example is:
  klass = RBASIC_CLASS(obj);
  rb_obj_hide(obj);
  ....
  rb_obj_reveal(obj, klass);
  TODO: API design. rb_obj_reveal() should be replaced with others.
  TODO: modify constified variables using cast may be harmful for
  compiler's analysis and optimizaton.
  Any idea to prohibt inserting RBasic::klass directly?
  If rename RBasic::klass and force to use RBASIC_CLASS(obj),
  then all codes such as `RBASIC(obj)->klass' will be
  compilation error. Is it acceptable? (We have similar
  experience at Ruby 1.9,
  for example "RARRAY(ary)->ptr" to "RARRAY_PTR(ary)".
* internal.h: add some macros.
* RBASIC_CLEAR_CLASS(obj) clear RBasic::klass to make it internal
  object.
* RBASIC_SET_CLASS(obj, cls) set RBasic::klass.
* RBASIC_SET_CLASS_RAW(obj, cls) same as RBASIC_SET_CLASS
  without write barrier (planned).
* RCLASS_SET_SUPER(a, b) set super class of a.
* array.c, class.c, compile.c, encoding.c, enum.c, error.c, eval.c,
  file.c, gc.c, hash.c, io.c, iseq.c, marshal.c, object.c,
  parse.y, proc.c, process.c, random.c, ruby.c, sprintf.c,
  string.c, thread.c, transcode.c, vm.c, vm_eval.c, win32/file.c:
  Use above macros and functions to access RBasic::klass.
* ext/coverage/coverage.c, ext/readline/readline.c,
  ext/socket/ancdata.c, ext/socket/init.c,
* ext/zlib/zlib.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 10:49:11 +00:00
ko1 aacd771046 * *.c, parse.y, insns.def: use RARRAY_AREF/ASET macro
instead of using RARRAY_PTR().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 09:56:22 +00:00
naruse 4834aa5307 * io.c (rb_io_ext_int_to_encs): ignore internal encoding if external
encoding is ASCII-8BIT. [Bug #8342]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40610 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-08 08:47:26 +00:00
kazu b22fa276e9 fix typo (r40195, r40428)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-26 16:13:56 +00:00
nobu 91fb5bc889 io.c: conversion from bom encoding
* io.c (rb_io_ext_int_to_encs, parse_mode_enc): bom-prefixed name is
  not a real encoding name, just a fallback.  so the proper conversion
  should take place even if if the internal encoding is equal to the
  bom-prefixed name, unless actual encoding is equal to the internal
  encoding.  [ruby-core:54563] [Bug #8323]
* io.c (io_set_encoding_by_bom): reset extenal encoding if no BOM
  found.  [ruby-core:54569]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-25 07:11:20 +00:00
kosaki 6edde68b5d * io.c (rb_fd_fix_cloexec): use rb_update_max_fd().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40438 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-24 05:15:56 +00:00
headius cd9e93d469 * Typo in defining EWOULDBLOCKWaitReadable on platforms where
EAGAIN != EWOULDBLOCK.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40428 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-23 20:29:24 +00:00
nobu 74ba9c2488 io.c: define EWOULDBLOCK
* io.c (Init_IO): define EWOULDBLOCK alway as it is needed always.
  and turn runtime branch into preprocessor condition.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-09 00:42:33 +00:00
headius 0626d9b91c Fix #6154 by introducing new EAGAIN/EWOULDBLOCK/EINPROGRESS
subclasses that include WaitReadable or WaitWritable rather than
extending them into the exception object each time.

* error.c: Capture EGAIN, EWOULDBLOCK, EINPROGRESS exceptions and
  export them for use in WaitReadable/Writable exceptions.
* io.c: Create versions of EAGAIN, EWOULDBLOCK, EINPROGRESS that
  include WaitReadable and WaitWritable. Add rb_readwrite_sys_fail
  for nonblocking failures using those exceptions. Use that
  function in io_getpartial and io_write_nonblock instead of
  rb_mod_sys_fail
* ext/openssl/ossl_ssl.c: Add new SSLError subclasses that include
  WaitReadable and WaitWritable. Use those classes for
  write_would_block and read_would_block instead of rb_mod_sys_fail.
* ext/socket/ancdata.c: Use rb_readwrite_sys_fail instead of
  rb_mod_sys_fail in bsock_sendmsg_internal and
  bsock_recvmsg_internal.
* ext/socket/init.c: Use rb_readwrite_sys_fail instead of
  rb_mod_sys_fail in rsock_s_recvfrom_nonblock and
  rsock_s_connect_nonblock.
* ext/socket/socket.c: Use rb_readwrite_sys_fail instead of
  rb_mod_sys_fail in sock_connect_nonblock.
* include/ruby/ruby.h: Export rb_readwrite_sys_fail for use instead
  of rb_mod_sys_fail. Introduce new constants RB_IO_WAIT_READABLE and
  RB_IO_WAIT_WRITABLE for first arg to rb_readwrite_sys_fail.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-08 19:58:55 +00:00
akr b81ea661db * io.c (rb_io_seek_m): Accept :CUR, :END, :SET as "whence" argument.
(interpret_seek_whence): New function.
  [ruby-dev:45818] [Feature #6643]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40084 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-03 12:25:09 +00:00
akr e89c029f2b update doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-02 09:48:34 +00:00
nobu 824cb69058 io.c: get rid of IOError when skipped while iteration
* io.c (argf_next_argv): set init flag if succeeded to forward, after
  skipping.
* io.c (argf_block_call_i, argf_block_call): no more forwarding if
  forwarded after skipping.  [ruby-list:49185]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39997 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-29 07:51:43 +00:00
nobu 8d7c52dbe2 io.c: get rid of IOError when skipped while iteration
* io.c (argf_close): deal with init flag.
* io.c (argf_block_call_i, argf_block_call): forward next file if
  skipped while iteration, to get rid of IOError.  [ruby-list:49185]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-29 07:51:08 +00:00
kosaki b945ad289f * io.c (linux_iocparm_len): enable only exist _IOC_SIZE().
Because musl libc doesn't have it. [Bug #8051] [ruby-core:53229]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-19 03:17:34 +00:00
naruse a9cbf64137 * io.c (io_fillbuf): show fd number on failure to debug.
http://c5632.rubyci.org/~chkbuild/ruby-trunk/log/20130316T050302Z.diff.html.gz

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39803 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-17 16:25:21 +00:00
nobu af24f5ff6a io.c: max_file_descriptor
* io.c (max_file_descriptor): rb_atomic_t for ATOMIC_CAS().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39776 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-16 07:28:20 +00:00
kosaki c824d47ebc * include/ruby/missing.h (__syscall): moved to...
* io.c: here. because __syscall() is only used from io.c.

* include/ruby/missing.h: move "#include <sys/type.h>" to ....
* include/ruby/intern.h: here. because it was introduced for
  fixing NFDBITS issue. [ruby-core:05179].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39774 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-16 05:07:14 +00:00
nobu 0d3d9eff4d file.c: rb_sys_fail_path_with_func
* file.c (rb_sys_fail_path_with_func): share same function, and path
  may be nil.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-15 05:51:37 +00:00
naruse bfd52c985c * file.c (rb_sys_fail_path): define & use rb_sys_fail_path0 like r39752
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39759 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-14 23:25:09 +00:00
naruse 756cd2852d * io.c (extract_binmode): raise error even if binmode and textmode
don't conflict. [Bug #5918] [ruby-core:42199]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-11 08:02:36 +00:00
kosaki 235546ba04 * io.c (rb_update_max_fd): use ATOMIC_CAS because this function
is used from timer thread too.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-10 04:00:33 +00:00
marcandre b0c40fca24 * io.c: Fix rdoc typo [Github fixes #256]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39649 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-09 01:01:25 +00:00
nobu 391d691123 io.c: FOREACH_ARGF
* 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-13 08:51:27 +00:00
nobu dfd0cbece0 io.c: simplify
* 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-13 08:51:25 +00:00
akr a00c92f7fc add doc. for IO#close_on_exec=.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39184 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-10 04:14:51 +00:00
nobu 330e39d568 io.c: no envp if no spawnve
* 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-15 14:07:17 +00:00
yugui c9f5a8f3f2 * bootstraptest/test_io.c: add a test for [ruby-dev:46834].
* 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-06 09:48:00 +00:00
kosaki 753f68cf20 * io.c (rb_cloexec_fcntl_dupfd): improve #ifdef condition.
* 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-04 23:23:40 +00:00
yugui 0626021e13 * io.c (rb_cloexec_fcntl_dupfd): Fix failures in
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
2013-01-03 15:39:10 +00:00
nobu be7bf5aa0c adjust style
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-29 12:22:04 +00:00
nobu 320b49473e error.c: rb_write_error_str
* 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-25 04:38:18 +00:00
knu c47c095b97 Deprecate #{lines,bytes,chars,codepoints} of IO-likes.
* 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 17:22:04 +00:00
kosaki 398581564d * io.c (rb_io_wait_writable): use rb_thread_check_ints() instead
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-22 13:02:12 +00:00
kosaki 06dcf7840f * io.c (rb_io_wait_writable): don't use rb_thread_wait_fd()
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-18 10:07:15 +00:00
kosaki 6d8ad6c489 * io.c (io_flush_buffer_sync2): avoid to return 0. because
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-17 05:04:04 +00:00
kosaki 7fbaa0bedf * io.c (finish_writeconv): uses rb_write_internal2 if
fptr->write_lock have.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38401 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-15 05:40:29 +00:00
kosaki e78d4e69fe * thread.c (rb_mutex_owned_p): remove static.
* 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 05:40:18 +00:00
kosaki 9bd33790b7 * io.c (io_flush_buffer): uses io_flush_buffer_async2 instead of
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 05:40:07 +00:00
kosaki 2a4d86f385 * io.c (internal_write_func2): new helper function for rb_write_internal2().
* 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 05:39:57 +00:00
kosaki 96350867e1 * io.c (rb_io_wait_writable): add to call rb_thread_wait_fd()
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 05:39:46 +00:00
kosaki 70df4dec03 * io.c (rb_io_wait_writable): don't call rb_thread_fd_writable()
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-15 05:39:36 +00:00
kosaki fe6b2e20e9 * thread.c (rb_uninterruptible): helper function for providing
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 19:37:49 +00:00
kosaki def63c3466 * io.c (io_binwrite): check interrupt before io issue.
* 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-05 19:37:37 +00:00
ko1 f6f388a5bd * array.c, enum.c, insns.def, io.c, numeric.c, parse.y, process.c,
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-02 09:57:47 +00:00
nobu 01eb117b01 io.c: recurse for the argument
* 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-12-01 10:24:12 +00:00
kosaki b8a1e36201 * thread.c (struct rb_mutex_struct): add allow_trap field.
* 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 08:30:51 +00:00
kosaki e6ef313a49 * io.c (FMODE_SYNCWRITE): removed unused macro.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-28 06:36:28 +00:00
naruse 3e0becb42d * io.c (argf_each_codepoint): add missing ARGF#codepoints [Bug #7438]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-26 07:37:25 +00:00
kosaki c8a3b2ba8b * io.c (Init_IO): removed all rb_file_const() into file.c.
* 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-20 05:00:45 +00:00
zzak de794aefa6 * io.c (IO#new):
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-09 00:28:41 +00:00
zzak 4d42277823 * io.c (IO#new):
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-11-03 04:27:56 +00:00
usa ee2718039c * process.c (redirect_dup2): set standard handles when new fd is stdio,
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-30 10:32:56 +00:00
nari c3a46d6aca * include/ruby/ruby.h: add C APIs.
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-20 06:57:51 +00:00
nobu 5c677a83ba io.c: improved IO#reopen
* 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-10-03 02:43:19 +00:00
nobu 4a3c049cd1 io.c: IO#reopen int mode
* 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-28 01:40:56 +00:00
nobu 59383b1f9c io.c: io_set_read_length
* 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-16 02:39:18 +00:00
kosaki 84c77c1520 * ext/socket/basicsocket.c (rsock_bsock_send):
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 17:29:12 +00:00
kosaki 946f7fc788 * io.c (nogvl_close, maygvl_close, nogvl_fclose, maygvl_fclose):
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 17:11:25 +00:00
kosaki 4c10b36467 * io.c (rb_io_close): notify fd close before releasing gvl.
* 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 17:11:03 +00:00
kosaki 4b58f39ded * io.c (nogvl_close, maygvl_close, nogvl_fclose, maygvl_fclose):
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 09:10:46 +00:00
kosaki 3df2fc2da8 * io.c (io_bufread): removed unnecessary rb_thread_wait_fd().
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-09 07:20:00 +00:00
eregon 1f65a21b6f * io.c: fix typo in io/console example.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36875 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-01 07:41:51 +00:00
akr 76d0abd334 * io.c (rb_io_close): call rb_last_status_clear.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36856 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-30 09:22:18 +00:00
akr e7ddd1fdc3 * internal.h (rb_last_status_clear): declared.
* 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-29 14:44:08 +00:00
eregon fd7dc23d28 Kernel#inspect: improve consistency and do not call #to_s.
* 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-15 11:50:01 +00:00
naruse 780e7d0951 Revert r36699 and r36700. [Feature #6130]
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-15 01:09:10 +00:00
eregon 795c29dcda Kernel#inspect: improve consistency and 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. 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-14 10:20:44 +00:00
nobu d97cd39f42 io.c: suppress unused variable warnings
* 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-08-05 15:40:06 +00:00
nobu c05e6a8cda process.c: try conversion at redirection
* 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-27 09:25:54 +00:00
nobu 7bca2f031a get rid of warnings
* 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-11 03:17:35 +00:00
nobu c51a826764 rb_thread_call_without_gvl
* 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-10 13:57:11 +00:00
kosaki 3e1d8aab17 * dln.c: Simplify and make consistent an ifdef for Mac OS X.
* 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-07-09 15:52:49 +00:00
nobu f4d2374b45 adjust style.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36232 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-27 05:37:15 +00:00
nobu 2240eb37b8 popen: shell commands with envvars and execopts
* 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-27 00:15:51 +00:00
nobu 876d4c4cc8 Revert r36213 "popen: shell commands with envvar"
* 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-26 01:01:59 +00:00
nobu 0f0f0f4441 popen: shell commands with envvar
* 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-25 06:42:05 +00:00
nobu cc1c97ae31 io.c: spawnv
* 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-24 14:02:19 +00:00
akr 5c25fad66d * process.c: use the name "sargp" for struct rb_execarg variables
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-23 00:18:32 +00:00
akr 3eafc1660f * process.c: use the name "eargp" for struct rb_execarg variables
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-22 23:09:16 +00:00
akr c7a68e8d9d needless RB_GC_GUARD removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-21 13:46:14 +00:00
akr ed8040a62b * process.c (rb_execarg_addopt): take a VALUE argument instead of
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-21 12:18:40 +00:00
akr 129cad739b remove unused variables.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-21 10:01:27 +00:00
akr d73d3a743b * process.c (rb_execarg_fixup): take a VALUE argument instead of
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 21:25:20 +00:00
akr b60713de73 * internal.h (struct rb_execarg) moved and renamed from
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 11:46:50 +00:00
akr 826f98e688 * internal.h (rb_execarg_new): declared.
(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-20 10:31:02 +00:00
akr 37a1355bf8 * include/ruby/intern.h (rb_exec_arg_init): deprecated.
(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-12 11:34:51 +00:00
akr 4b70fab915 * process.c (rb_fork_ruby): new function.
(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 11:21:07 +00:00
akr c27edd4a6e * io.c (popen_exec): don't call rb_thread_atfork_before_exec. use
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-10 03:16:32 +00:00
akr 795c5f9b40 * process.c: don't check the availability of FD_CLOEXEC. It should
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-08 14:46:23 +00:00
akr 3162e673a1 * internal.h (rb_exec_arg_init): change return type to void.
* 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 15:24:32 +00:00
akr 53b17a769b * internal.h (rb_exec_arg): use union to represent command invocation
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-05 14:53:31 +00:00
nobu 2073258a7d obj_init_copy
* 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 11:13:18 +00:00