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

464 Коммитов

Автор SHA1 Сообщение Дата
akr 9ea35ccf30 * process.c (rb_proc_exec_n): revert the function removed at r35889.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36028 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-10 21:31:49 +00:00
akr fa5cd00340 * process.c (rb_exec_without_timer_thread): renamed from rb_exec_err.
(rb_exec_err): new stub function to call
  rb_exec_without_timer_thread.
  (rb_f_exec): call rb_exec_without_timer_thread.
  (rb_exec): call rb_exec_without_timer_thread.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-10 12:31:40 +00:00
akr 4fa66dc53b * process.c (rb_fork): call rb_fork_internal instead of rb_fork_err.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-10 12:13:33 +00:00
akr f589733a02 * process.c (rb_fork_ruby): call rb_fork_internal directly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36019 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-10 11:56:20 +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 8fdd48d69f * process.c (retry_fork): call after_fork except in a child process.
(rb_fork_internal): restrict after_fork call condition.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36012 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-10 06:51:05 +00:00
akr c39fd4c340 * process.c (rb_f_exec): call rb_exec_async_signal_safe except on
Mac OS X.  cf. the comment in before_exec_non_async_signal_safe.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36009 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-10 03:46:09 +00:00
akr 258716bd9d * process.c (rb_fork_internal): call after_fork only unless
chfunc_is_async_signal_safe.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-10 02:45:38 +00:00
akr 839dc7d409 update async-signal-safe comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36004 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-10 01:46:45 +00:00
akr 18088467e7 * process.c (rb_exec_async_signal_safe): exported.
* ext/pty/extconf.rb: modify $INCFLAGS to include internal.h

* ext/pty/pty.c: include internal.h.
  (chfunc): don't call rb_thread_atfork_before_exec.  use
  rb_exec_async_signal_safe instead of rb_f_exec.
  (establishShell): set up earg.  use rb_fork_async_signal_safe
  instead of rb_fork_err.

* internal.h (rb_exec_async_signal_safe): declared.
  (rb_fork_async_signal_safe): declared.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36002 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-10 01:29:58 +00:00
akr 8fcdb757a5 * process.c (rb_f_exec): use rb_exec_arg_prepare.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36000 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-10 01:17:53 +00:00
akr 99c71b1ee4 * process.c: split after_exec into async-signal-safe part and rest.
(after_exec_async_signal_safe): extracted from after_exec.
  (after_exec_non_async_signal_safe): ditto.
  (after_exec): call them.
  (rb_exec_async_signal_safe): call after_exec_async_signal_safe.
  (rb_exec_err): call after_exec_non_async_signal_safe instead of
  after_exec.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-09 21:48:42 +00:00
akr f45eb45100 * process.c (rb_fork_internal): initialize exc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35993 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-09 16:37:44 +00:00
akr b11046a61e * process.c: don't use non async-signal-safe functions in a child
process before exec, for invoking a command.
  (rb_exec_atfork): call rb_exec_async_signal_safe only.
  (retry_fork): take chfunc_is_async_signal_safe argument.  call
  before_fork and after_fork only unless chfunc_is_async_signal_safe.
  (send_child_error): take chfunc_is_async_signal_safe argument.
  send an exception only unless chfunc_is_async_signal_safe.
  (recv_child_error): take chfunc_is_async_signal_safe argument.
  receive an exception only unless chfunc_is_async_signal_safe.
  (rb_fork_internal): renamed from rb_fork_err and take
  chfunc_is_async_signal_safe argument.
  use rb_protect only unless chfunc_is_async_signal_safe.
  (rb_fork_err): call rb_fork_internal with false as
  chfunc_is_async_signal_safe.
  (rb_fork_async_signal_safe): call rb_fork_internal with true as
  chfunc_is_async_signal_safe.
  (rb_spawn_process): call rb_fork_async_signal_safe instead of
  rb_fork_err.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-09 15:25:34 +00:00
akr 14ec2c802d * process.c (rb_fork_err): rewrite a complex "if" statement.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-09 14:58:03 +00:00
akr d074d0df95 * process.c (before_exec_async_signal_safe): extracted from
before_exec.
  (before_exec_non_async_signal_safe): ditto.
  (before_exec): call before_exec_async_signal_safe and
  before_exec_non_async_signal_safe.
  (rb_exec_async_signal_safe): call before_exec_async_signal_safe.
  (rb_exec_err): call before_exec_non_async_signal_safe instead of
  before_exec.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-09 14:45:46 +00:00
akr 7057facef3 * process.c (retry_fork): rewrite a complex "for" statement by
simple statements. 


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-09 13:28:02 +00:00
akr 1ad3f4b05d * process.c (retry_fork): extracted from rb_fork_err.
(send_child_error): ditto.
  (recv_child_error): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-09 12:51:01 +00:00
