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

262 Коммитов

Автор SHA1 Сообщение Дата
nobu b45c9f60a3 signal.c: adjust indent of preprocessing directives
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-19 17:34:09 +00:00
nobu 4f07b14190 signal.c: use writev
* signal.c (check_reserved_signal): print messages by writev() if
  available.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-17 05:14:14 +00:00
nobu fb10a2cba5 signal.c: exclude terminators
* signal.c (check_reserved_signal): exclude terminator in literal
  strings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-17 05:14:02 +00:00
nobu b7a0038505 signal.c: get rid of heap corruption
* signal.c (rb_sigaltstack_size): double default size to get rid
  of heap corruption by alternate stack overflow in SEGV handler.
  typically happened at fprintf() in control_frame_dump().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-16 14:17:34 +00:00
nobu 0d88cd9394 signal.c: abort if nesting reserved signal
* signal.c (check_reserved_signal): abort if reserved signal
  received in reserved signal handlers.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-16 08:15:46 +00:00
yugui 1a14a7a1d7 Allow failure of sighandler installation on NativeClient.
* signal.c (install_signalhandler, init_sigchld): allow failure because it
  always fails with ENOSYS on NaCl.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-11 02:12:00 +00:00
nobu 2ebafed88a signal.c: get rid of deadlock by discarded signals
* signal.c (rb_f_kill): get rid of deadlock as unhandled and
  discarded signals do not make interrupt_cond signaled.
  based on the patch by Kazuki Tsujimoto at [ruby-dev:48606].
  [Bug #9820]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-07 14:40:16 +00:00
nobu 998befe8e6 signal.c: send signal unless handled
* signal.c (rb_f_kill): should not ignore signal unless the
  default handler is registered.  [ruby-dev:48592] [Bug #9820]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-06 07:23:06 +00:00
nobu e8bd56f5c3 signal.c: SIGEXIT is not a system signal
* signal.c (trap): SIGEXIT is not a system signal and is dealt
  with internally, so it should not try to register the system
  signal handler by sigaction.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-21 05:10:14 +00:00
nobu ae0299e306 signal.c: raise SystemCallError for all failures
* signal.c (ruby_signal): return SIG_ERR as well as signal(2).

* signal.c (trap): raise SystemCallError for all failures when
  called as a method.

* signal.c (Init_signal): fail by [BUG] only if initialization is
  failed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47660 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-21 02:42:40 +00:00
nobu e41fde8b77 signal.c: EINVAL is a failure
* signal.c (ruby_signal): although "EINVAL from sigaction(2) is
  not a bug", but even it is a failure.  pointed at toRuby/guRuby
  in RubyHiroba.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47657 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-21 02:03:34 +00:00
ko1 0c391a55d3 * gc.c: remvoe ruby_disable_gc_stress and add ruby_disable_gc
to speed-up newobj_of().
* gc.c (ready_to_gc): check ruby_disable_gc.
* signal.c: use ruby_disable_gc.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-09 04:12:14 +00:00
akr 99acd378d8 * signal.c (ruby_signal): Don't set SA_SIGINFO for SIG_IGN and
SIG_DFL.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-05 15:50:24 +00:00
nobu a0dc245f72 signal.c: preserve encoding
* signal.c (rb_f_kill, trap_signm): preserve argument encoding in
  error messages.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-30 14:27:15 +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 95d1b61a14 symbols instead of IDs
* encoding.c (rb_enc_get_index): deal with symbols instead of IDs
  to get rid of inadvertent pin-downs.

* enum.c (chunk_ii): ditto.

* enumerator.c (append_method): ditto.

* iseq.c (iseq_load): ditto.

* marshal.c (w_symbol, r_symlink, r_symreal, r_symbol): ditto.

* signal.c (trap_handler): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-28 08:15:42 +00:00
ko1 239c98553d revert r46834 because it does not pass tests
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-16 10:16:34 +00:00
ko1 01dc0a7104 * vm_core.h: remove rb_vm_t::trap_list[RUBY_NSIG], but add
rb_vm_t::trap_list_cmds (an array) and
  rb_vm_t::trap_list_safes[RUBY_NSIG]
  (separate to two different array).
  This modification reduce root objects.
* signal.c: ditto.
* vm.c (rb_vm_mark): remove marking code for rb_vm_t::trap_list.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-16 09:39:09 +00:00
nobu 876bfc6b4e Init functions don't need ID caches
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-03 03:38:10 +00:00
nobu 2bd9a19895 signal.c: drop dangerous tag
* signal.c (check_stack_overflow): drop the last tag too close to
  the fault page, to get rid of stack overflow deadlock.
  [Bug #9971]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-23 02:11:31 +00:00
nobu 2af4240fbb signal.c: no cfunc frame at stack overflow
* signal.c (check_stack_overflow): avoid pushing a cfunc frame,
  trying to fix stack overflow deadlock.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-22 01:47:14 +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 fad56622f7 signal.c: return proper member
* signal.c (ruby_signal): should return either `old.sa_sigaction`
  or `old.sa_handler`, depending on whether `SA_SIGINFO` is set in
  `old.sa_flags`, because they may not be a union.
  [ruby-core:62836] [Bug #9878]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46233 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-29 14:27:53 +00:00
normal e303785dde signal: remove window for SignalException on IGNORE
* signal.c (signal_exec): ignore immediate cmd for SIG_IGN
* signal.c (trap_handler): set cmd to true for SIG_IGN
* signal.c (trap): handle nil and true values for oldcmd
  [Bug #9835]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-28 00:53:11 +00:00
nobu 2d86890671 signal.c: revert part of r46100
* signal.c (check_stack_overflow): revert part of r46100, the
  previous condition was correct, and fix compilation error on
  other architecture linux.  [ruby-core:62746] [Bug #9862]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-25 11:00:26 +00:00
nobu 82f4c4d4d7 report bug with machine regisiters
* error.c (rb_bug_context): new function to report bug with
  context.
* vm_dump.c (rb_vm_bugreport): accepts `ucontext_t` argument to
  dump machine regisiters.  based on [GH-584].
* signal.c (sigbus, sigsegv): dump machine regisiters if available.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-25 03:46:55 +00:00
nobu 55f7a4b726 signal.c: fix stack overflow check on Mac OS X
* signal.c (check_stack_overflow): fix condition to use ucontext
  register, mcontext_t dereference, and its member names, on Mac
  OS X.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46100 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-25 03:15:32 +00:00
nobu a59ba5073e signal.c: use mcontext_t
* signal.c (check_stack_overflow): use mcontext_t.  the struct tag
  name is not portable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45997 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-18 08:15:16 +00:00
nobu f4f71d6e6b signal.c: check stack overflow by SP
* signal.c (check_stack_overflow): raise SystemStackError if SP
  register and fault address is in the same page or the next, on
  x86 Mac OS X.  [EXPERIMENTAL]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45995 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-18 07:38:54 +00:00
nobu 4f8c0b90bb signal.c: check the next page too
* signal.c (check_stack_overflow): check the next page too.  SP in
  ucontext is not decremented yet when `push` failed, so the fault
  page can be the next.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45924 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-12 01:35:09 +00:00
nobu a3656d4222 signal.c: directly deliver non-handlable signals
* signal.c (rb_f_kill): directly deliver signals which cannot be
  handled, i.e., SIGKILL and SIGSTOP.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-11 01:02:47 +00:00
nobu 77af38d0a5 signal.c: directly enqueue
* signal.c (rb_f_kill): directly enqueue an ignored signal to self,
  except for SIGSEGV and SIGBUS.  [ruby-dev:48203] [Bug #9820]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-10 16:10:32 +00:00
akr 08928bb528 * signal.c (trap): Return "SYSTEM_DEFAULT" if SIG_DFL is set.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45894 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-09 23:48:47 +00:00
nobu b60fbca806 signal.c: if to switch
* signal.c (ruby_signal): turn multiple `if` statements into a
  `switch`.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-09 14:31:27 +00:00
akr f0cbb868e7 * signal.c (check_stack_overflow): Don't use ucontext_t if ucontext.h
is not available.
  Fixes build on Android (x86).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-09 23:16:10 +00:00
nobu c3699626da signal.c: check stack overflow by SP
* signal.c (check_stack_overflow): raise SystemStackError if SP
  register and fault address is in the same page, on x86 linux.
  [EXPERIMENTAL]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-04 08:37:25 +00:00
nobu d14458fb41 signal.c: preserve encoding
* signal.c (esignal_init): preserve encoding in error messages.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45483 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-31 02:34:43 +00:00
nobu cc216f9aae adjust indent and style
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-27 07:10:14 +00:00
nobu a97bb1a2f7 signal.c: static literal string
* signal.c (sigsegv): make message string static to suppress
  unnecessary copy.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-27 13:09:26 +00:00
nobu 24bcd4ce67 signal.c: fault address
* signal.c (sigbus, sigsegv): show fault address in the bug message.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-03 03:18:49 +00:00
usa 1df5ebf450 * eval_intern.h (SAVE_ROOT_JMPBUF): workaround for the failure of
test/ruby/test_exception.rb on Windows.
  wrap by __try and __exception statements on mswin to raise SIGSEGV
  when EXCEPTION_STACK_OVERFLOW is occurred, because MSVCRT doesn't
  handle the exception.
  however, (1) mingw-gcc doesn't support __try and __exception
  statements, and (2) we cannot retry SystemStackError after this
  change yet (maybe crashed) because SEH and longjmp() are too
  uncongenial.

* signal.c (check_stack_overflow, CHECK_STACK_OVERFLOW): now defined on
  Windows, too.

* thread_win32.c (ruby_stack_overflowed_p): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-21 06:33:41 +00:00
nobu 78d0fdcec9 signal.c: adjust indent
* signal.c (ruby_atomic_compare_and_swap): adjust indent.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-26 10:07:11 +00:00
nobu 7f41aa5f09 signal.c: get rid of system name
* signal.c (sighandler_t): get rid of clash with system provided name.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-06 13:52:39 +00:00
nobu e4ef4ddd56 signal.c: adjust style
* signal.c (rb_sigaltstack_size, ruby_abort): adjust style,
  procnames-start-lines.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-12 05:37:04 +00:00
nobu 3048637571 signal.c: suppress a warning
* signal.c (ruby_signal): suppress unused-value warning.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-14 17:43:55 +00:00
nobu 342259a328 signal.c: for valgrind
* signal.c (ruby_signal): suppress valgrind error in
  install_sighandler().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-12 07:37:31 +00:00
usa ccf07bde23 * signal.c: need to include unistd.h for write(2).
unistd.h is now included via ruby/defines.h, but should implicitly
  include here.  (suggested by kosaki)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-14 15:44:14 +00:00
kosaki c0a30fcbf9 * signal.c (rb_f_kill): fixes typo. s/HAS_KILLPG/HAVE_KILLPG/.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40664 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-12 08:41:46 +00:00
hsbt 66aa6aa500 Fixed comment typo by @qqshfox [fix GH-279]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40200 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-09 00:24:24 +00:00