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

286 Коммитов

Автор SHA1 Сообщение Дата
normal 667c0a3a8c Signal.list deduplicates keys
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
2016-01-26 05:33:28 +00:00
nobu a52be8fb8f signal.c: reserved signals
* 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
2016-01-26 04:09:31 +00:00
nobu 13a935b0ba Drop support for BeOS
* 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
2015-11-24 00:17:11 +00:00
nobu e29c109d2a Haiku now best effort support
* 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
2015-11-23 03:54:42 +00:00
ko1 95273072a7 * signal.c: should also clear ruby_disable_gc.
[Bug #11692]




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52668 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-19 06:54:35 +00:00
nobu 46b39cb0ba revert r31760 and r31761
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
2015-07-26 05:37:59 +00:00
nobu 38e62df9f6 signal.c: discard SIGSYS
* 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
2015-07-26 02:29:03 +00:00
normal a3dca0f594 signal.c (trap_handler): cleanup to use RSTRING_GETMEM + memcmp
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
2015-07-17 22:08:49 +00:00
hsbt 5d6ca9e950 * include/ruby/ruby.h: $SAFE=2 is now obsolete.
* 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
2015-06-18 14:21:03 +00:00
nobu 76d1d5269f signal.c: nil for invalid signum
* 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
2015-03-02 04:04:30 +00:00
normal be5b7f6130 signal.c: preserve errno
* 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
2015-02-25 09:17:17 +00:00
nobu 0d20fbe3bd eval.c: static IDs
* 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
2015-02-23 07:05:30 +00:00
nobu 0f7bd5738b signal.c: SIGBUS by stack overflow on Funtoo
* 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
2015-02-01 00:29:02 +00:00
nobu 1634ac4d64 signal.c: fix received_signal
* 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
2014-12-22 05:08:34 +00:00
nobu d33830308f signal.c: clear received signal at stack overflow
* 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
2014-12-21 02:35:44 +00:00
usa 42496f2f33 * signal.c (ruby_signal): since SIGKILL is not supported by MSVCRT,
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
2014-12-18 05:26:57 +00:00
nobu 554da7feee signal.c: include ucontext.h
* 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
2014-12-13 21:31:31 +00:00
nobu 02e8b4d9a8 signal.c: stack overflow on FreeBSD
* 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
2014-12-13 09:01:59 +00:00
nobu 7dc4bbc140 configure.in: rb_cv_mcontext_t_ptr
* 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
2014-12-13 08:59:54 +00:00
akr 2b9191e557 * internal.h: Gather declarations in non-header files.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-18 15:13:05 +00:00
akr 7cd76ab0c5 * internal.h: Include ruby.h and ruby/encoding.h to be
includable without prior inclusion.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-15 11:49:06 +00:00
nobu eae536ec3a signal.c: signal list to kill
* 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
2014-11-10 07:09:45 +00:00
normal cbb79f0472 signal.c: avoid repeated disable/enable interrupt
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
2014-10-28 18:39:45 +00:00
kazu a5e1dbf7c8 * signal.c (check_reserved_signal_): fix write count since r47991.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-24 11:44:01 +00:00
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