summaryrefslogtreecommitdiff
path: root/process.c
Commit message (Collapse)AuthorAgeFilesLines
* [Feature #19590] Show the invalid clock argumentNobuyoshi Nakada2023-04-131-6/+15
| | | | | Include the failed clock argument in the error message from `Process.clock_gettime` and `Process.clock_getres`.
* [DOC] Clarify behavior of abort() with no argumentDaniel DeLorme2023-04-051-1/+2
| | | | | | Since Ruby 2.7 it prints the message and backtrace of $! Fixes [Bug #19578]
* Revert "Fix transient heap mode"Aaron Patterson2023-04-041-34/+0
| | | | | | | | This reverts commit 87253d047ce35e7836b6f97edbb4f819879a3b25. Revert "Implement `Process.warmup`" This reverts commit ba6ccd871442f55080bffd53e33678c0726787d2.
* Implement `Process.warmup`Jean Boussier2023-04-041-0/+34
| | | | | | | | | | | | [Feature #18885] For now, the optimizations performed are: - Run a major GC - Compact the heap - Promote all surviving objects to oldgen Other optimizations may follow.
* PID cache is never cleared where `fork` is not usedNobuyoshi Nakada2023-04-041-0/+2
|
* Cache pid itself instead of converted VALUENobuyoshi Nakada2023-03-241-18/+6
|
* thread_pthread.c: Use a `fork_gen` to protect against fork instead of getpid()Jean Boussier2023-03-231-12/+7
| | | | | | | | | | | | | | | [Feature #19443] Until recently most libc would cache `getpid()` so this was a cheap check to make. However as of glibc version 2.25 the PID cache is removed and calls to getpid() always invoke the actual system call which significantly degrades the performance of existing applications. The reason glibc removed the cache is that some libraries were bypassing fork(2) by issuing system calls themselves, causing stale cache issues. That isn't a concern for Ruby as bypassing MRI's primitive for forking would render the VM unusable, so we can safely cache the PID.
* Suppress a compiler warning on GCC in process.cPeter Zhu2023-03-221-0/+8
| | | | | | | rb_pid_t is 32 bits on some platforms, which will cause a warning on GCC due to POSFIXABLE always returning true. include/ruby/internal/arithmetic/fixnum.h:43:31: warning: comparison is always true due to limited range of data type [-Wtype-limits]
* Mark cached pid if necessaryNobuyoshi Nakada2023-03-201-2/+7
|
* Cache `Process.pid`Jean Boussier2023-03-201-3/+21
| | | | | | | | | | | | | | | | | | | | [Feature #19443] It's not uncommon for database client and similar network libraries to protect themselves from Process.fork by regularly checking Process.pid Until recently most libc would cache `getpid()` so this was a cheap check to make. However as of glibc version 2.25 the PID cache is removed and calls to `getpid()` always invoke the actual system call which significantly degrades the performance of existing applications. The reason glibc removed the cache is that some libraries were bypassing `fork(2)` by issuing system calls themselves, causing stale cache issues. That isn't a concern for Ruby as bypassing MRI's primitive for forking would render the VM unusable, so we can safely cache the PID.
* Remove SIGCHLD `waidpid`. (#7527)Samuel Williams2023-03-151-210/+5
| | | | | | | * Remove `waitpid_lock` and related code. * Remove un-necessary test. * Remove `rb_thread_sleep_interruptible` dead code.
* Revert SIGCHLD changes to diagnose CI failures. (#7517)Samuel Williams2023-03-141-5/+210
| | | | | | | | | | | | | | | * Revert "Remove special handling of `SIGCHLD`. (#7482)" This reverts commit 44a0711eab7fbc71ac2c8ff489d8c53e97a8fe75. * Revert "Remove prototypes for functions that are no longer used. (#7497)" This reverts commit 4dce12bead3bfd91fd80b5e7195f7f540ffffacb. * Revert "Remove SIGCHLD `waidpid`. (#7476)" This reverts commit 1658e7d96696a656d9bd0a0c84c82cde86914ba2. * Fix change to rjit variable name.
* Remove prototypes for functions that are no longer used. (#7497)Samuel Williams2023-03-101-4/+0
|
* Accept `sleep(nil)` as sleep forever. (#7484)Samuel Williams2023-03-101-1/+4
|
* Remove SIGCHLD `waidpid`. (#7476)Samuel Williams2023-03-091-206/+5
| | | | | | | * Remove `waitpid_lock` and related code. * Remove un-necessary test. * Remove `rb_thread_sleep_interruptible` dead code.
* Remove obsoleted functions in rjit.cTakashi Kokubun2023-03-071-6/+1
|
* Get rid of MJIT's special forkTakashi Kokubun2023-03-071-53/+0
|
* s/mjit/rjit/Takashi Kokubun2023-03-061-20/+20
|
* s/MJIT/RJIT/Takashi Kokubun2023-03-061-8/+8
|
* [DOC] Restore Process module doc lost due to RDoc updatezverok2023-02-191-20/+15
|
* [DOC] Change formatting in the exec docsMaciek Rząsa2022-11-191-3/+4
| | | | | The last part of the sentence was accidentally put in enumeration, It made an impression that it's one of the rules, not the result of applying the rules.
* Using UNDEF_P macroS-H-GAMELINKS2022-11-161-1/+1
|
* Followed up 796069b2882d8a67ecc36bda7c72affcbad09daeHiroshi SHIBATA2022-09-221-0/+4
|
* getrlimit adding RLIMIT_NPTS constant.David Carlier2022-09-211-0/+8
|
* [DOC] Tweak the doc for `Process.kill` signatureKoichi ITO2022-09-211-1/+1
| | | | | | | | | | | | | Replacing `...` with `*pids` seems to clarify the expected variadic arguments. Note that the expected arguments are two or more with a signal and pids. That is, the method must have at least one pid, which cannot be omitted: ```console % ruby -e 'Process.kill(0)' -e:1:in `kill': wrong number of arguments (given 1, expected 2+) (ArgumentError) from -e:1:in `<main>' ```
* Ignore EPERM which means already being process-leaderNobuyoshi Nakada2022-09-201-1/+2
|
* Reduce fork calls in daemonNobuyoshi Nakada2022-09-191-10/+4
| | | | | | The forked child process is a grandchild process from the viewpoint of the process which invoked the caller process. That means the child is detached at that point, and it does not need to fork twice.
* MJIT: Do not hang after forking with threadsTakashi Kokubun2022-09-111-0/+1
| | | | | | | | | | | First, rb_mjit_fork should call rb_thread_atfork to stop threads after fork in the child process. Unfortunately, we cannot use rb_fork_ruby to prevent this kind of mistakes because MJIT needs special handling of waiting_pid and mjit_pause/resume. Second, mjit_waitpid_finished should be checked regardless of trap_interrupt. It doesn't seem like the flag is not set when SIGCHLD is handled for an MJIT child process.
* Call appropriate hooks on MJIT's forkTakashi Kokubun2022-09-041-0/+23
| | | | This takes care of signal_self_pipe and other things.
* Short-circuit `Process._fork`Nobuyoshi Nakada2022-08-121-9/+22
|
* Stop using casted `rb_syswait` as `proc_syswait`Nobuyoshi Nakada2022-08-071-5/+1
| | | | | | The argument of `rb_syswait` is now `rb_pid_t` which may differ from `int`. Also it is an undefined behavior to take the result of casted void function (in `rb_protect`).
* Fix the sizes comparisonNobuyoshi Nakada2022-08-061-1/+1
| | | | `proc_syswait` will be called with a `VALUE` argument.
* [DOC] Process._fork does not get called by Process.daemonIvo Anjo2022-08-051-0/+7
| | | | | | | | | As discussed in [Bug #18911], I'm adding some documentation to `Process._fork` to clarify that it is not expected to cover calls to `Process.daemon`. [Bug #18911]: https://bugs.ruby-lang.org/issues/18911 Co-authored-by: Yusuke Endoh <mame@ruby-lang.org>
* Expand tabs [ci skip]Takashi Kokubun2022-07-211-739/+739
| | | | [Misc #18891]
* [DOC] Document `Process::Tms`Nobuyoshi Nakada2022-06-281-1/+16
|
* Allow to just warn as bool expected, without an exceptionNobuyoshi Nakada2022-06-201-1/+1
|
* Remove MJIT worker thread (#6006)Takashi Kokubun2022-06-151-62/+22
| | | [Misc #18830]
* [ci skip] Fix docsPeter Zhu2022-04-131-1/+1
|
* Fix some RDoc links (#5778)Burdette Lamar2022-04-081-1/+1
|
* Prefix ccan headers (#4568)Nobuyoshi Nakada2022-03-301-19/+19
| | | | | | | | | | | | | * Prefixed ccan headers * Remove unprefixed names in ccan/build_assert * Remove unprefixed names in ccan/check_type * Remove unprefixed names in ccan/container_of * Remove unprefixed names in ccan/list Co-authored-by: Samuel Williams <samuel.williams@oriontransfer.co.nz>
* [DOC] Fix documentation typo for Process#clock_gettimeThierry Joyal2022-03-071-1/+1
| | | | Fixes [Misc #18610]
* Use symbols for clock IDs if `clockid_t` is not numericNobuyoshi Nakada2022-02-191-19/+134
|
* Set static IDs to same name variablesNobuyoshi Nakada2022-02-191-30/+31
|
* Enhanced RDoc concerning command injection (#5537)Burdette Lamar2022-02-181-0/+3
| | | | | | | | | | | | | | | | Clarifies security vulnerabilities for commands. Treats: Kernel.system Kernel.` (backtick) IO.popen IO.read IO.write IO.binread IO.binwrite IO.readlines IO.foreach
* Accurately report VM memsizeKevin Newton2022-01-211-0/+15
| | | | | | Currently the calculation only counts the size of the struct. This commit adds the size of the associated st tables, id tables, and linked lists. Still missing is the size of the ractors and (potentially) the size of the object space.
* [DOC] Enhanced Process.groups relatedNobuyoshi Nakada2022-01-191-6/+7
| | | | | | * On some platforms (e.g., macOS), the user's default group access list may exceed `NGROUPS_MAX`. * Use upcase "GID" instead of "gid" for other than variable names.
* [Feature #18491] Drop support for HP-UXPeter Zhu2022-01-181-1/+0
| | | | | IA64 support was dropped in ticket #15894, so we can drop support for HP-UX.
* Replace to RBOOL macroS-H-GAMELINKS2022-01-171-6/+1
|
* [DOC] Fix docs rendering for Process._fork [ci skip]Matheus Richard2021-12-151-2/+2
| | | Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
* Some codes replace to `RBOOL` macro (#5023)S.H2021-11-091-16/+4
| | | | | | | * Some code replace and using RBOOL macro * Fix indent * Using RBOOL in syserr_eqq function