akr a46bf824bf update async-signal-safe comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35983 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-09 02:09:10 +00:00
akr d410a38b8e * process.c (rb_exec_async_signal_safe): extracted from rb_exec_err.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-09 01:57:46 +00:00
akr 4da82e58a1 update async-signal-safe comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35981 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-09 01:40:22 +00:00
akr 4a9a7756da * process.c: simplified because close_others option is always
enabled by default.
  (rb_f_exec): don't need to set the option.
  (rb_exec_arg_prepare): don't need to set the option.  don't need
  default_close_others argument.
  (rb_spawn_internal): don't need to give default_close_others
  argument for rb_exec_arg_prepare.  don't need default_close_others
  argument.
  (rb_spawn_err): don't need to give default_close_others
  argument for rb_spawn_internal.
  (rb_spawn): don't need to give default_close_others
  argument for rb_spawn_internal.
  (rb_f_system): don't need to give default_close_others argument for
  rb_spawn_internal. 
  (rb_f_spawn): don't need to give default_close_others argument for
  rb_exec_arg_prepare. 



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-09 01:07:07 +00:00
akr 0ec4ae7c8e * process.c (rb_proc_exec): call before_exec() here addition to
rb_exec_err.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-09 00:01:58 +00:00
nobu 1102fd2f3e * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-08 22:44:01 +00:00
akr 2fb032b74b * process.c (rb_exec_err): before_exec() call moved from proc_exec_cmd
and proc_exec_sh.
  (rb_proc_exec): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-08 16:26:01 +00:00
akr b9824fbb08 * include/ruby/intern.h (rb_exec_arg_init): declaration changed to
return a value.

* process.c (rb_exec_arg_init): return a value.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35967 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-08 16:13:26 +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 ba1c1786d6 add comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-08 13:50:38 +00:00
akr 373a7d1a95 * process.c (rb_fork_err): revert r35955. The condition needs !chfunc
to close ep[0] and ep[1].  The catched exception is re-raised
  immediately after that if status is not NULL.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-08 13:43:48 +00:00
akr c17c8ebb14 * process.c (rb_exec_err): after_exec() call moved from proc_exec_cmd and
proc_exec_sh.
  (rb_proc_exec): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35963 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-08 10:57:10 +00:00
akr 86c82ad647 * process.c (ARGV_COUNT): unused macro removed.
(ARGV_SIZE): ditto.
  (ALLOC_ARGV): ditto.
  (ALLOC_ARGV_WITH_STR): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-08 10:02:00 +00:00
nobu 52c7036436 process.c: child process error state
* process.c (rb_fork_err): error state in the child process is prior
  to exceptions in proc_syswait().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35960 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-08 03:04:42 +00:00
nobu 182dc9d40d process.c, ext/pty/pty.c: status on errors
* process.c (rb_fork_err): determine status on errors.
* ext/pty/pty.c (establishShell): reraise exception if something
  raised during sleep.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-08 02:26:39 +00:00
akr 0d92aac602 * process.c (rb_fork_err): Fix the conditoin to use rb_protect.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-07 13:13:52 +00:00
akr 7e0c93b0c3 fix a comment.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35950 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-06 13:10:54 +00:00
akr 7f83b7e14f remove wrong comments.
earg is processed by surrounding rb_run_exec_options_err call.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35949 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-06 12:34:51 +00:00
akr 3c3b563205 * process.c (proc_exec_cmd) renamed from proc_exec_v.
(proc_exec_sh): renamed from rb_proc_exec_e.
  (proc_spawn_cmd_internal): renamed from proc_spawn_v.
  (proc_spawn_cmd): renamed from proc_spawn_n.
  (proc_spawn_sh): renamed from proc_spawn.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35948 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-06 12:33:28 +00:00
usa ee011f7b1f * process.c (try_with_sh): please take care of the macro defined by
you.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35947 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-06 12:20:58 +00:00
akr aaf6bde978 update async-signal-safe comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35945 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-06 11:58:09 +00:00
akr 70232e400c * process.c (proc_exec_v): don't call dln_find_exe_r here because it
is not async-signal-safe and proc_exec_v is called in a child
  process.
  command_abspath field of rb_exec_arg.
  (rb_exec_fillarg): call dln_find_exe_r and set command_abspath.
  (rb_exec_err): Give the absolute path of the invoking command for
  proc_exec_v, instead of the command name.

* internal.h: add command_abspath field for rb_exec_arg. 



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-06 11:49:30 +00:00
akr 7685837427 * process.c (try_with_sh): take envp argument.
(exec_with_sh): ditto.  use it for execve.
  (proc_exec_v): provide envp for try_with_sh.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-06 11:09:26 +00:00
usa 494d01410f * process.c (rb_run_exec_options_err): allocate a temporary buffer for
run_exec_dup2() for restoring fds on non-fork environments.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35935 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-06 03:39:40 +00:00
akr a4ef2bbdd1 * process.c (rb_exec_fillarg): check use_shell field before accessing
a union field.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35933 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05 20:29:15 +00:00
akr c8d6b6e8fa * process.c (rb_spawn_process): prog variable is not used for Unix.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05 19:59:43 +00:00
akr 0acd09c9e5 update async-signal-safe comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05 15:31:39 +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
akr 71e7935331 update async-signal-safe comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05 14:33:32 +00:00
akr ad5bfed17c * process.c (rb_exec_arg_fixup): allocate a temporary buffer for
run_exec_dup2 here because it should be async-signal-safe.
  (run_exec_dup2): use the temporary buffer.
  (run_exec_dup2_tmpbuf_size): new function.

* include/ruby/intern.h (rb_exec_arg): add dup2_tmpbuf field.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35923 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05 12:59:40 +00:00
akr b1ae6e473e * process.c (strtok): declaration removed because it is not used.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05 10:59:51 +00:00