test_signal.rb: test iff SIGQUIT is supported

* test/ruby/test_signal.rb (test_trap_system_default): test only
  if SIGQUIT is supported, which is platform dependent.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
thread_pthread.c: variable for errno

* thread_pthread.c (timer_thread_sleep): use a local variable for
  errno.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
thread.c: stop if forked in a sub-thread

* thread.c (thread_start_func_2): stop if forked in a sub-thread,
  the thread has become the main thread.
  [ruby-core:62070] [Bug #9751]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45899 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
process.c: use ruby_stop

* process.c (rb_exit): call ruby_stop() which calls ruby_cleanup(),
  instead of calling ruby_finalize() directly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45900 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
envutil.rb: successfully terminated process

* test/ruby/envutil.rb (FailDesc): allow successfully terminated
  process without a signal.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45901 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
envutil.rb: rubybin: keyword

* test/ruby/envutil.rb (invoke_ruby): add rubybin: keyword option
  to specify the command to run scripts.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45902 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
test_io_console.rb: show failure details

* test/io/console/test_io_console.rb (test_noctty): use
  `assert_ruby_status` to show failure details.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
dir.c: match in UTF-8

* dir.c (push_glob): match in UTF-8 on Mac OS X.
  [ruby-dev:48213] [Bug #9825]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
thread_pthread.c: compare with pthread_equal

* thread_pthread.c (ubf_select): compare thread_id with
  pthread_equal() but not directly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45906 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
thread_pthread.c: timer_thread_pipe struct

* thread_pthread.c (timer_thread_pipe): aggregate timer thread
  pipe stuff into a struct.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
thread_pthread.c: variable for errno

* thread_pthread.c (rb_thread_wakeup_timer_thread_fd): use a local
  variable for errno.

* thread_pthread.c (consume_communication_pipe): ditto.  add
  EWOULDBLOCK case.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* 2014-05-11

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45910 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
signal.c: directly enqueue

* 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
thread.c: always deliver signal immediately

* thread.c (ruby_kill): always deliver signal immediately, without
  check for main thread.  no longer called in other context.
  [ruby-dev:48203] [Bug #9820]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
vm*: doubly-linked list from ccan to manage vm->living_threads

A doubly-linked list for tracking living threads guarantees
constant-time insert/delete performance with no corner cases of a
hash table.  I chose this ccan implementation of doubly-linked
lists over the BSD sys/queue.h implementation since:

1) insertion and removal are both branchless
2) locality is improved if a struct may be a member of multiple lists
   (0002 patch in Feature 9632 will introduce a secondary list
   for waiting FDs)

This also increases cache locality during iteration: improving
performance in a new IO#close benchmark with many sleeping threads
while still scanning the same number of threads.

	vm_thread_close 1.762

* vm_core.h (rb_vm_t): list_head and counter for living_threads
  (rb_thread_t): vmlt_node for living_threads linkage
  (rb_vm_living_threads_init): new function wrapper
  (rb_vm_living_threads_insert): ditto
  (rb_vm_living_threads_remove): ditto
* vm.c (rb_vm_living_threads_foreach): new function wrapper
* thread.c (terminate_i, thread_start_func_2, thread_create_core,
  thread_fd_close_i, thread_fd_close): update to use new APIs
* vm.c (vm_mark_each_thread_func, rb_vm_mark, ruby_vm_destruct,
  vm_memsize, vm_init2, Init_VM): ditto
* vm_trace.c (clear_trace_func_i, rb_clear_trace_func): ditto
* benchmark/bm_vm_thread_close.rb: added to show improvement
* ccan/build_assert/build_assert.h: added as a dependency of list.h
* ccan/check_type/check_type.h: ditto
* ccan/container_of/container_of.h: ditto
* ccan/licenses/BSD-MIT: ditto
* ccan/licenses/CC0: ditto
* ccan/str/str.h: ditto (stripped of unused macros)
* ccan/list/list.h: ditto
* common.mk: add CCAN_LIST_INCLUDES
  [ruby-core:61871][Feature 9632 (part 1)]

Apologies for the size of this commit, but I think a good
doubly-linked list will be useful for future features, too.
This may be used to add ordering to a container_of-based hash
table to preserve compatibility if required (e.g. feature 9614).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* properties.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
vm.c: suppress a warning

* vm.c (rb_vm_living_threads_foreach): suppress "uninitialized"
  warning where "typeof" is unavailable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45915 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
configure.in: check typeof

* configure.in (rb_cv_typeof): check typeof extension for ccan
  headers.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
signal.c: directly deliver non-handlable signals

* 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
test_process.rb: WIFEXITED and so on are system dependent

* test/ruby/test_process.rb (test_status_kill): WIFEXITED and so
  on are available only if signal is supported by the system.
  [ruby-dev:48203] [Bug #9820]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e