Граф коммитов

985 Коммитов

Автор SHA1 Сообщение Дата
Maciek Rząsa 50c6cabadc
[DOC] Change formatting in the exec docs
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.
2022-11-19 11:38:16 +09:00
S-H-GAMELINKS 1f4f6c9832 Using UNDEF_P macro 2022-11-16 18:58:33 +09:00
Hiroshi SHIBATA 6b0b326ef2 Followed up 796069b288 2022-09-22 11:35:28 +09:00
David Carlier 796069b288 getrlimit adding RLIMIT_NPTS constant. 2022-09-21 18:07:59 +09:00
Koichi ITO e3b178066b [DOC] Tweak the doc for `Process.kill` signature
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>'
```
2022-09-21 15:21:27 +09:00
Nobuyoshi Nakada 55e540f7ab
Ignore EPERM which means already being process-leader 2022-09-20 11:12:11 +09:00
Nobuyoshi Nakada ae07336529 Reduce fork calls in daemon
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.
2022-09-19 15:34:16 +09:00
Takashi Kokubun aa8a3b2358
MJIT: Do not hang after forking with threads
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.
2022-09-11 09:09:05 +09:00
Takashi Kokubun f6d569b7c0
Call appropriate hooks on MJIT's fork
This takes care of signal_self_pipe and other things.
2022-09-04 18:22:25 -07:00
Nobuyoshi Nakada b2205cd45c Short-circuit `Process._fork` 2022-08-12 16:57:56 +09:00
Nobuyoshi Nakada e545cfad20
Stop using casted `rb_syswait` as `proc_syswait`
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`).
2022-08-07 00:02:38 +09:00
Nobuyoshi Nakada f245b425af
Fix the sizes comparison
`proc_syswait` will be called with a `VALUE` argument.
2022-08-06 23:56:44 +09:00
Ivo Anjo 74817f3d37
[DOC] Process._fork does not get called by Process.daemon
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>
2022-08-05 18:40:48 +09:00
Takashi Kokubun 5b21e94beb Expand tabs [ci skip]
[Misc #18891]
2022-07-21 09:42:04 -07:00
Nobuyoshi Nakada 5e66525e41
[DOC] Document `Process::Tms` 2022-06-28 20:19:05 +09:00
Nobuyoshi Nakada a58611dfb1 Allow to just warn as bool expected, without an exception 2022-06-20 19:35:12 +09:00
Takashi Kokubun 1162523bae
Remove MJIT worker thread (#6006)
[Misc #18830]
2022-06-15 09:40:54 -07:00
Peter Zhu 54b53e2c8f [ci skip] Fix docs 2022-04-13 10:43:23 -04:00
Burdette Lamar 70415071e8
Fix some RDoc links (#5778) 2022-04-08 14:25:38 -05:00
Nobuyoshi Nakada 42a0bed351
Prefix ccan headers (#4568)
* 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>
2022-03-30 20:36:31 +13:00
Thierry Joyal 9cbebdcb74 [DOC] Fix documentation typo for Process#clock_gettime
Fixes [Misc #18610]
2022-03-07 13:02:01 +01:00
Nobuyoshi Nakada 4641abf0a2 Use symbols for clock IDs if `clockid_t` is not numeric 2022-02-19 15:33:15 +09:00
Nobuyoshi Nakada b3de25dfee Set static IDs to same name variables 2022-02-19 15:33:15 +09:00
Burdette Lamar e9a2b30744
Enhanced RDoc concerning command injection (#5537)
Clarifies security vulnerabilities for commands.

Treats:

    Kernel.system
    Kernel.` (backtick)
    IO.popen
    IO.read
    IO.write
    IO.binread
    IO.binwrite
    IO.readlines
    IO.foreach
2022-02-18 06:46:04 -06:00
Kevin Newton fc6fd4c31e Accurately report VM memsize
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.
2022-01-21 14:34:53 -08:00
Nobuyoshi Nakada 2f0f56bdca
[DOC] Enhanced Process.groups related
* 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.
2022-01-19 12:04:08 +09:00
Peter Zhu ffda21b7ba [Feature #18491] Drop support for HP-UX
IA64 support was dropped in ticket #15894, so we can drop support for
HP-UX.
2022-01-18 09:52:15 -05:00
S-H-GAMELINKS 804a714971 Replace to RBOOL macro 2022-01-17 13:49:37 +09:00
Matheus Richard b563f12297
[DOC] Fix docs rendering for Process._fork [ci skip]
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2021-12-15 07:15:02 +09:00
S.H 75aae66c4f
Some codes replace to `RBOOL` macro (#5023)
* Some code replace and using RBOOL macro

* Fix indent

* Using RBOOL in syserr_eqq function
2021-11-09 17:09:29 +09:00
Yusuke Endoh 13068ebe32
process.c: Add Process._fork (#5017)
* 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>
2021-10-25 20:47:19 +09:00
Nobuyoshi Nakada 1d9e129255
Fill pid and error in the status 2021-10-19 16:41:09 +09:00
Samuel Williams bf3e314852 Rework order of operations to better handle last_status. 2021-09-22 18:50:26 +12:00
Samuel Williams 7db021f83b Add support for non-blocking `Kernel.system`. 2021-09-22 18:50:26 +12:00
Jeremy Evans 57d315c937 Handle overwriting Object::ENV in spawn
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]
2021-09-14 05:55:14 -09:00
S-H-GAMELINKS bdd6d8746f Replace RBOOL macro 2021-09-05 23:01:27 +09:00
Lars Kanis 7e36b91526 Add Windows as a supported OS for Process.clock_gettime [ci skip] 2021-08-28 18:26:19 +09:00
Nobuyoshi Nakada a8714b83c4
`popen()` is not available on emscripten 2021-08-16 17:00:19 +09:00
Nobuyoshi Nakada 07b12a1f48
Suppress unused-variable warnings 2021-08-16 16:02:49 +09:00
Nobuyoshi Nakada 785c70e764
[DOC] mention how the command is passed to the shell [ci skip] 2021-08-03 18:16:32 +09:00
Nobuyoshi Nakada e294beb731
[DOC] Fix Process::exec documentation [ci skip]
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-31 11:38:27 +09:00
Nobuyoshi Nakada 01d9e7f26c [DOC] Fix Process::exec documentation [ci skip]
The environment variable `RUBYSHELL` is used only on Windows, as
well as `COMSPEC`.
2021-07-30 19:36:17 +09:00
S.H fc50b2eae5
Remove unneeded function declarations 2021-07-22 15:41:03 +09:00
Yusuke Endoh 645616c273 process.c: Call rb_thread_atfork in rb_fork_ruby
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-15 16:46:08 +09:00
Samuel Williams 42130a64f0
Replace copy coroutine with pthread implementation. 2021-07-01 11:23:03 +12:00
Samuel Williams 5f69a7f604
Expose scheduler as public interface & bug fixes. (#3945)
* 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.
2021-02-09 19:39:56 +13:00
Nobuyoshi Nakada 81562f943e
Updated access to Process::Status attributes
pst_pid() no longer returns Qnil even if the receiver is not
initialized.
2020-12-24 23:35:18 +09:00
Nobuyoshi Nakada bdbbfd1fa5 Store errno in struct rb_process_status
To propagate errno in the fiber thread scheduler hook.
Returns nil when no terminated process.
2020-12-24 22:59:37 +09:00
卜部昌平 fee2913d0a Struct::Tms: delete
Has been deprecated since 44c53ee473.
2020-12-22 13:52:18 +09:00
Nobuyoshi Nakada fb8f011422
Fixed indefinite articles before "Integer" [ci skip] 2020-12-21 01:19:55 +09:00