diff options
| author | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2020-10-01 00:00:00 +0000 |
|---|---|---|
| committer | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2020-10-01 00:00:00 +0000 |
| commit | 9845e7d5fbfd961c0299c974e701357d79af3cf8 (patch) | |
| tree | 8f640cc1544058a0f1ae3b7218081df1ddcad6d9 /library/std/src/sys/unix/process/process_unix.rs | |
| parent | 2ad6187ce51eb3a304ca448b8676870f95ab5b11 (diff) | |
| download | rust-9845e7d5fbfd961c0299c974e701357d79af3cf8.tar.gz rust-9845e7d5fbfd961c0299c974e701357d79af3cf8.zip | |
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.
Diffstat (limited to 'library/std/src/sys/unix/process/process_unix.rs')
| -rw-r--r-- | library/std/src/sys/unix/process/process_unix.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/library/std/src/sys/unix/process/process_unix.rs b/library/std/src/sys/unix/process/process_unix.rs index c3625d306ab..3ab396e5d5e 100644 --- a/library/std/src/sys/unix/process/process_unix.rs +++ b/library/std/src/sys/unix/process/process_unix.rs @@ -252,7 +252,8 @@ impl Command { #[cfg(not(any( target_os = "macos", 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( &mut self, @@ -267,7 +268,8 @@ impl Command { #[cfg(any( target_os = "macos", 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( &mut self, @@ -297,10 +299,10 @@ impl Command { } } - // Solaris and glibc 2.29+ can set a new working directory, and maybe - // others will gain this non-POSIX function too. We'll check for this - // weak symbol as soon as it's needed, so we can return early otherwise - // to do a manual chdir before exec. + // Solaris, glibc 2.29+, and musl 1.24+ can set a new working directory, + // and maybe others will gain this non-POSIX function too. We'll check + // for this weak symbol as soon as it's needed, so we can return early + // otherwise to do a manual chdir before exec. weak! { fn posix_spawn_file_actions_addchdir_np( *mut libc::posix_spawn_file_actions_t, |
