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

658 Коммитов

Автор SHA1 Сообщение Дата
akr 3146827521 * process.c (rb_f_exec): Call before_exec_async_signal_safe and
after_exec_async_signal_safe around rb_exec_async_signal_safe.
  (rb_exec_async_signal_safe): Don't call
  before_exec_async_signal_safe and after_exec_async_signal_safe.
  (rb_exec_without_timer_thread): Call before_exec and
  after_exec.
  (disable_child_handler_fork_child): Make SIGPIPE handler SIG_DFL.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47421 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-05 16:36:35 +00:00
akr 2942657a56 Unwrap a useless block.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47420 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-05 16:10:16 +00:00
akr 0610a859d9 * process.c (disable_child_handler_before_fork): New function.
(disable_child_handler_fork_parent): Ditto.
  (disable_child_handler_fork_child): Ditto.
  (retry_fork_async_signal_safe): Call above functions to disable
  signal handlers in child process.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-05 12:46:09 +00:00
akr 01689aa9b1 * process.c (handle_fork_error): Make try_gc_p argument volatile to
suppress "clobbered" warning.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47411 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-05 12:03:54 +00:00
akr 5e42cc3085 * process.c (handle_fork_error): Don't need state_p argument.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47410 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-05 11:49:04 +00:00
akr 4eed59e667 * process.c (has_privilege): Fix a return value.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-05 11:36:19 +00:00
akr 192c39532b * process.c (has_privilege): Refine uid/gid check.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-05 03:58:42 +00:00
akr 82d85fe441 * configure.in: Check sys/id.h, getuidx and getgidx for AIX.
* process.c (getresuid): Defined for AIX.
  (getresgid): Ditto
  AIX don't have getresuid/getresgid but getuidx/getgidx.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-05 03:43:28 +00:00
akr 2cf2d7ee20 * process.c (has_privilege): Fix assignements.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-05 03:28:53 +00:00
akr f20d51b0ad * process.c (has_privilege): New function.
(retry_fork_async_signal_safe): Don't use vfork() for privileged
  process.

* configure.in (getresuid): Check function.
  (getresgid): Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47386 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-04 14:56:03 +00:00
akr 777d61faf4 * process.c (before_fork_ruby): Renamed from before_fork.
(after_fork_ruby): Renamed from after_fork.




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-03 10:23:24 +00:00
akr ed0f2528e8 * process.c (forked_child): Removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47373 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-03 09:56:38 +00:00
akr 9b16f90692 * process.c (retry_fork_async_signal_safe): Use vfork() if available.
vfork() is still faster than fork() especially when the parent
  process uses big memory.

  ruby -rbenchmark -e 'a = "a" * 1_000_000_000; puts Benchmark.measure { system("true") }'
  fork:   0.000000   0.010000   0.010000 (  0.014968)
  vfork:  0.000000   0.000000   0.000000 (  0.000912)
  on Debian sid.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47363 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-03 03:06:17 +00:00
akr 93a7bf4b17 * configure.in: Use AC_FUNC_FORK.
* io.c: Use HAVE_WORKING_FORK instead of HAVE_FORK.

* process.c: Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47361 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-02 22:51:03 +00:00
akr 34af76e318 * process.c (retry_fork_async_signal_safe): Don't return on in child
process.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-02 15:13:36 +00:00
akr 93621161d6 * process.c (retry_fork_async_signal_safe): Specialized version of
retry_fork respect to rb_fork_async_signal_safe.
  (retry_fork_ruby): Specialized version of retry_fork respect to
  rb_fork_ruby.
  (rb_fork_ruby): Removed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-02 14:47:46 +00:00
akr de88408813 * process.c (send_child_error): Simplified.
(recv_child_error): Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-02 14:27:10 +00:00
akr a78a9b0d17 * process.c (rb_fork_async_signal_safe): Inline rb_fork_internal.
(rb_fork_ruby): Ditto.
  (rb_fork_internal): Removed.
  (chfunc_protect): Removed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-02 13:56:35 +00:00
akr 557802a1da * process.c (handle_fork_error): Extracted from retry_fork.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-02 11:47:35 +00:00
nobu e5a7c2db98 get rid of function calls in RSTRING_PTR
* process.c (rlimit_resource_type, rlimit_resource_value): get rid
  of function calls in RSTRING_PTR(), as it evaluates the argument
  twice.

* re.c (match_backref_number): ditto.

