Conversation
Support the posix_spawn_file_actions_adddup2() library call. The direct motivation for this is the jobserver crate using pre_exec to clear the CLOEXEC flag on the jobserver fd. This disables the vfork optimization and slows down posix_spawn() greatly.
|
rustbot has assigned @petrochenkov. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
Disclosure: I was assisted by AI to prepare the patch. I believe it is of good quality. |
|
r? library |
|
Failed to set assignee to
|
|
r? libs |
Thank you for the honesty! Was this discussed previously by T-libs-api? In any case, I have some questions about the API:
And also, |
|
How is this different from #145687? |
At least:
It's possible that the contents are equivalent. |
I don't know. I don't even know what a T-libs-api is. I'm not a regular Rust contributor.
I think dup2_file_action, while clumsy, is better. We're not implementing some general computing concept, we're plumbing an existing API. It's likely users will approach it from the point of "how do I push a dup2_file_action through the process API (coming from below, the Linux direction) rather than "let's explore the process API and see what tools it gives me" (coming from above, the application direction). It solves a very low-level problem. That said, I'll happily adjust to conform to the library's wishes.
Understood, I'll try it.
Ok.
Awaiting your preference on the naming. |
It wouldn't use |
| /// | ||
| /// [`pre_exec`]: CommandExt::pre_exec | ||
| #[unstable(feature = "process_file_actions", issue = "none")] | ||
| unsafe fn dup2_file_action(&mut self, oldfd: RawFd, newfd: RawFd) -> &mut process::Command; |
There was a problem hiding this comment.
Can this accept an OwnedFd or BorrowedFd as input fd to make this function safe?
Support the posix_spawn_file_actions_adddup2() library call.
The direct motivation for this is the jobserver crate using pre_exec to clear the CLOEXEC flag on the jobserver fd. This disables the vfork optimization and slows down posix_spawn() greatly.