aboutsummaryrefslogtreecommitdiffstats
path: root/signal.c
Commit message (Collapse)AuthorAgeFilesLines
* Init functions don't need ID cachesnobu2014-07-031-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c: drop dangerous tagnobu2014-06-231-0/+6
| | | | | | | | * 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
* signal.c: no cfunc frame at stack overflownobu2014-06-221-2/+3
| | | | | | | * 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
* constify parametersnobu2014-06-181-1/+1
| | | | | | | | * 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
* signal.c: return proper membernobu2014-05-291-1/+4
| | | | | | | | | * 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
* signal: remove window for SignalException on IGNOREnormal2014-05-281-1/+13
| | | | | | | | | * 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
* signal.c: revert part of r46100nobu2014-05-251-1/+1
| | | | | | | | * 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
* report bug with machine regisitersnobu2014-05-251-2/+4
| | | | | | | | | | * 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
* signal.c: fix stack overflow check on Mac OS Xnobu2014-05-251-4/+5
| | | | | | | | * 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
* signal.c: use mcontext_tnobu2014-05-181-1/+1
| | | | | | | * 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
* signal.c: check stack overflow by SPnobu2014-05-181-5/+17
| | | | | | | | * 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
* signal.c: check the next page toonobu2014-05-121-2/+10
| | | | | | | | * 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
* signal.c: directly deliver non-handlable signalsnobu2014-05-111-0/+6
| | | | | | | * 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
* signal.c: directly enqueuenobu2014-05-101-3/+57
| | | | | | | * 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
* * signal.c (trap): Return "SYSTEM_DEFAULT" if SIG_DFL is set.akr2014-05-091-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45894 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c: if to switchnobu2014-05-091-5/+9
| | | | | | | * 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
* * signal.c (check_stack_overflow): Don't use ucontext_t if ucontext.hakr2014-04-091-2/+2
| | | | | | | | | 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
* signal.c: check stack overflow by SPnobu2014-04-041-2/+22
| | | | | | | | * 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
* signal.c: preserve encodingnobu2014-03-311-4/+11
| | | | | | * 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
* adjust indent and stylenobu2014-02-271-1/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c: static literal stringnobu2014-01-271-1/+1
| | | | | | | * 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
* signal.c: fault addressnobu2013-12-031-3/+8
| | | | | | * 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
* * eval_intern.h (SAVE_ROOT_JMPBUF): workaround for the failure ofusa2013-11-211-1/+5
| | | | | | | | | | | | | | | | | | | 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
* signal.c: adjust indentnobu2013-10-261-1/+1
| | | | | | * 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
* signal.c: get rid of system namenobu2013-10-061-0/+2
| | | | | | * 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
* signal.c: adjust stylenobu2013-09-121-2/+4
| | | | | | | * 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
* signal.c: suppress a warningnobu2013-07-141-1/+1
| | | | | | * 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
* signal.c: for valgrindnobu2013-07-121-0/+14
| | | | | | | * 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
* * signal.c: need to include unistd.h for write(2).usa2013-05-141-0/+3
| | | | | | | | 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
* * signal.c (rb_f_kill): fixes typo. s/HAS_KILLPG/HAVE_KILLPG/.kosaki2013-05-121-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40664 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fixed comment typo by @qqshfox [fix GH-279]hsbt2013-04-091-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40200 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* envutil.rb: signal in Process::Statusnobu2013-03-251-3/+3
| | | | | | | | | | | * 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
* * internal.h: added a declaration of ruby_kill().kosaki2013-03-191-2/+4
| | | | | | | | | | | | | | | | | | | | * 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
* signal.c: fix typenobu2013-02-241-1/+1
| | | | | | * 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
* * signal.c (sigsegv): suppress unused result warning. Becausekosaki2013-02-241-1/+3
| | | | | | 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
* * signal.c (ruby_abort): fix typo in r39354 [Bug #5014]ngoto2013-02-221-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c: extract check_stack_overflownobu2013-02-211-15/+20
| | | | | | | * 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
* * signal.c (sigsegv): avoid to use async signal unsafe functionskosaki2013-02-211-10/+25
| | | | | | | 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
* * thread.c: rename methods:ko12012-12-231-1/+1
| | | | | | | | | | | | | | | | | | 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
* * signal.c (rb_sigaltstack_size): cast sysconf() return valuekosaki2012-12-151-1/+1
| | | | | | 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
* * signal.c (default_handler): remove rb_register_sigaltstack()kosaki2012-12-151-3/+0
| | | | | | 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
* * signal.c (rb_sigaltstack_size): new. calculate stack size forkosaki2012-12-151-1/+22
| | | | | | | | | | | | | | | 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
* * signal.c (rb_f_kill): remove rb_thread_polling() because thiskosaki2012-12-141-1/+0
| | | | | | | | | | | | 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
* adjust style.nobu2012-12-011-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ruby_atomic.h (ATOMIC_CAS): added for Solaris and other platforms.ngoto2012-11-271-1/+12
| | | | | | | | | | | * 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
* * vm_core.h (RUBY_VM_SET_TIMER_INTERRUPT, RUBY_VM_SET_INTERRUPT)kosaki2012-11-261-1/+1
| | | | | | | | | (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
* * thread.c (thread_join_m): use th->interrupt_mask instead ofkosaki2012-11-261-3/+0
| | | | | | | | | | | 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
* * ruby_atomic.h (ATOMIC_CAS): new macro for compare-and-exchange.kosaki2012-11-261-0/+3
| | | | | | | | | | | | | | | | | | | | | | | * 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
* * signal.c (signal_exec): add volatile to make sure setjmp safe.kosaki2012-11-261-1/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37857 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * signal.c (signal_exec): suppress "warning: variable 'signum'kosaki2012-11-261-1/+1
| | | | | | 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