Add ChildExt::kill_process_group - #156539
Conversation
This function wraps POSIX `killpg()`, and on Linux additionally may be implemented by `pidfd_send_signal`.
|
r? @nia-e rustbot has assigned @nia-e. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
Reminder, once the PR becomes ready for a review, use |
This function wraps POSIX `killpg(pid, SIGKILL)`, and on Linux additionally may be implemented by `pidfd_send_signal`.
3d3f33e to
7bf5fe7
Compare
|
@rustbot ready |
|
@bors r+ rollup |
…nia-e Add `ChildExt::kill_process_group` ACP: rust-lang/libs-team#791 Tracking issue: rust-lang#156537
…uwer Rollup of 5 pull requests Successful merges: - #155521 (Add lint againts invalid runtime symbol definitions) - #156500 (Privacy: move macros handling to early stage) - #156413 (rustdoc: Correctness & perf improvements to link-to-definition) - #156539 (Add `ChildExt::kill_process_group`) - #156540 (use `deref_patterns` in `rustdoc` instead of `box_patterns`)
…nia-e Add `ChildExt::kill_process_group` ACP: rust-lang/libs-team#791 Tracking issue: rust-lang#156537
…uwer Rollup of 7 pull requests Successful merges: - #156552 (Clippy subtree update) - #156344 (Do not index past end of buffer when checking heuristic in error index syntax highlighter) - #156500 (Privacy: move macros handling to early stage) - #156260 (test: suppress deprecation warning) - #156413 (rustdoc: Correctness & perf improvements to link-to-definition) - #156539 (Add `ChildExt::kill_process_group`) - #156540 (use `deref_patterns` in `rustdoc` instead of `box_patterns`)
…uwer Rollup of 7 pull requests Successful merges: - #156552 (Clippy subtree update) - #156344 (Do not index past end of buffer when checking heuristic in error index syntax highlighter) - #156500 (Privacy: move macros handling to early stage) - #156260 (test: suppress deprecation warning) - #156413 (rustdoc: Correctness & perf improvements to link-to-definition) - #156539 (Add `ChildExt::kill_process_group`) - #156540 (use `deref_patterns` in `rustdoc` instead of `box_patterns`)
Rollup merge of #156539 - jmillikin:unix-childext-killpg, r=nia-e Add `ChildExt::kill_process_group` ACP: rust-lang/libs-team#791 Tracking issue: #156537
VxWorks has no process groups: the SDK defines no `killpg`, and `getpgrp`/`setpgid` are no-ops in libunix, so `kill(-pgrp, sig)` is no substitute either. libc cannot usefully declare `killpg` for this target, so the call added in rust-lang#156539 leaves the target unable to build std. Return `ErrorKind::Unsupported` instead, as the `unsupported` backend does and as `kill_process_group` already does for espidf.
…upported, r=Darksonn std: make send_process_group_signal unsupported on VxWorks `x86_64-wrs-vxworks` doesn't build std: `cargo new` plus `-Zbuild-std` stops with E0425 on `libc::killpg`, which rust-lang#156539 introduced. libc has never declared `killpg` for vxworks, and declaring it wouldn't help. On wrsdk-vxworks7-qemu-1.17.0 there's no `killpg` in the headers, the sysroot archives or the prebuilt kernel, and `getpgrp`/`setpgid` are no-ops in libunix: `getpgrp` returns a constant 0, `setpgid` stores nothing. That rules out `kill(-pgrp, sig)` too. `Command::process_group` is already ignored on this target, since `get_pgroup` is only read by the fork/posix_spawn path while vxworks spawns through `rtpSpawn`. Closes rust-lang#159969.
…upported, r=Darksonn std: make send_process_group_signal unsupported on VxWorks `x86_64-wrs-vxworks` doesn't build std: `cargo new` plus `-Zbuild-std` stops with E0425 on `libc::killpg`, which rust-lang#156539 introduced. libc has never declared `killpg` for vxworks, and declaring it wouldn't help. On wrsdk-vxworks7-qemu-1.17.0 there's no `killpg` in the headers, the sysroot archives or the prebuilt kernel, and `getpgrp`/`setpgid` are no-ops in libunix: `getpgrp` returns a constant 0, `setpgid` stores nothing. That rules out `kill(-pgrp, sig)` too. `Command::process_group` is already ignored on this target, since `get_pgroup` is only read by the fork/posix_spawn path while vxworks spawns through `rtpSpawn`. Closes rust-lang#159969.
Rollup merge of #159991 - physwkim:vxworks-process-group-unsupported, r=Darksonn std: make send_process_group_signal unsupported on VxWorks `x86_64-wrs-vxworks` doesn't build std: `cargo new` plus `-Zbuild-std` stops with E0425 on `libc::killpg`, which #156539 introduced. libc has never declared `killpg` for vxworks, and declaring it wouldn't help. On wrsdk-vxworks7-qemu-1.17.0 there's no `killpg` in the headers, the sysroot archives or the prebuilt kernel, and `getpgrp`/`setpgid` are no-ops in libunix: `getpgrp` returns a constant 0, `setpgid` stores nothing. That rules out `kill(-pgrp, sig)` too. `Command::process_group` is already ignored on this target, since `get_pgroup` is only read by the fork/posix_spawn path while vxworks spawns through `rtpSpawn`. Closes #159969.
… r=Darksonn std: make send_process_group_signal unsupported on VxWorks `x86_64-wrs-vxworks` doesn't build std: `cargo new` plus `-Zbuild-std` stops with E0425 on `libc::killpg`, which rust-lang/rust#156539 introduced. libc has never declared `killpg` for vxworks, and declaring it wouldn't help. On wrsdk-vxworks7-qemu-1.17.0 there's no `killpg` in the headers, the sysroot archives or the prebuilt kernel, and `getpgrp`/`setpgid` are no-ops in libunix: `getpgrp` returns a constant 0, `setpgid` stores nothing. That rules out `kill(-pgrp, sig)` too. `Command::process_group` is already ignored on this target, since `get_pgroup` is only read by the fork/posix_spawn path while vxworks spawns through `rtpSpawn`. Closes rust-lang/rust#159969.
…uwer Rollup of 7 pull requests Successful merges: - rust-lang/rust#156552 (Clippy subtree update) - rust-lang/rust#156344 (Do not index past end of buffer when checking heuristic in error index syntax highlighter) - rust-lang/rust#156500 (Privacy: move macros handling to early stage) - rust-lang/rust#156260 (test: suppress deprecation warning) - rust-lang/rust#156413 (rustdoc: Correctness & perf improvements to link-to-definition) - rust-lang/rust#156539 (Add `ChildExt::kill_process_group`) - rust-lang/rust#156540 (use `deref_patterns` in `rustdoc` instead of `box_patterns`)
| /// | ||
| /// [`Child::kill`]: process::Child::kill | ||
| #[unstable(feature = "unix_kill_process_group", issue = "156537")] | ||
| fn kill_process_group(&mut self) -> io::Result<()>; |
There was a problem hiding this comment.
Why was &mut used here but not for send_process_group_signal when they use the same call internally?
There was a problem hiding this comment.
worth bringing up on the tracking issue - i just ensured this matched the ACP, but that was approved separately. good catch!
There was a problem hiding this comment.
Huh: kill and wait take &mut self but don't strictly need to. I suppose it may account for targets that need to do more?
Maybe all our signal sending functions should be &mut to be safe. I'll nominate #141975.
ACP: rust-lang/libs-team#791
Tracking issue: #156537