* 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
This commit is contained in:
akr 2012-06-09 14:45:46 +00:00
Родитель a1d6532ef6
Коммит d074d0df95
2 изменённых файлов: 26 добавлений и 3 удалений

Просмотреть файл

@ -1,3 +1,14 @@
Sat Jun 9 23:44:29 2012 Tanaka Akira <akr@fsij.org>
* 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.
Sat Jun 9 23:36:53 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* iseq.c (iseq_load, insn_operand_intern, rb_iseq_disasm)

Просмотреть файл

@ -994,7 +994,8 @@ static RETSIGTYPE sig_do_nothing(int sig)
}
#endif
static void before_exec(void)
/* This function should be async-signal-safe. Actually it is. */
static void before_exec_async_signal_safe(void)
{
#ifdef SIGPIPE
/*
@ -1003,9 +1004,12 @@ static void before_exec(void)
* child process interaction might fail. (e.g. ruby -e "system 'yes | ls'")
* [ruby-dev:12261]
*/
saved_sigpipe_handler = signal(SIGPIPE, sig_do_nothing);
saved_sigpipe_handler = signal(SIGPIPE, sig_do_nothing); /* async-signal-safe */
#endif
}
static void before_exec_non_async_signal_safe(void)
{
if (!forked_child) {
/*
* On Mac OS X 10.5.x (Leopard) or earlier, exec() may return ENOTSUPP
@ -1016,6 +1020,12 @@ static void before_exec(void)
}
}
static void before_exec(void)
{
before_exec_non_async_signal_safe();
before_exec_async_signal_safe();
}
static void after_exec(void)
{
rb_thread_reset_timer_thread();
@ -2593,6 +2603,8 @@ rb_exec_async_signal_safe(const struct rb_exec_arg *e, char *errmsg, size_t errm
# define sargp NULL
#endif
before_exec_async_signal_safe(); /* async-signal-safe */
if (rb_run_exec_options_err(e, sargp, errmsg, errmsg_buflen) < 0) { /* hopefully async-signal-safe */
return -1;
}
@ -2618,7 +2630,7 @@ int
rb_exec_err(const struct rb_exec_arg *e, char *errmsg, size_t errmsg_buflen)
{
int ret;
before_exec(); /* async-signal-safe if forked_child is true */
before_exec_non_async_signal_safe(); /* async-signal-safe if forked_child is true */
ret = rb_exec_async_signal_safe(e, errmsg, errmsg_buflen);
preserving_errno(after_exec()); /* not async-signal-safe because after_exec calls rb_thread_start_timer_thread. */
return ret;