summaryrefslogtreecommitdiff
path: root/process.c
AgeCommit message (Collapse)Author
2021-11-09Some codes replace to `RBOOL` macro (#5023)S.H
* Some code replace and using RBOOL macro * Fix indent * Using RBOOL in syserr_eqq function Notes: Merged-By: nobu <nobu@ruby-lang.org>
2021-10-25process.c: Add Process._fork (#5017)Yusuke Endoh
* process.c: Add Process._fork This API is supposed for application monitoring libraries to hook fork event. [Feature #17795] Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> Notes: Merged-By: mame <mame@ruby-lang.org>
2021-10-19Fill pid and error in the statusNobuyoshi Nakada
2021-09-22Rework order of operations to better handle last_status.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/4595
2021-09-22Add support for non-blocking `Kernel.system`.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/4595
2021-09-14Handle overwriting Object::ENV in spawnJeremy Evans
Instead of looking for Object::ENV (which can be overwritten), directly look for the envtbl variable. As that is static in hash.c, and the lookup code is in process.c, add a couple non-static functions that will return envtbl (or envtbl#to_hash). Fixes [Bug #18164] Notes: Merged: https://github.com/ruby/ruby/pull/4834
2021-09-05Replace RBOOL macroS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/4791
2021-08-28Add Windows as a supported OS for Process.clock_gettime [ci skip]Lars Kanis
Notes: Merged: https://github.com/ruby/ruby/pull/4782
2021-08-16`popen()` is not available on emscriptenNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4745
2021-08-16Suppress unused-variable warningsNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4745
2021-08-03[DOC] mention how the command is passed to the shell [ci skip]Nobuyoshi Nakada
2021-07-31[DOC] Fix Process::exec documentation [ci skip]Nobuyoshi Nakada
Shell reserved words and special built-in commands can be placed at only the beginning of the command (except for leading white spaces).
2021-07-30[DOC] Fix Process::exec documentation [ci skip]Nobuyoshi Nakada
The environment variable `RUBYSHELL` is used only on Windows, as well as `COMSPEC`. Notes: Merged: https://github.com/ruby/ruby/pull/4694
2021-07-22Remove unneeded function declarationsS.H
Notes: Merged: https://github.com/ruby/ruby/pull/4665 Merged-By: nobu <nobu@ruby-lang.org>
2021-07-15process.c: Call rb_thread_atfork in rb_fork_rubyYusuke Endoh
All occurrences of rb_fork_ruby are followed by a call rb_thread_fork in the created child process. This is refactoring and a potential preparation for [Feature #17795]. (rb_fork_ruby may be wrapped by Process._fork_.)
2021-07-01Replace copy coroutine with pthread implementation.Samuel Williams
2021-02-09Expose scheduler as public interface & bug fixes. (#3945)Samuel Williams
* Rename `rb_scheduler` to `rb_fiber_scheduler`. * Use public interface if available. * Use `rb_check_funcall` where possible. * Don't use `unblock` unless the fiber was non-blocking. Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2020-12-24Updated access to Process::Status attributesNobuyoshi Nakada
pst_pid() no longer returns Qnil even if the receiver is not initialized.
2020-12-24Store errno in struct rb_process_statusNobuyoshi Nakada
To propagate errno in the fiber thread scheduler hook. Returns nil when no terminated process. Notes: Merged: https://github.com/ruby/ruby/pull/3998
2020-12-22Struct::Tms: delete卜部昌平
Has been deprecated since 44c53ee473d3b3973cb5c3ce03fbf4f280fd75ff. Notes: Merged: https://github.com/ruby/ruby/pull/3969
2020-12-21Fixed indefinite articles before "Integer" [ci skip]Nobuyoshi Nakada
2020-12-19Remove unused variableRadosław Bułat
Notes: Merged: https://github.com/ruby/ruby/pull/3934
2020-12-18Revert "Better cooperation between public/protected/private with attr* and ↵Yusuke Endoh
alias_method" This reverts commit 81739ad4fdfcc86a769056fec352f27c686fba1b.
2020-12-17Better cooperation between public/protected/private with attr* and alias_methodRadosław Bułat
Notes: Merged: https://github.com/ruby/ruby/pull/3757
2020-12-16Fixed marshal compatibility of Process::StatusNobuyoshi Nakada
2020-12-12[DOC] Process::Status.wait return nil if no child processes [ci skip]Nobuyoshi Nakada
2020-12-11RDoc states that Process::Status.wait returns nil if cannot waitNobuyoshi Nakada
2020-12-11[DOC] Fixed the RDoc location of Process::Status.wait [ci skip]Nobuyoshi Nakada
2020-12-11[DOC] Moved RDoc of abort [ci skip]Nobuyoshi Nakada
2020-12-09Tweaked `Process::Status.wait`Nobuyoshi Nakada
* revert `rb_last_status_set` * renamed the new function as `rb_process_status_new` * `rb_process_status_new` always freezes the return value * marked `Process::Status.wait` as EXPERIMENTAL, as it has not been discussed totally yet.
2020-12-09Add support for non-blocking `Process.wait`.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/3853
2020-12-07Revert getaddrinfo_a()Masaki Matsushita
getaddrinfo_a() gets stuck after fork(). To avoid this, we need 1 second sleep to wait for internal worker threads of getaddrinfo_a() to be finished, but that is unacceptable. [Bug #17220] [Feature #17134] [Feature #17187]
2020-12-06Call cleanup function for getaddrinfo_a(3) only before fork()Masaki Matsushita
Previously, rb_getaddrinfo_a_before_exec() is called from before_exec(). However, the function needs to be called only before fork(). The change moves it to before_fork().
2020-12-04Add a hook before fork() for getaddrinfo_a()Masaki Matsushita
We need stop worker threads in getaddrinfo_a() before fork(). This change adds a hook before fork() that cancel all outstanding requests and wait for all ongoing requests. Then, it waits for all worker threads to be finished. Fixes [Bug #17220]
2020-11-22Remove obsoleted internal/mjit.h inclusionTakashi Kokubun
:bow:
2020-11-18fix public interfaceKoichi Sasada
To make some kind of Ractor related extensions, some functions should be exposed. * include/ruby/thread_native.h * rb_native_mutex_* * rb_native_cond_* * include/ruby/ractor.h * RB_OBJ_SHAREABLE_P(obj) * rb_ractor_shareable_p(obj) * rb_ractor_std*() * rb_cRactor and rm ractor_pub.h and rename srcdir/ractor.h to srcdir/ractor_core.h (to avoid conflict with include/ruby/ractor.h) Notes: Merged: https://github.com/ruby/ruby/pull/3775
2020-11-07Rename to `Fiber#set_scheduler`.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/3742
2020-10-27freeze Process::StatusKoichi Sasada
It seems immutable information. Notes: Merged: https://github.com/ruby/ruby/pull/3671
2020-10-21Don't redefine #rb_intern over and over againStefan Stüben
Notes: Merged: https://github.com/ruby/ruby/pull/3589
2020-10-20Some global variables can be accessed from ractorsKoichi Sasada
Some global variables should be used from non-main Ractors. [Bug #17268] ```ruby # ractor-local (derived from created ractor): debug '$DEBUG' => $DEBUG, '$-d' => $-d, # ractor-local (derived from created ractor): verbose '$VERBOSE' => $VERBOSE, '$-w' => $-w, '$-W' => $-W, '$-v' => $-v, # process-local (readonly): other commandline parameters '$-p' => $-p, '$-l' => $-l, '$-a' => $-a, # process-local (readonly): getpid '$$' => $$, # thread local: process result '$?' => $?, # scope local: match '$~' => $~.inspect, '$&' => $&, '$`' => $`, '$\'' => $', '$+' => $+, '$1' => $1, # scope local: last line '$_' => $_, # scope local: last backtrace '$@' => $@, '$!' => $!, # ractor local: stdin, out, err '$stdin' => $stdin.inspect, '$stdout' => $stdout.inspect, '$stderr' => $stderr.inspect, ``` Notes: Merged: https://github.com/ruby/ruby/pull/3670
2020-09-14Prefer `rb_thread_current_scheduler`.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/3434
2020-09-14Standardised scheduler interface.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/3434
2020-09-03Introduce Ractor mechanism for parallel executionKoichi Sasada
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. Notes: Merged: https://github.com/ruby/ruby/pull/3365
2020-08-22Fix type of getlogin_r's 2nd argumentKazuhiro NISHIYAMA
https://rubyci.org/logs/rubyci.s3.amazonaws.com/freebsd12/ruby-master/log/20200821T223002Z.fail.html.gz ``` process.c:5593:37: error: implicit conversion loses integer precision: 'long' to 'int' [-Werror,-Wshorten-64-to-32] while ((gle = getlogin_r(login, loginsize)) != 0) { ~~~~~~~~~~ ^~~~~~~~~ ``` type of getlogin_r's 2nd argument is - int on FreeBSD - https://www.freebsd.org/cgi/man.cgi?query=getlogin_r&apropos=0&sektion=0&manpath=FreeBSD+12.1-RELEASE+and+Ports&arch=default&format=html - size_t on Linux, NetBSD - https://man7.org/linux/man-pages/man3/getlogin_r.3.html - https://www.freebsd.org/cgi/man.cgi?query=getlogin_r&apropos=0&sektion=0&manpath=NetBSD+9.0&arch=default&format=html
2020-07-20Rename `rb_current_thread_scheduler` to `rb_thread_scheduler_if_nonblocking`.Samuel Williams
Correctly capture thread before releasing GVL and pass as argument to `rb_thread_scheduler_if_nonblocking`. Notes: Merged: https://github.com/ruby/ruby/pull/3323
2020-06-29add UNREACHABLE_RETURN卜部昌平
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. Notes: Merged: https://github.com/ruby/ruby/pull/3247
2020-06-29check_exec_redirect: do not goto into a branch卜部昌平
I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor. Notes: Merged: https://github.com/ruby/ruby/pull/3247
2020-06-29check_exec_redirect_fd: do not goto into a branch卜部昌平
I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor. Notes: Merged: https://github.com/ruby/ruby/pull/3247
2020-06-09Use the dedicated conversion macroNobuyoshi Nakada
2020-06-09Return seconds slept after Thread.scheduler wait_sleepnicholas a. evans
Kernel#sleep should still return seconds slept, even when using a Thread.scheduler. The return value of Scheduler#wait_sleep can be ignored. Notes: Merged: https://github.com/ruby/ruby/pull/3198