aboutsummaryrefslogtreecommitdiffstats
path: root/signal.c
Commit message (Collapse)AuthorAgeFilesLines
* move rb_thread_t::interrupt_flag and maskko12017-11-061-7/+7
| | | | | | | | | | | | | | | | to rb_execution_context_t. * vm_core.h (rb_thread_t): move `rb_thread_t::interrupt_flag` and `rb_thread_t::interrupt_mask` to rb_execution_context_t. RUBY_VM_CHECK_INTS() accepts `ec` instead of `th`. * cont.c (rb_fiber_terminate): to propagate interrupt information, add new parameter `need_interrupt`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* should use `th`.ko12017-10-271-3/+3
| | | | | | | | * signal.c (check_stack_overflow): ruby_stack_overflowed_p() should accept `th`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60475 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* refactoring (rb_|)threadptr_stack_overflow.ko12017-10-271-8/+8
| | | | | | | | | * vm_insnhelper.c (ec_stack_overflow): renamed from threadptr_stack_overflow and also rb_ec_stack_overflow is from rb_threadptr_stack_overflow because they accept `ec` instead of `th`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60464 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* introduce EC_*_TAG() instead of TH_*_TAG()ko12017-10-261-3/+3
| | | | | | | | | | | | | | | | * eval_intern.h: introduce EC_*_TAG() macros instead of TH_*_TAG() macros. * TH_PUSH_TAG() -> EC_PUSH_TAG() * TH_POP_TAG() -> EC_POP_TAG() * TH_TMPPOP_TAG() -> EC_TMPPOP_TAG() * TH_REPUSH_TAG() -> EC_REPUSH_TAG() * TH_EXEC_TAG() -> EC_EXEC_TAG() * TH_JUMP_TAG() -> EC_JUMP_TAG() rb_threadptr_tag_state() , rb_ec_tag_jump() also accept `ec` instead of `th`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Use rb_execution_context_t instead of rb_thread_tko12017-10-261-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | to represent execution context [Feature #14038] * vm_core.h (rb_thread_t): rb_thread_t::ec is now a pointer. There are many code using `th` to represent execution context (such as cfp, VM stack and so on). To access `ec`, they need to use `th->ec->...` (adding one indirection) so that we need to replace them by passing `ec` instead of `th`. * vm_core.h (GET_EC()): introduced to access current ec. Also remove `ruby_current_thread` global variable. * cont.c (rb_context_t): introduce rb_context_t::thread_ptr instead of rb_context_t::thread_value. * cont.c (ec_set_vm_stack): added to update vm_stack explicitly. * cont.c (ec_switch): added to switch ec explicitly. * cont.c (rb_fiber_close): added to terminate fibers explicitly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Drop to support NaCl platform.hsbt2017-10-231-8/+2
| | | | | | | | | | | Because NaCl and PNaCl are already sunset status. see https://bugs.chromium.org/p/chromium/issues/detail?id=239656#c160 configure.ac: Patch for this file was provided by @nobu. [Feature #14041][ruby-core:83497][fix GH-1726] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c: fatal stacknobu2017-08-221-3/+5
| | | | | | | * signal.c (check_stack_overflow): raise fatal when the last tag is in danger zone. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59634 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c: removed raise_stack_overflow:nobu2017-08-221-5/+5
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59633 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_core.h: shrink trap_list sizenobu2017-07-271-10/+10
| | | | | | | * vm_core.h (rb_vm_struct): separate trap_list cmd and safe to each arrays, to shrink the size. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59434 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* move several fields from rb_thread_t to rb_execution_context_t.ko12017-06-261-2/+2
| | | | | | | | * vm_core.h (rb_thread_t): move several fields which are copied at cont.c to rb_execution_context_t. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* use "enum ruby_tag_type" and TAG_NONE.ko12017-06-231-2/+2
| | | | | | | | | | | | | | | Return value of EXEC_TAG() is saved by "int state". Instead of "int", use "enum ruby_tag_type". First EXEC_TAG() value should be 0, so that define TAG_NONE (= 0) and use it. Some code used "status" instead of "state". To make them clear, rename them to state. We can change variable name from "state" to "tag_state", but this ticket doesn't contain it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* remove ruby_kill() introduced for [Bug #7951].ko12017-06-121-1/+1
| | | | | | | | | | | | | | | | | | * thread.c (rbuy_kill): removed. This function is used with SIGSEGV, SIGBUS, SIGKILL, SIGILL, SIGFPE and SIGSTOP and these signals are affect immediately. So that `kill(2)' is enough for them. * signal.c (rb_f_kill): ditto. * vm_core.h (rb_thread_t::interrupt_cond): removed because only `ruby_kill()' uses this field. * test/ruby/test_signal.rb: Without this patch sending SIGSTOP to own process wait another interrupt even if another process sends SIGCONT. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59066 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c: do not disable handlers to dump corenobu2017-06-091-1/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59054 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c: no sigsegv handler with valgrindnobu2017-06-091-7/+9
| | | | | | | * signal.c: disable handling signals to dump core, if installing unreserved signals failed, not valgrind to hang on Mac OS. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c: warn at unresserved signalsnobu2017-06-091-4/+7
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59051 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c: relax installation failurenobu2017-06-081-4/+10
| | | | | | | | | * signal.c (install_sighandler): ignore failure at unreserved signals. e.g., SIGUSR2 fails under valgrind. * signal.c (install_sighandler_fail): refine [BUG] message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* refer flag variables regardless RUBY_DEBUG_ENVnobu2017-05-151-3/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_insnhelper.c: rb_threadptr_stack_overflownobu2017-04-171-2/+2
| | | | | | | * vm_insnhelper.c (rb_threadptr_stack_overflow): move from thread.c and integrate with vm_stackoverflow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58379 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c: last tag page conditionnobu2017-04-151-1/+1
| | | | | | | * signal.c (check_stack_overflow): drop the last tag when it is close to the fault page, not same as sp page. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58363 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c: prefer pthread_sigmasknobu2017-04-151-4/+10
| | | | | | | * signal.c (raise_stack_overflow): prefer pthread_sigmask to sigprocmask, for multithreading. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58361 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c: add sigprocmask guardnobu2017-04-141-0/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c: unblock signalnobu2017-04-141-9/+20
| | | | | | | * signal.c (raise_stack_overflow): unblock the received signal, to receive the same signal again. [ruby-core:79285] [Bug #13164] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58353 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c: improve stack overflow checknobu2016-11-271-1/+11
| | | | | | | | * signal.c (check_stack_overflow): [EXPERIMENTAL] consider the segfault a stack overflow when the fault address is between SP and BP. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Update Signal.signame doc [ci-skip]nobu2016-09-281-2/+3
| | | | | | | * signal.c (sig_signame): [DOC] Add documentation in the case of return nil. [Fix GH-1449] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* replace fixnum by integer in documents.akr2016-09-081-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* use TH_JUMP_TAGnobu2016-05-051-1/+1
| | | | | | | | * vm_eval.c (rb_eval_cmd, rb_catch_obj): use TH_JUMP_TAG with the same rb_thread_t used for TH_PUSH_TAG, instead of JUMP_TAG with the current thread global variable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Signal.list deduplicates keysnormal2016-01-261-1/+1
| | | | | | | | | | This allows us to reuse string objects used in symbols as well as any string representations of signal names in source code. * signal.c (sig_list): use fstring for hash key * test/ruby/test_signal.rb (test_signal_list_dedupe_keys): added git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53657 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c: reserved signalsnobu2016-01-261-0/+6
| | | | | | | * signal.c (rb_f_kill): should immediately deliver reserved signals SIGILL and SIGFPE, ont only SIGSEGV and SIGBUS. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Drop support for BeOSnobu2015-11-241-4/+0
| | | | | | | * beos: Drop support for BeOS now that Haiku is stable. [Fix GH-1112] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52731 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Haiku now best effort supportnobu2015-11-231-2/+10
| | | | | | | | | | * configure.in: remove obsolete workarounds for Haiku. * dln.c, file.c, io.c: remove obsolete Haiku workarounds. * thread_pthread.c: add stack bounds detection for Haiku. * signal.c: get stack pointer from signal context on Haiku. [ruby-core:67923] [Bug #10811] [Fix GH-1109] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * signal.c: should also clear ruby_disable_gc.ko12015-11-191-1/+1
| | | | | | | | | [Bug #11692] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52668 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* revert r31760 and r31761nobu2015-07-261-3/+3
| | | | | | | seems that rb_bug_errno() is called in sigpipe() intentionally. https://gist.github.com/sorah/831169 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51390 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c: discard SIGSYSnobu2015-07-261-0/+15
| | | | | | | * signal.c (default_handler, Init_signal): discard SIGSYS, ENOSYS should raise a SystemCallError always instead. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51389 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c (trap_handler): cleanup to use RSTRING_GETMEM + memcmpnormal2015-07-171-7/+10
| | | | | | | | | | | | | strncmp is unnecessary since the switch/case statement already checks length of the string; so use memcmp. This makes for a small reduction in binary size on 32-bit x86: text data bss dec hex filename 2847473 12360 30632 2890465 2c1ae1 ruby.before 2847313 12328 30632 2890273 2c1a21 ruby.after git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h: $SAFE=2 is now obsolete.hsbt2015-06-181-2/+0
| | | | | | | | | | * dir.c, ext/fiddle/handle.c, ext/socket/basicsocket.c, file.c gc.c, io.c, process.c, safe.c, signal.c, win32/file.c: removed code for $SAFE=2 * test/erb/test_erb.rb, test/fiddle/test_handle.rb test/ruby/test_env.rb: removed tests for $SAFE=2. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c: nil for invalid signumnobu2015-03-021-0/+1
| | | | | | | * signal.c (sig_signame): return nil if the argument is a valid signal number. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49801 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c: preserve errnonormal2015-02-251-0/+4
| | | | | | | | * signal.c (sighandler): preserve errno Patch by Steven Stewart-Gallus <sstewartgallus00@mylangara.bc.ca> [ruby-core:68172] [Bug #10866] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* eval.c: static IDsnobu2015-02-231-2/+5
| | | | | | | * eval.c (ruby_static_id_signo, ruby_static_id_status): add static IDs, signo and status. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c: SIGBUS by stack overflow on Funtoonobu2015-02-011-1/+2
| | | | | | | * signal.c (sigbus): seems that Funtoo Linux also delivers SIGBUS at stack overflow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c: fix received_signalnobu2014-12-221-3/+8
| | | | | | | * signal.c (received_signal): fix condition to define. [ruby-core:67032] [Bug #10629] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c: clear received signal at stack overflownobu2014-12-211-2/+4
| | | | | | | * signal.c (check_stack_overflow): clear the received reserved signal before raising stack overflow but not aborting. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48910 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * signal.c (ruby_signal): since SIGKILL is not supported by MSVCRT,usa2014-12-181-0/+11
| | | | | | | | should be treated before calling signal(2). [Bug #10615] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c: include ucontext.hnobu2014-12-131-0/+3
| | | | | | * signal.c: include ucontext.h for ucontext_t. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c: stack overflow on FreeBSDnobu2014-12-131-1/+9
| | | | | | | * signal.c (check_stack_overflow): check sp also on i386/x86_64 FreeBSD. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* configure.in: rb_cv_mcontext_t_ptrnobu2014-12-131-2/+1
| | | | | | | * configure.in (rb_cv_mcontext_t_ptr): abstract whether mcontext_t is a pointer type. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h: Gather declarations in non-header files.akr2014-11-181-2/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h: Include ruby.h and ruby/encoding.h to beakr2014-11-151-2/+1
| | | | | | | | includable without prior inclusion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c: signal list to killnobu2014-11-101-0/+2
| | | | | | | * signal.c (rb_f_kill): [DOC] mention known signal list. [ruby-core:66162] [Bug #10492] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c: avoid repeated disable/enable interruptnormal2014-10-281-5/+5
| | | | | | | | | | | | | | | | | | | | | | | We only install system-level signal handlers during init (before any threads or user code is running), so there's no need to repeatedly enable/disable the interrupts at that time. We also do not change system-level sig handlers once user-level code is running. This saves about 20 syscalls at startup and makes the executable smaller (numbers from 32-bit x86): text data bss dec hex filename before: 2815726 12100 30552 2858378 2b9d8a ruby after: 2815022 12100 30552 2857674 2b9aca ruby * signal.c (install_sighandler): remove rb_disable_interrupt and rb_enable_interrupt calls (init_sigchld): ditto (Init_signal): disable and enable interrupt once around all install_sighandler and init_sigchld to reduce syscalls at start [Feature #9345] [ruby-core:59480] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48178 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * signal.c (check_reserved_signal_): fix write count since r47991.kazu2014-10-241-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e