summaryrefslogtreecommitdiff
path: root/process.c
AgeCommit message (Collapse)Author
2020-05-14Thread scheduler for light weight concurrency.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/3032 Merged-By: ioquatix <samuel@codeotaku.com>
2020-05-11sed -i 's|ruby/impl|ruby/internal|'卜部昌平
To fix build failures. Notes: Merged: https://github.com/ruby/ruby/pull/3079
2020-05-11sed -i s|ruby/3|ruby/impl|g卜部昌平
This shall fix compile errors. Notes: Merged: https://github.com/ruby/ruby/pull/3079
2020-05-11Added more NORETURN declarationsNobuyoshi Nakada
2020-05-10Run rb_syswait on exec failureTakashi Kokubun
not only when !w but also when w == WAITPID_LOCK_ONLY. See also: f7c0cc36920a4ed14a3ab1ca6cfdf18ceff1e5d5 and a2264342063260d660b99872eaf5080f6ab08e81. We thought this change was an oversight in the latter commit. Without this change, the test fails like: $ make test-all TESTS="../test/ruby/test_process.rb -n test_exec_failure_leaves_no_child" RUN_OPTS="--jit" ... 1) Failure: TestProcess#test_exec_failure_leaves_no_child [/home/k0kubun/src/github.com/ruby/ruby/test/ruby/test_process.rb:2493]: Expected [[26799, #<Process::Status: pid 26799 exit 127>]] to be empty. Co-Authored-By: Yusuke Endoh <mame@ruby-lang.org>
2020-05-02internal/process.h: add a no-warning simple wrapper for fork(2)Yusuke Endoh
As fork(2) is deprecated, its calls must be guarded by `COMPILER_WARNING_IGNORED(-Wdeprecated-declarations)`. All usages of fork(2) in process have been alread guarded. A new call to fork(2) was added in ruby.c with f22c4ff359498ab342e4b6d6feb21af6004ee270. This caused a build failure on Solaris 11. It may hide a bug to guard big code unnecessarily, so this change introduces a simple wrapper "rb_fork" whose definition is guarded, and replaces all calls to fork(2) with the wrapper function.
2020-04-21__GNUC__ is too lax卜部昌平
Ditto for 4b853932eaa7fa4acf8a0f0c9b7c695bb4f5e76d
2020-04-16Preserve encoding in error messages for invalid user/group nameNobuyoshi Nakada
2020-04-16Preserve encoding in error message for invalid env exec optionNobuyoshi Nakada
2020-04-13Add a a list of cases for which clock_getres() has been observed to be ↵Benoit Daloze
inaccurate * See [Bug #16740]
2020-04-10[DOC] Fixed POSIX clock_getres(3) link [ci skip]Nobuyoshi Nakada
It should not be linked to `Process.clock_getes`.
2020-04-10Warn about Process#clock_getres being unreliable in documentationBenoit Daloze
* [Bug #16740] * Remove the GETTIMEOFDAY_BASED_CLOCK_REALTIME example because the caveat applies to all clock ids, not just the Symbol clock ids.
2020-04-08Suppress -Wswitch warningsNobuyoshi Nakada
2020-04-08Merge pull request #2991 from shyouhei/ruby.h卜部昌平
Split ruby.h Notes: Merged-By: shyouhei <shyouhei@ruby-lang.org>
2020-02-12Fixed a potential memory leakNobuyoshi Nakada
`rb_str_new_cstr` can raise a `NoMemoryError`.
2020-02-12Removed unnecessary conversionNobuyoshi Nakada
Paths in `rb_execarg_t` should have been converted already.
2020-02-11Restart timer thread even after preparation failedNobuyoshi Nakada
If the timer thread is left stopped, memory crash or segfault can happen.
2019-12-26decouple internal.h headers卜部昌平
Saves comitters' daily life by avoid #include-ing everything from internal.h to make each file do so instead. This would significantly speed up incremental builds. We take the following inclusion order in this changeset: 1. "ruby/config.h", where _GNU_SOURCE is defined (must be the very first thing among everything). 2. RUBY_EXTCONF_H if any. 3. Standard C headers, sorted alphabetically. 4. Other system headers, maybe guarded by #ifdef 5. Everything else, sorted alphabetically. Exceptions are those win32-related headers, which tend not be self- containing (headers have inclusion order dependencies). Notes: Merged: https://github.com/ruby/ruby/pull/2711
2019-12-24[DOC] Fix grammar in Process module docsMarcus Stollsteimer
2019-12-20Fixed misspellingsNobuyoshi Nakada
Fixed misspellings reported at [Bug #16437], only in ruby and rubyspec.
2019-12-16Kernel#abort without arguments should print error infoNobuyoshi Nakada
[Bug #16424] Notes: Merged: https://github.com/ruby/ruby/pull/2754
2019-11-18delete unused codes卜部昌平
Suppress compiler warnings.
2019-11-18Warn on access/modify of $SAFE, and remove effects of modifying $SAFEJeremy Evans
This removes the security features added by $SAFE = 1, and warns for access or modification of $SAFE from Ruby-level, as well as warning when calling all public C functions related to $SAFE. This modifies some internal functions that took a safe level argument to no longer take the argument. rb_require_safe now warns, rb_require_string has been added as a version that takes a VALUE and does not warn. One public C function that still takes a safe level argument and that this doesn't warn for is rb_eval_cmd. We may want to consider adding an alternative method that does not take a safe level argument, and warn for rb_eval_cmd. Notes: Merged: https://github.com/ruby/ruby/pull/2476
2019-11-04Use the dedicated function `rb_io_check_io`Nobuyoshi Nakada
2019-10-26Documentation improvements for Ruby corezverok
* Top-level `return`; * Documentation for comments syntax; * `rescue` inside blocks; * Enhance `Object#to_enum` docs; * Make `chomp:` option more obvious for `String#each_line` and `#lines`; * Enhance `Proc#>>` and `#<<` docs; * Enhance `Processs` class docs. Notes: Merged: https://github.com/ruby/ruby/pull/2612
2019-10-05Fix potential memory leaks by `rb_imemo_tmpbuf_auto_free_pointer`Nobuyoshi Nakada
This function has been used wrongly always at first, "allocate a buffer then wrap it with tmpbuf". This order can cause a memory leak, as tmpbuf creation also can raise a NoMemoryError exception. The right order is "create a tmpbuf then allocate&wrap a buffer". So the argument of this function is rather harmful than just useless. TODO: * Rename this function to more proper name, as it is not used "temporary" (function local) purpose. * Allocate and wrap at once safely, like `ALLOCV`.
2019-10-04Remove call-seq for method that doesn't exist (#2521)Alan Wu
``` $ ruby -ve 'IO.popen("ls"){}; $?.to_int' ruby 2.6.4p104 (2019-08-28 revision 67798) [x86_64-darwin18] Traceback (most recent call last): -e:1:in `<main>': undefined method `to_int' for #<Process::Status: pid 33989 SIGPIPE (signal 13)> (NoMethodError) Did you mean? to_i taint ``` Process::Status#to_int was removed at 7ba5c4e.
2019-09-05Add version that FreeBSD supports `CLOCK_PROCESS_CPUTIME_ID` [ci skip]yuuji.yaginuma
Seems FreeBSD already supported `CLOCK_PROCESS_CPUTIME_ID`. That added by https://reviews.freebsd.org/rS239347 and the doc was updated by https://reviews.freebsd.org/rS315694. I confirmed `CLOCK_PROCESS_CPUTIME_ID` constant exists in 9.3.0 branch. https://github.com/freebsd/freebsd/blob/release/9.3.0/sys/sys/time.h#L269 Notes: Merged: https://github.com/ruby/ruby/pull/2429
2019-08-29move docs around [ci skip]卜部昌平
To properly generate documents.
2019-08-29drop-in type check for rb_define_global_function卜部昌平
We can check the function pointer passed to rb_define_global_function like we do so in rb_define_method. It turns out that almost anybody is misunderstanding the API.
2019-08-29drop-in type check for rb_define_module_function卜部昌平
We can check the function pointer passed to rb_define_module_function like how we do so in rb_define_method. The difference is that this changeset reveales lots of atiry mismatches.
2019-08-27delete `$` sign from C identifiers卜部昌平
They lack portability. See also https://travis-ci.org/shyouhei/ruby/jobs/577164015
2019-08-27rb_define_hooked_variable now free from ANYARGS卜部昌平
After 5e86b005c0f2ef30df2f9906c7e2f3abefe286a2, I now think ANYARGS is dangerous and should be extinct. This commit uses rb_gvar_getter_t / rb_gvar_setter_t for rb_define_hooked_variable / rb_define_virtual_variable which revealed lots of function prototype inconsistencies. Some of them were literally decades old, going back to dda5dc00cff334cac373096d444a0fd59e716124.
2019-08-26uid_t and gid_t are narrower than VALUE.卜部昌平
Often uid / gid are 16 bit or 32 bit integers, while VALUE are 32 to 64 bits. They tend to differ in size. Because rb_ensure expects its callbacks to take VALUE arguments, narrowing must be done by hand, otherwise data corruption can happen depending on machine ABI.
2019-08-26Suppress a "clobbered" warningNobuyoshi Nakada
2019-07-16nil as the default of optional parametersNobuyoshi Nakada
2019-07-16nil as the default of optional parametersNobuyoshi Nakada
2019-07-16Moved the check for `exception` to rb_execarg_addoptNobuyoshi Nakada
Check for `exception` option in rb_execarg_addopt, as well as other options. And then raise a particular ArgumentError if it is not allowed.
2019-07-15process.c (p_sys_setregid, p_sys_setresgid): remove unused tmp bufferYusuke Endoh
To suppress Coverity Scan warning
2019-03-30process.c: [DOC] remove extra quotes [ci skip]nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67386 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-29process.c: [DOC] fix markups [ci skip]nobu
* process.c (rb_f_spawn): fix markups as rdoc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67370 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-29process.c: [DOC] fix markups [ci skip]nobu
* process.c (rb_clock_getres): fix code markups, as `+` can not include parentheses. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67369 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-28[DOC] fix markups [ci skip]nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-02-09new constant: Process::CLOCK_TAI.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67042 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-20process.c: [DOC] small improvementsstomar
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66886 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-10mjit.c: use boolean type for boolean variablesk0kubun
and functions to clarify the intention and make sure it's not used in a surprising way (like using 2, 3, ... other than 0, 1 even while it seems to be a boolean). This is a retry of r66775. It included some typos... git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66778 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-10Revert "mjit.c: use boolean type for boolean variables"k0kubun
This reverts commit bb1a1aeab0f2a5fe437c89b841a887ba56653453. We hit something on ci.rvm.jp, reverting until investigation is done. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66776 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-10mjit.c: use boolean type for boolean variablesk0kubun
and functions to clarify the intention and make sure it's not used in a surprising way (like using 2, 3, ... other than 0, 1 even while it seems to be a boolean). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-29process.c: document system(..., exception: true) [ci skip]k0kubun
From: Victor Shepelev <zverok.offline@gmail.com> [Bug #15480] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66637 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-22Use idExceptionnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e