1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/ext
normal 054a412d54 hijack SIGCHLD handler for internal use
Use a global SIGCHLD handler to guard all callers of rb_waitpid.
To work safely with multi-threaded programs, we introduce a
VM-wide waitpid_lock to be acquired BEFORE fork/vfork spawns the
process.  This is to be combined with the new ruby_waitpid_locked
function used by mjit.c in a non-Ruby thread.

Ruby-level SIGCHLD handlers registered with Signal.trap(:CHLD)
continues to work as before and there should be no regressions
in any existing use cases.

Splitting the wait queues for PID > 0 and groups (PID <= 0)
ensures we favor PID > 0 callers.

The disabling of SIGCHLD in rb_f_system is longer necessary,
as we use deferred signal handling and no longer make ANY
blocking waitpid syscalls in other threads which could "beat"
the waitpid call made by rb_f_system.

We prevent SIGCHLD from firing in normal Ruby Threads and only
enable it in the timer-thread, to prevent spurious wakeups
from in test/-ext-/gvl/test_last_thread.rb with MJIT enabled.

I've tried to guard as much of the code for RUBY_SIGCHLD==0
using C "if" statements rather than CPP "#if" so to reduce
the likelyhood of portability problems as the compiler will
see more code.

We also work to suppress false-positives from
Process.wait(-1, Process::WNOHANG) to quiets warnings from
spec/ruby/core/process/wait2_spec.rb with MJIT enabled.

Lastly, we must implement rb_grantpt for ext/pty.  We need a
MJIT-compatible way of supporting grantpt(3) which may spawn
the `pt_chown' binary and call waitpid(2) on it.

[ruby-core:87605] [Ruby trunk Bug#14867]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-27 03:14:30 +00:00
..
-test- Define AST module under RubyVM [experimental] 2018-05-31 06:13:06 +00:00
bigdecimal bigdecimal.c: fix missing argument 2018-03-26 00:25:16 +00:00
cgi/escape Revert "ext/cgi/escape: preserve String subclass in result" 2018-05-03 01:24:09 +00:00
continuation Update dependencies 2016-07-06 05:48:13 +00:00
coverage update dependencies 2018-01-09 06:55:55 +00:00
date Removed useless assertions [ci skip] 2018-03-09 03:51:04 +00:00
dbm marked as NORETURN 2018-01-18 11:34:36 +00:00
digest no ID cache in Init functions 2018-02-16 08:39:48 +00:00
etc Merge etc gemspec from github repository. 2018-05-28 00:42:32 +00:00
fcntl Bump version to fcntl-1.0.0 as default gems. 2017-12-11 06:03:53 +00:00
fiber Update dependencies 2016-07-06 05:48:13 +00:00
fiddle fiddle/import.rb: suppress warning 2018-04-19 23:35:39 +00:00
gdbm marked as NORETURN 2018-01-18 11:34:36 +00:00
io io/console: drop 2.1.0 support [ci skip] 2018-03-02 11:24:29 +00:00
json no ID cache in Init functions 2018-02-16 08:39:48 +00:00
nkf ext: check if null byte is contained 2017-09-30 08:35:23 +00:00
objspace Rename imemo_alloc with imemo_tmpbuf 2018-05-09 07:11:59 +00:00
openssl openssl_missing.h: constified 2018-06-17 10:17:39 +00:00
pathname Improve Pathname performance 2018-03-13 09:15:10 +00:00
psych Merge Pysch 3.0.3.pre1. 2018-04-28 01:47:58 +00:00
pty hijack SIGCHLD handler for internal use 2018-06-27 03:14:30 +00:00
racc/cparse Update dependencies 2016-07-06 05:48:13 +00:00
rbconfig/sizeof configure.ac 2017-09-29 13:21:17 +00:00
readline no ID cache in Init functions 2018-02-16 08:39:48 +00:00
ripper Remove flip-flop usages from build scripts 2018-06-15 08:53:17 +00:00
rubyvm get rid of test failures introduced at r56848 2016-11-20 06:19:05 +00:00
sdbm marked as NORETURN 2018-01-18 11:34:36 +00:00
socket comma at the end of enum is a C99ism 2018-06-25 03:14:48 +00:00
stringio no ID cache in Init functions 2018-02-16 08:39:48 +00:00
strscan no ID cache in Init functions 2018-02-16 08:39:48 +00:00
syslog no ID cache in Init functions 2018-02-16 08:39:48 +00:00
win32 Win32API.rb: use uplevel option to warn 2018-04-02 12:39:01 +00:00
win32ole ext/win32ole/win32ole.c: fix typo. [ci skip] 2018-03-10 06:46:01 +00:00
zlib no ID cache in Init functions 2018-02-16 08:39:48 +00:00
.document ext/.document: follow-up r59734 2017-09-03 13:31:34 +00:00
extmk.rb extmk.rb: get rid of shadowing outer local variable 2018-03-25 01:52:22 +00:00
Setup Removed deprecated extensions of mathn. 2017-04-20 08:21:24 +00:00
Setup.atheos * ext/tk: Tk is removed from stdlib. [Feature #8539] 2016-08-09 06:44:45 +00:00
Setup.nt * ext/tk: Tk is removed from stdlib. [Feature #8539] 2016-08-09 06:44:45 +00:00