diff options
| author | Bryan Drewery <bryan@shatow.net> | 2018-02-27 14:12:52 -0800 |
|---|---|---|
| committer | Bryan Drewery <bryan@shatow.net> | 2018-02-28 15:36:32 -0800 |
| commit | 85b82f254e28f5e50b25d8e096af0f01e4441ef7 (patch) | |
| tree | 678c934bdccd363b7d3ed889d9ec4b42cb7e0396 /src/libstd/sys/unix/process/process_unix.rs | |
| parent | b3ecf5f57ca9d34d10ffd9d064a027ce3f4888ac (diff) | |
| download | rust-85b82f254e28f5e50b25d8e096af0f01e4441ef7.tar.gz rust-85b82f254e28f5e50b25d8e096af0f01e4441ef7.zip | |
Support posix_spawn() for FreeBSD.
spawn() is expected to return an error if the specified file could not be executed. FreeBSD's posix_spawn() supports returning ENOENT/ENOEXEC if the exec() fails, which not all platforms support. This brings a very significant performance improvement for FreeBSD, involving heavy use of Command in threads, due to fork() invoking jemalloc fork handlers and causing lock contention. FreeBSD's posix_spawn() avoids this problem due to using vfork() internally.
Diffstat (limited to 'src/libstd/sys/unix/process/process_unix.rs')
| -rw-r--r-- | src/libstd/sys/unix/process/process_unix.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstd/sys/unix/process/process_unix.rs b/src/libstd/sys/unix/process/process_unix.rs index fa66245abb6..c7841a861ce 100644 --- a/src/libstd/sys/unix/process/process_unix.rs +++ b/src/libstd/sys/unix/process/process_unix.rs @@ -235,14 +235,14 @@ impl Command { io::Error::last_os_error() } - #[cfg(not(any(target_os = "linux", target_os = "macos")))] + #[cfg(not(any(target_os = "freebsd")))] fn posix_spawn(&mut self, _stdio: &ChildPipes, _envp: Option<&CStringArray>) -> io::Result<Option<Process>> { Ok(None) } - #[cfg(any(target_os = "linux", target_os = "macos"))] + #[cfg(any(target_os = "freebsd"))] fn posix_spawn(&mut self, stdio: &ChildPipes, envp: Option<&CStringArray>) -> io::Result<Option<Process>> { |
