summaryrefslogtreecommitdiff
path: root/signal.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove special handling of `SIGCHLD`. (#7482)Samuel Williams2023-03-091-53/+2
|
* Remove SIGCHLD `waidpid`. (#7476)Samuel Williams2023-03-091-39/+1
| | | | | | | * Remove `waitpid_lock` and related code. * Remove un-necessary test. * Remove `rb_thread_sleep_interruptible` dead code.
* [DOC] [Bug #19290] fix formattingNobuyoshi Nakada2023-01-011-3/+3
|
* Using UNDEF_P macroS-H-GAMELINKS2022-11-161-1/+1
|
* Expand tabs [ci skip]Takashi Kokubun2022-07-211-251/+251
| | | | [Misc #18891]
* Use free instead of xfree to free altstackYusuke Endoh2021-09-061-1/+4
| | | | | | | | | The altstack memory of a thread may be free'ed even after the VM is destructed. After that, GC is no longer available, so calling xfree may lead to a segfault. This changeset uses the bare free function to free the altstack memory instead of xfree. [Bug #18126]
* SIGILL can raise at stack overflow on Linux too [Bug #18084]Nobuyoshi Nakada2021-08-181-1/+1
|
* Rewind execution tags more at stack overflow [Bug #18084]Nobuyoshi Nakada2021-08-181-2/+3
|
* Fix -Wundef warnings for patterns `#if HAVE`Benoit Daloze2021-05-041-1/+1
| | | | | | * See [Feature #17752] * Using this to detect them: git grep -P 'if\s+HAVE' | grep -Pv 'HAVE_LONG_LONG|/ChangeLog|HAVE_TYPEOF'
* Replace "iff" with "if and only if"Gannon McGibbon2021-01-191-1/+1
| | | | | | | iff means if and only if, but readers without that knowledge might assume this to be a spelling mistake. To me, this seems like exclusionary language that is unnecessary. Simply using "if and only if" instead should suffice.
* Signal handler type should be voidNobuyoshi Nakada2020-12-121-7/+7
|
* trap on non-main ractorKoichi Sasada2020-12-121-0/+6
| | | | | trap can accept blopck/Proc and it can violate Rator isolation, so the Proc should be isolatable when trap is used on non-main ractor.
* Introduce Ractor mechanism for parallel executionKoichi Sasada2020-09-031-2/+2
| | | | | | | | | | | | | | | | This commit introduces Ractor mechanism to run Ruby program in parallel. See doc/ractor.md for more details about Ractor. See ticket [Feature #17100] to see the implementation details and discussions. [Feature #17100] This commit does not complete the implementation. You can find many bugs on using Ractor. Also the specification will be changed so that this feature is experimental. You will see a warning when you make the first Ractor with `Ractor.new`. I hope this feature can help programmers from thread-safety issues.
* Share the size for sigaltstack between configure.ac and signal.cNobuyoshi Nakada2020-07-221-2/+4
|
* Fixed a comment, wrong binary prefix [ci skip]Nobuyoshi Nakada2020-07-111-1/+1
|
* add UNREACHABLE_RETURN卜部昌平2020-06-291-0/+1
| | | | | | Not every compilers understand that rb_raise does not return. When a function does not end with a return statement, such compilers can issue warnings. We would better tell them about reachabilities.
* trap_handler: do not goto into a branch卜部昌平2020-06-291-6/+10
| | | | | I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
* signm2signo: do not goto into a branch卜部昌平2020-06-291-18/+19
| | | | | I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
* sed -i 's|ruby/impl|ruby/internal|'卜部昌平2020-05-111-1/+1
| | | | To fix build failures.
* sed -i s|ruby/3|ruby/impl|g卜部昌平2020-05-111-1/+1
| | | | This shall fix compile errors.
* Merge pull request #2991 from shyouhei/ruby.h卜部昌平2020-04-081-1/+1
| | | Split ruby.h
* thread_pthread.c: allocate sigaltstack before pthread_createYusuke Endoh2020-03-061-4/+15
| | | | | | | | | | | | A new (not-initialized-yet) pthread attempts to allocate sigaltstack by using xmalloc. It may cause GC, but because the thread is not initialized yet, ruby_native_thread_p() returns false, which leads to "[FATAL] failed to allocate memory" and exit. In fact, we can observe the error message in the log of OpenBSD CI: https://rubyci.org/logs/rubyci.s3.amazonaws.com/openbsd-current/ruby-master/log/20200306T083005Z.log.html.gz This changeset allocates sigaltstack before pthread is created.
* decouple internal.h headers卜部昌平2019-12-261-23/+21
| | | | | | | | | | | | | | | | | | Saves comitters' daily life by avoid #include-ing everything from internal.h to make each file do so instead. This would significantly speed up incremental builds. We take the following inclusion order in this changeset: 1. "ruby/config.h", where _GNU_SOURCE is defined (must be the very first thing among everything). 2. RUBY_EXTCONF_H if any. 3. Standard C headers, sorted alphabetically. 4. Other system headers, maybe guarded by #ifdef 5. Everything else, sorted alphabetically. Exceptions are those win32-related headers, which tend not be self- containing (headers have inclusion order dependencies).
* Deprecate rb_eval_cmd, add rb_eval_cmd_kwJeremy Evans2019-11-181-1/+1
| | | | | | | | rb_eval_cmd takes a safe level, and now that $SAFE is deprecated, it should be deprecated as well. Replace with rb_eval_cmd_kw, which takes a keyword flag. Switch the two callers to this function.
* Deprecate taint/trust and related methods, and make the methods no-opsJeremy Evans2019-11-181-5/+1
| | | | | | This removes the related tests, and puts the related specs behind version guards. This affects all code in lib, including some libraries that may want to support older versions of Ruby.
* Warn on access/modify of $SAFE, and remove effects of modifying $SAFEJeremy Evans2019-11-181-6/+4
| | | | | | | | | | | | | | | | | This removes the security features added by $SAFE = 1, and warns for access or modification of $SAFE from Ruby-level, as well as warning when calling all public C functions related to $SAFE. This modifies some internal functions that took a safe level argument to no longer take the argument. rb_require_safe now warns, rb_require_string has been added as a version that takes a VALUE and does not warn. One public C function that still takes a safe level argument and that this doesn't warn for is rb_eval_cmd. We may want to consider adding an alternative method that does not take a safe level argument, and warn for rb_eval_cmd.
* Share ruby_sighandler_t definitionNobuyoshi Nakada2019-10-091-5/+0
|
* signal.c: save the original sighandlers for fatal signalsYusuke Endoh2019-10-091-11/+21
| | | | | | | | | | | On Android, a signal handler that is not SIG_DFL is set by default for SIGSEGV. Ruby's install_sighandler inserts Ruby's handler only when the signal has no handler, so it does not insert Ruby's SEGV report handler, which caused some test failures. This changeset forces to install Ruby's handler for some fatal signals (sigbus, sigsegv, and sigill). They keep the original handlers, and call them when the interpreter receives the signals.
* error.c (rb_bug_for_fatal_signal): renamed from rb_bug_contextYusuke Endoh2019-10-091-3/+3
| | | | | | | | | | Just refactoring. The name "rb_bug_context" is completely unclear for me. (Can you see that "context" means "machine register context"?) The context is available only when a fatal signal (sigbus, sigsegv, or sigill) is received; in fact, the function is used only for fatal signals. So, I think the name should be changed.
* signal.c (ruby_abort): move the definition for refactoringYusuke Endoh2019-10-091-18/+17
| | | | | | The three functions for fatal signals, sigbus, sigsegv, and sigill, are a family. The definition of ruby_abort had interrupted them for no reason. This change just moves the definition after the family.
* signal.c: Use MINSIGSTKSZ by casting to intYusuke Endoh2019-10-051-2/+5
| | | | | | | | | | | | | MINSIGSTKSZ is unsigned int in OpenBSD, which makes a warning of comparison: ``` signal.c:535:14: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare] if (size < MINSIGSTKSZ) ~~~~ ^ ~~~~~~~~~~~ 1 warning generated. ``` https://rubyci.org/logs/rubyci.s3.amazonaws.com/openbsd-current/ruby-master/log/20191004T200009Z.log.html.gz
* move docs around [ci skip]卜部昌平2019-08-291-36/+0
| | | | To properly generate documents.
* drop-in type check for rb_define_module_function卜部昌平2019-08-291-2/+2
| | | | | | We can check the function pointer passed to rb_define_module_function like how we do so in rb_define_method. The difference is that this changeset reveales lots of atiry mismatches.
* signal.c: Don't mark ruby_abort as NORETURN on SolarisYusuke Endoh2019-08-271-0/+2
| | | | | | | | | | | to suppress a warning. ``` signal.c: In function 'ruby_abort': signal.c:987:1: warning: 'noreturn' function does return } ^ ```
* Renamed ruby_finalize_{0,1}Nobuyoshi Nakada2019-08-131-2/+1
| | | | And pass rb_execution_context_t as an argument.
* * expand tabs.git2019-08-011-1/+1
|
* signal.c: make signame_prefix a nul-terminated stringYusuke Endoh2019-08-011-3/+3
| | | | | | | | | | | | | | | | gcc 9.1.0 warns this. ``` signal.c:258:46: warning: '%.*s' directive argument is not a nul-terminated string [-Wformat-overflow=] 258 | rb_raise(rb_eArgError, "unsupported signal `%.*s%"PRIsVALUE"'", | ^~~~ 259 | prefix, signame_prefix, vsig); | ~~~~~~~~~~~~~~ signal.c:200:19: note: referenced argument declared here 200 | static const char signame_prefix[3] = "SIG"; | ^~~~~~~~~~~~~~ ``` https://rubyci.org/logs/rubyci.s3.amazonaws.com/ubuntu/ruby-master/log/20190801T033009Z.log.html.gz
* Document acceptance of negative pid in Process.kill [ci skip]Jeremy Evans2019-07-261-2/+3
| | | | Fixes [Bug #13501]
* [DOC] fix markups [ci skip]nobu2019-03-281-9/+8
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Prefer rb_check_arity when 0 or 1 argumentsnobu2018-12-061-1/+1
| | | | | | | Especially over checking argc then calling rb_scan_args just to raise an ArgumentError. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* refactoring debug_counter.ko12018-09-251-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * debug_counter.h: add comments for each counters. * debug_counter.h: add some counters (see added comments for details). * obj_newobj * obj_newobj_slowpath * obj_newobj_wb_unprotected * obj_hash_empty * obj_hash_under4 * obj_hash_ge4 * obj_hash_ge8 * heap_xmalloc * heap_xrealloc * heap_xfree * gc.c: add some debug counters (see the above list). * debug_counter.c (rb_debug_counter_show_results): accept a header message. * signal.c (ruby_default_signal): show debug counter results and malloc info (rb_malloc_info_show_results()) before SIGNAL exit. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64841 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix for old names of mcontext registersnobu2018-09-221-4/+9
| | | | | | c.f. https://github.com/mistydemeo/tigerbrew/issues/473 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * expand tabs.svn2018-09-211-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64807 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Remove -Wno-parentheses flag.nobu2018-09-211-1/+1
| | | | | | | | [Fix GH-1958] From: Jun Aruga <jaruga@redhat.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c: consider non-sigaltstack platformsnobu2018-09-101-0/+5
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64673 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Re-Revert "Temporary revert "process.c: dead code when no SIGCHLD""naruse2018-08-211-1/+5
| | | | | | | This re-reverts commit r64447. The issue was machine side problem. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Temporary revert "process.c: dead code when no SIGCHLD"naruse2018-08-181-5/+1
| | | | | | | This reverts commit r64407. Maybe it breaks http://mswinci.japaneast.cloudapp.azure.com/vc12-x64/ruby-trunk/log/20180817T095734Z.fail.html.gz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* thread.c (sleep_*): reduce the effect of spurious interruptsnormal2018-08-181-4/+7
| | | | | | | | | | | | | Spurious interrupts from SIGCHLD cause Mutex#sleep (via ConditionVariable#wait) to return early and breaks some use cases. Since these are outside the programs's control with MJIT, we will only consider pending interrupts (e.g. those from Thread#run) and signals which cause a Ruby-level Signal.trap handler to fire as "spurious" wakeups. [ruby-core:88537] [Feature #15002] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* process.c: dead code when no SIGCHLDnobu2018-08-171-1/+5
| | | | | | | | | * process.c (ruby_waitpid_all): nothing to do unless SIGCHLD is available. * signal.c (ruby_nocldwait): used only if SIGCHLD is available. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c: no SIGCHLD, no sigchld_hitnobu2018-08-171-1/+9
| | | | | | | * signal.c (sigchld_hit): if SIGCHLD is not available, this variable never sets. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64402 b2dd03c8-39d4-4d8f-98ff-823fe69b080e