* signal.c (esignal_init, rb_f_kill, trap_signm): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-30 13:46:41 +00:00
ktsj 3b895e8355 * process.c (rlimit_resource_type, rlimit_resource_value):
get rid of inadvertent dynamic symbol pin-down.

* re.c (match_backref_number): ditto.

* signal.c (esignal_init, rb_f_kill, trap_signm): ditto.

* transcode.c (econv_opts): ditto.

* vm_trace.c (symbol2event_flag): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47005 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-30 13:17:45 +00:00
nobu e99ee55abc constify parameters
* include/ruby/intern.h: constify `argv` parameters.

* include/ruby/ruby.h: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46459 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-18 06:16:39 +00:00
nobu fd444f90b5 process.c: use UTF-8
* process.c (open): use UTF-8 version function to support
  non-ascii path properly.  [ruby-core:63185] [Bug #9946]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-16 05:35:59 +00:00
nobu d327c8da66 process.c: variable as macro argument
* process.c (run_exec_open): use a local variable to get rid of
  RARRAY_AREF() is evaluated multiple times by RSTRING_PTR().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-16 05:28:03 +00:00
nobu efc70c74c2 process.c: use RB_TYPE_P
* process.c (check_exec_redirect): use RB_TYPE_P instead of single
  comparison of TYPE().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-15 01:09:17 +00:00
normal d450229a27 process.c (proc_getgroups, proc_setgroups): use ALLOCV_N
* process.c (proc_getgroups, proc_setgroups): use ALLOCV_N
  [Bug #9856]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46075 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-24 07:22:54 +00:00
nobu 55d4afc77e process.c: use ruby_stop
* process.c (rb_exit): call ruby_stop() which calls ruby_cleanup(),
  instead of calling ruby_finalize() directly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45900 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-10 04:41:02 +00:00
akr 058b5bce60 [DOC]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45888 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-09 13:57:04 +00:00
akr 7a69a3583c * process.c (check_exec_redirect): Open the file in write mode for
redirect from [:out, :err].
  Proposed and implemented by Yusuke Endoh.
  [ruby-dev:41430] [Feature #3348]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45828 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-05 13:37:09 +00:00
akr 1388beb195 [DOC]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-02 13:35:47 +00:00
akr 960c8ab125 * process.c (OBJ2UID1): Defined even if getpwnam_r is not usable.
(OBJ2GID1): Defined even if getgrnam_r is not usable.
  This fixes compilation error on Android.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45541 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-09 12:05:14 +00:00
nobu c0dee604fe process.c: preserve encodings
* process.c (rlimit_resource_type, rlimit_resource_value):
  preserve argument encoding in error messages.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45478 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-30 21:00:53 +00:00
nobu d64ba37ad0 process.c: constify
* process.c (rb_execarg_new, rb_execarg_init): constify argv.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-17 08:21:47 +00:00
nobu 119d66232d process.c: expand buffer on ERANGE
* process.c (obj2uid, obj2gid): now getpwnam_r() and getgrnam_r()
  may need larger buffers than sysconf values, so retry with
  expanding the buffer when ERANGE is returned.
  [ruby-core:61325] [Bug #9600]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45290 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-08 04:30:56 +00:00
nobu 3df8fbf248 process.c: need capacity
* process.c (obj2uid, obj2gid): need capacity as buffer size, not
  length.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45289 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-08 04:30:30 +00:00
nobu 9e33b72ad1 process.c: GETPW_R_SIZE_INIT, GETGR_R_SIZE_INIT
* process.c (GETPW_R_SIZE_INIT, GETGR_R_SIZE_INIT): sysconf values
  are not maximum sizes, but initial sizes.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-08 04:08:46 +00:00
nobu b1fb57da3d process.c: tmp buffer instead of alloca
* process.c (OBJ2UID1, OBJ2GID1): separate from OBJ2UID and
  OBJ2GID respectively, need given buffers.

* process.c (OBJ2UID, OBJ2GID): no longer need PREPARE_GETPWNAM
  and PREPARE_GETGRNAM.

* process.c (obj2uid, obj2gid): use tmp buffer instead of alloca
  to get rid of potential stack overflow.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-08 03:55:01 +00:00
hsbt 511c2a1647 * process.c: [DOC] typo fix by @jkassemi [fix GH-544][ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45148 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-23 02:25:59 +00:00
akr 6f8b0e9bb0 * include/ruby/intern.h,
include/ruby/io.h,
  include/ruby/ruby.h,
  include/ruby/win32.h,
  include/ruby/backward/rubysig.h,
  bignum.c,
  gc.c,
  io.c,
  process.c,
  safe.c,
  struct.c,
  thread.c,
  ext/socket/rubysocket.h,
  ext/-test-/old_thread_select: Remove deprecated definitions
  [ruby-core:60581] [Feature #9502]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-14 15:16:31 +00:00
akr fbf4850cab * process.c (READ_FROM_CHILD): Apply the last hunk of
0001-process.c-avoid-EINTR-from-Process.spawn.patch written by
  Eric Wong in [Bug #8770].



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-28 11:54:36 +00:00
nobu 7336d8c899 process.c: avoid EINTR from Process.spawn
* process.c (send_child_error): retry write on EINTR to fix
  occasional Errno::EINTR from Process.spawn.
* process.c (recv_child_error): retry read on EINTR to fix
  occasional Errno::EINTR from Process.spawn.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44706 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-25 05:50:44 +00:00
charliesome 0a881f81b1 * process.c (recv_child_error): Fix deadlock in rb_fork_internal when a
signal is sent to the parent process while Ruby is forking in IO.popen.

  Patch by Scott Francis. Closes GH-513.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-23 05:07:48 +00:00
ko1 c702005a7b * include/ruby/ruby.h: rename OBJ_WRITE and OBJ_WRITTEN into
RB_OBJ_WRITE and RB_OBJ_WRITTEN.
* array.c, class.c, compile.c, hash.c, internal.h, iseq.c,
  proc.c, process.c, re.c, string.c, variable.c, vm.c,
  vm_eval.c, vm_insnhelper.c, vm_insnhelper.h,
  vm_method.c: catch up this change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-20 08:07:47 +00:00
naruse 2a732947a6 * process.c (make_clock_result): add :second as a unit for
Process.clock_gettime.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44230 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-16 05:04:03 +00:00
charliesome e0290c9404 * array.c (rb_ary_or): use RHASH_TBL_RAW instead of RHASH_TBL
* process.c (rb_execarg_fixup): use RHASH_TBL_RAW and insert write
  barriers where appropriate

* vm.c (kwmerge_i): use RHASH_TBL_RAW

* vm.c (HASH_ASET): use rb_hash_aset instead of calling directly into
  st_insert

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-08 00:41:01 +00:00
nobu 7566c49068 ruby/ruby.h: RB_BLOCK_CALL_FUNC_ARGLIST
* include/ruby/ruby.h (RB_BLOCK_CALL_FUNC_ARGLIST): for declaration
  argument list of rb_block_call_func.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43910 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-29 07:59:14 +00:00
nobu 9f45081627 ruby/ruby.h: add blockarg to rb_block_call_func
* include/ruby/ruby.h (rb_block_call_func): add blockarg.  block
  function can take block argument, e.g., proc {|&blockarg| ...}.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-29 02:26:48 +00:00
nobu 21f81885ab win32.c: rb_w32_dup2
* win32/win32.c (rb_w32_dup2): extract from rb_cloexec_dup2() and
  redirect_dup2().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-28 07:15:56 +00:00
ko1 c5e08b764e * add RUBY_TYPED_FREE_IMMEDIATELY to data types which only use
safe functions during garbage collection such as xfree().
  On default, T_DATA objects are freed at same points as fianlizers.
  This approach protects issues such as reported by [ruby-dev:35578].
  However, freeing T_DATA objects immediately helps heap usage.
  Most of T_DATA (in other words, most of dfree functions) are safe.
  However, we turned off RUBY_TYPED_FREE_IMMEDIATELY by default
  for safety.
* cont.c: ditto.
* dir.c: ditto.
* encoding.c: ditto.
* enumerator.c: ditto.
* error.c: ditto.
* file.c: ditto.
* gc.c: ditto.
* io.c: ditto.
* iseq.c: ditto.
* marshal.c: ditto.
* parse.y: ditto.
* proc.c: ditto.
* process.c: ditto.
* random.c: ditto.
* thread.c: ditto.
* time.c: ditto.
* transcode.c: ditto.
* variable.c: ditto.
* vm.c: ditto.
* vm_backtrace.c: ditto.
* vm_trace.c: ditto.
* ext/bigdecimal/bigdecimal.c: ditto.
* ext/objspace/objspace.c: ditto.
* ext/stringio/stringio.c: ditto.
* ext/strscan/strscan.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-29 11:16:54 +00:00
nobu d956453a98 process.c: Process::Tms
* process.c (Init_process): rename Struct::Tms as Process::Tms.  keep
  the former defined for the backward compatibility, for the time
  being.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43438 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-27 01:38:20 +00:00