summaryrefslogtreecommitdiff
path: root/signal.c
AgeCommit message (Collapse)Author
2014-05-18signal.c: use mcontext_tnobu
* 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-18signal.c: check stack overflow by SPnobu
* 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-12signal.c: check the next page toonobu
* 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-11signal.c: directly deliver non-handlable signalsnobu
* 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-10signal.c: directly enqueuenobu
* 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-09* signal.c (trap): Return "SYSTEM_DEFAULT" if SIG_DFL is set.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45894 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-09signal.c: if to switchnobu
* 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-04-09* signal.c (check_stack_overflow): Don't use ucontext_t if ucontext.hakr
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-04signal.c: check stack overflow by SPnobu
* 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-03-31signal.c: preserve encodingnobu
* 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-02-27adjust indent and stylenobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-27signal.c: static literal stringnobu
* 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
2013-12-03signal.c: fault addressnobu
* 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-11-21* eval_intern.h (SAVE_ROOT_JMPBUF): workaround for the failure ofusa
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-10-26signal.c: adjust indentnobu
* 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-06signal.c: get rid of system namenobu
* 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-09-12signal.c: adjust stylenobu
* 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-07-14signal.c: suppress a warningnobu
* 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-12signal.c: for valgrindnobu
* 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-05-14* signal.c: need to include unistd.h for write(2).usa
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-12* signal.c (rb_f_kill): fixes typo. s/HAS_KILLPG/HAVE_KILLPG/.kosaki
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40664 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-09Fixed comment typo by @qqshfox [fix GH-279]hsbt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40200 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-25envutil.rb: signal in Process::Statusnobu
* test/ruby/envutil.rb (assert_ruby_status): show status info. * test/ruby/envutil.rb (Test::Unit::Assertions::FailDesc): use Signal.signame for consistency with Process::Status#inspect. * signal.c (siglist): prefer SIGABRT over SIGIOT in Signal.signame. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39924 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-19* internal.h: added a declaration of ruby_kill().kosaki
* thread.c (ruby_kill): helper function of kill(). * signal.c (rb_f_kill): use ruby_kill() instead of kill(). * signal.c (rb_f_kill): call rb_thread_execute_interrupts() to ensure that make SignalException if sent a signal to myself. [Bug #7951] [ruby-core:52864] * vm_core.h (typedef struct rb_thread_struct): added th->interrupt_cond. * thread.c (rb_threadptr_interrupt_common): added to initialization of th->interrupt_cond. * thread.c (thread_create_core): ditto. * test/ruby/test_signal.rb (TestSignal#test_hup_me): test for the above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39819 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-24signal.c: fix typenobu
* signal.c (sigsegv): type of write(2) is ssize_t. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-24* signal.c (sigsegv): suppress unused result warning. Becausekosaki
write(2) is marked __warn_unused_result__ on Linux glibc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39445 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-22* signal.c (ruby_abort): fix typo in r39354 [Bug #5014]ngoto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-21signal.c: extract check_stack_overflownobu
* signal.c (check_stack_overflow): extract duplicated code and get rid of declaration-after-statement. [Bug #5014] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-21* signal.c (sigsegv): avoid to use async signal unsafe functionskosaki
when nested sigsegv is happen. [Bug #5014] [ruby-dev:44082] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-23* thread.c: rename methods:ko1
from Thread.async_interrupt_timing to Thread.handle_interrupt, from Thread.async_interrupted? to Thread.pending_interrupt?. Also rename option from `defer' to `never'. [ruby-core:51074] [ruby-trunk - Feature #6762] * vm_core.c, thread.c: rename functions and data structure `async_errinfo' to `pending_interrupt'. * thread.c: add global variables sym_immediate, sym_on_blocking and sym_never. * cont.c, process.c, vm.c, signal.c: ditto. * lib/sync.rb, lib/thread.rb: catch up this renaming. * test/ruby/test_thread.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-15* signal.c (rb_sigaltstack_size): cast sysconf() return valuekosaki
explicitly. Fix compile error on Mac OS X. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-15* signal.c (default_handler): remove rb_register_sigaltstack()kosaki
call. sigaltstack was already registered when creating threads. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38410 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-15* signal.c (rb_sigaltstack_size): new. calculate stack size forkosaki
sigsegv handler. enlarge value when x86 or x86_64 on Linux. Linux has very small MINSIGSTKSZ size (2048 bytes) and our sigsegv routine need 5KiB at least. [Bug #7141] * internal.h: add declaration of rb_sigaltstack_size(). * vm_core.h: remove ALT_STACK_SIZE definition. * signal.c (rb_register_sigaltstack): replace ALT_STACK_SIZE with rb_sigaltstack_size(); * gc.c (Init_heap): ditto. * vm.c (th_init): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-14* signal.c (rb_f_kill): remove rb_thread_polling() because thiskosaki
has no good effect and makes meaningless 100ms delay. 1) when sending signal to another process, waiting has just silly. 2) when sending signal to current process, 100ms is often not enough time to wait. It depend on kernel behavior. And, rb_thread_polling() doesn't make sense anyway. When rb_thread_alone() is true, it doesn't wait at all and Process.kill() users don't expect threading changes Process.kill() behavior. [Bug #7560] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-01adjust style.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-27* ruby_atomic.h (ATOMIC_CAS): added for Solaris and other platforms.ngoto
* ruby_atomic.h, signal.c (NEED_RUBY_ATOMIC_OPS): renamed from NEED_RUBY_ATOMIC_EXCHANGE. * signal.c (ruby_atomic_compare_and_swap): naive, non-atomic compare-and-swap implementation only used for platforms without valid support for atomic operations. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-26* vm_core.h (RUBY_VM_SET_TIMER_INTERRUPT, RUBY_VM_SET_INTERRUPT)kosaki
(RUBY_VM_SET_FINALIZER_INTERRUPT, RUBY_VM_SET_TRAP_INTERRUPT) (RUBY_VM_INTERRUPTED): use enum symbol instead of immediate value. * thread.c (thread_join_m, rb_threadptr_execute_interrupts): ditto. * signal.c (signal_exec): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37864 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-26* thread.c (thread_join_m): use th->interrupt_mask instead ofkosaki
th->in_trap. * vm_core.h (struct rb_thread_struct): remove in_trap member. * signal.c (signal_exec): ditto. * thread.c (thread_create_core): ditto. * thread.c (Init_Thread): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-26* ruby_atomic.h (ATOMIC_CAS): new macro for compare-and-exchange.kosaki
* vm_core.h (struct rb_thread_struct): add interrupt_mask member. * thread.c (thread_create_core, Init_Thread): initialize th->thread_mask. * vm_core.h (RUBY_VM_INTERRUPTED_ANY): new macro for avoiding bare th->interrupt_flag. * vm_core.h (RUBY_VM_INTERRUPTED, RUBY_VM_INTERRUPTED): check th->interrupt_mask. * thread.c (set_unblock_function, rb_thread_schedule): replace th->interrupt_flag with RUBY_VM_INTERRUPTED_ANY() * signal.c (signal_exec): set up thread->interrupt_mask for preventing recursive trap handler. * vm_core.h (RUBY_VM_CHECK_INTS, RUBY_VM_CHECK_INTS_BLOCKING): ditto. * thread.c (rb_threadptr_execute_interrupts): don't process interrupt if it is masked. [Bug #6009] [ruby-core:42524] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-26* signal.c (signal_exec): add volatile to make sure setjmp safe.kosaki
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37857 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-26* signal.c (signal_exec): suppress "warning: variable 'signum'kosaki
might be clobbered by 'longjmp' or 'vfork'" warning. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37856 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-26* vm_core.h (rb_thread_struct): added 'in_trap' member for markingkosaki
running trap handler. * signal.c (signal_exec): turn on in_trap when running trap. * thread.c (Init_Thread, thread_create_core): initialize in_trap when creating new threads. * thread.c (thread_join_m): raise ThreadError when running trap handler.Bug [#6416][ruby-core:44956] * test/ruby/test_thread.rb (test_thread_join_in_trap): new test for the above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-19* signal.c (rb_get_next_signal): removed pointless signalkosaki
disabling. pthread_sigmask() only changes current thread mask. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-19* signal.c (install_sighandler): added comments why we needkosaki
rb_disable_interrupt(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37726 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-19* signal.c (rb_disable_interrupt, rb_enable_interrupt): removedkosaki
USE_TRAP_MASK. * signal.c (trap_arg, trap_ensure): removed. * signal.c (trap, sig_trap): removed pointless signal disabling. We don't need it bacause we no longer run trap hander on signal hander context. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-19* signal.c (sig_signame): implements Signal.signame methodkosaki
[Feature #5613] * test/ruby/test_signal.rb (test_signame): adds test for above * NEWS: add an item about above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-09* ruby_atomic.h: renamed from atomic.h to avoid header file name conflictngoto
on Solaris 10. [ruby-dev:46414] [Bug #7287] * gc.c, signal.c, vm_core.h, common.mk: reflect the rename from atomic.h to ruby_atomic.h. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-13* signal.c (rb_f_kill):zzak
Update documentation for Process.kill to reflect kill(2) Patch by Richo Healey git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-23* configure.in: Fixing Haiku build.naruse
- -lbe is not required for linking - stack protector doesn't work for now because of the default gcc's bug by Takashi Toyoshima <toyoshim@gmail.com> https://github.com/ruby/ruby/pull/167 * signal.c (ruby_signal): haiku doesn't have SIGBUS. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-09* dln.c: Simplify and make consistent an ifdef for Mac OS X.kosaki
* 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