Rollup merge of #77432 - tmiasko:posix-spawn-musl, r=cuviper
Use posix_spawn on musl targets The posix_spawn had been available in a form suitable for use in a Command implementation since musl 0.9.12. Use it in a preference to a fork when possible, to benefit from CLONE_VM|CLONE_VFORK used there.
This commit is contained in:
commit
72d275d844
|
@ -252,7 +252,8 @@ impl Command {
|
||||||
#[cfg(not(any(
|
#[cfg(not(any(
|
||||||
target_os = "macos",
|
target_os = "macos",
|
||||||
target_os = "freebsd",
|
target_os = "freebsd",
|
||||||
all(target_os = "linux", target_env = "gnu")
|
all(target_os = "linux", target_env = "gnu"),
|
||||||
|
all(target_os = "linux", target_env = "musl"),
|
||||||
)))]
|
)))]
|
||||||
fn posix_spawn(
|
fn posix_spawn(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
@ -267,7 +268,8 @@ impl Command {
|
||||||
#[cfg(any(
|
#[cfg(any(
|
||||||
target_os = "macos",
|
target_os = "macos",
|
||||||
target_os = "freebsd",
|
target_os = "freebsd",
|
||||||
all(target_os = "linux", target_env = "gnu")
|
all(target_os = "linux", target_env = "gnu"),
|
||||||
|
all(target_os = "linux", target_env = "musl"),
|
||||||
))]
|
))]
|
||||||
fn posix_spawn(
|
fn posix_spawn(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
@ -297,10 +299,10 @@ impl Command {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Solaris and glibc 2.29+ can set a new working directory, and maybe
|
// Solaris, glibc 2.29+, and musl 1.24+ can set a new working directory,
|
||||||
// others will gain this non-POSIX function too. We'll check for this
|
// and maybe others will gain this non-POSIX function too. We'll check
|
||||||
// weak symbol as soon as it's needed, so we can return early otherwise
|
// for this weak symbol as soon as it's needed, so we can return early
|
||||||
// to do a manual chdir before exec.
|
// otherwise to do a manual chdir before exec.
|
||||||
weak! {
|
weak! {
|
||||||
fn posix_spawn_file_actions_addchdir_np(
|
fn posix_spawn_file_actions_addchdir_np(
|
||||||
*mut libc::posix_spawn_file_actions_t,
|
*mut libc::posix_spawn_file_actions_t,
|
||||||
|
|
Loading…
Reference in New Issue