summary refs log tree commit diff
path: root/src/libstd/sys/unix/process
AgeCommit message (Collapse)AuthorLines
2018-04-05std: Inline some Termination-related methodsAlex Crichton-0/+1
These were showing up in tests and in binaries but are trivially optimize-able away, so add `#[inline]` attributes so LLVM has an opportunity to optimize them out.
2018-03-22Command::env_saw_path() may be unused on platforms not using posix_spawn()Bryan Drewery-0/+1
2018-03-19Don't use posix_spawn() if PATH was modified in the environment.Bryan Drewery-0/+4
The expected behavior is that the environment's PATH should be used to find the process. posix_spawn() could be used if we iterated PATH to search for the binary to execute. For now just skip posix_spawn() if PATH is modified.
2018-03-19Merge branch 'update-beta-freebsd' into freebsd-posix-spawnBryan Drewery-2/+14
2018-03-03Move process::ExitCode internals to sysScott McMurray-2/+14
Now begins the saga of fixing compilation errors on other platforms...
2018-03-02Support posix_spawn() for Linux glibc 2.24+.Bryan Drewery-2/+16
The relevant support was added in https://sourceware.org/bugzilla/show_bug.cgi?id=10354#c12
2018-03-02Use _Bryan Drewery-1/+1
2018-03-01Add comment explaining when posix_spawn() can be supported.Bryan Drewery-0/+2
2018-03-01posix_spawn() on OSX supports returning ENOENT.Bryan Drewery-2/+2
2018-02-28posix_spawn() always returns its error rather than setting errno.Bryan Drewery-1/+1
2018-02-28Support posix_spawn() for FreeBSD.Bryan Drewery-2/+2
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.
2018-02-28Remove excess newlineBryan Drewery-1/+0
2018-02-28Pass proper pointer for envp.Bryan Drewery-1/+1
2018-02-28No need to zero when an initializer for the object is already used.Bryan Drewery-3/+3
2018-02-28Avoid error for unused variablesBryan Drewery-1/+1
2018-02-28Support posix_spawn() when possible.Alex Crichton-0/+102
2018-01-26make Command.argv Send on unix platformsCorentin Henry-10/+11
Implementing Send for a specific field rather than the whole struct is safer: if a field is changed/modified and becomes non-Send, we can catch it.
2018-01-25implement Send for process::Command on unixCorentin Henry-0/+5
closes https://github.com/rust-lang/rust/issues/47751
2017-12-24Capture environment at spawnDiggory Blake-91/+78
2017-10-09Auto merge of #45041 - est31:master, r=alexcrichtonbors-3/+2
Remove support for the PNaCl target (le32-unknown-nacl) This removes support for the `le32-unknown-nacl` target which is currently supported by rustc on tier 3. Despite the "nacl" in the name, the target doesn't output native code (x86, ARM, MIPS), instead it outputs binaries in the PNaCl format. There are two reasons for the removal: * Google [has announced](https://blog.chromium.org/2017/05/goodbye-pnacl-hello-webassembly.html) deprecation of the PNaCl format. The suggestion is to migrate to wasm. Happens we already have a wasm backend! * Our PNaCl LLVM backend is provided by the fastcomp patch set that the LLVM fork used by rustc contains in addition to vanilla LLVM (`src/llvm/lib/Target/JSBackend/NaCl`). Upstream LLVM doesn't have PNaCl support. Removing PNaCl support will enable us to move away from fastcomp (#44006) and have a lighter set of patches on top of upstream LLVM inside our LLVM fork. This will help distribution packagers of Rust. Fixes #42420
2017-10-05Remove nacl from libstdest31-3/+2
2017-10-04zircon: update some more zx and lp constantsJames Tucker-22/+16
* Use size_t where size_t is used, while it's not critical on our specifically supported architectures, this is more accurate. * Update HND_SPECIAL_COUNT to the correct value, and give it the size that enum is likely to be.
2017-10-04zircon: the type of zx_handle_t is now unsignedJames Tucker-1/+6
This is a kernel ABI change that landed today. I noticed some other ABI issues and have left a note to cleanup once they are better defined.
2017-09-24LP_CLONE_FDIO_ROOT is now LP_CLONE_FDIO_NAMESPACEJames Tucker-2/+2
2017-09-24Fixed casing issues.P.Y. Laligand-16/+16
2017-09-24The Magenta kernel is now called Zircon.P.Y. Laligand-130/+130
2017-09-08Match c_char definitions and enable signal reset for L4ReSebastian Humenda-13/+15
* Match definition of c_char in os/raw.rs with the libc definition Due to historic reasons, os/raw.rs redefines types for c_char from libc, but these didn't match. Now they do :). * Enable signal reset on exec for L4Re L4Re has full signal emulation and hence it needs to reset the signal set of the child with sigemptyset. However, gid and uid should *not* be set.
2017-08-28Update the libc submoduleAlex Crichton-2/+3
Brings in a few fixes for wasm/asmjs
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-3/+3
Like #43008 (f668999), but _much more aggressive_.
2017-07-24Add a disabled builder for aarch64 emulated testsAlex Crichton-0/+1
This commit adds a disabled builder which will run all tests for the standard library for aarch64 in a QEMU instance. Once we get enough capacity to run this on Travis this can be used to boost our platform coverage of AArch64
2017-06-06Add conversions from File and Child* handles to StdioJosh Stone-0/+12
`Stdio` now implements `From<ChildStdin>`, `From<ChildStdout>`, `From<ChildStderr>`, and `From<File>`. The `Command::stdin`/`stdout`/`stderr` methods now take any type that implements `Into<Stdio>`. This makes it much easier to write shell-like command chains, piping to one another and redirecting to and from files. Otherwise one would need to use the unsafe and OS-specific `from_raw_fd` or `from_raw_handle`.
2017-06-05[fuchsia] Track change of mx_job_defaultRaph Levien-5/+1
The implementation of mx_job_default changed from a macro which accessed the __magenta_job_default global variable to a proper function call. This patch tracks that change.
2017-04-14Update magenta error codesTheodore DeRego-34/+43
2017-03-25Avoid using libc::sigemptyset on AndroidMarco A L Barbosa-2/+25
2017-03-12Update usages of 'OSX' (and other old names) to 'macOS'.Corey Farwell-3/+3
As of last year with version 'Sierra', the Mac operating system is now called 'macOS'.
2017-02-28std::process for fuchsia: updated to latest liblaunchpadTheodore DeRego-27/+31
2017-02-17Follow rename of mx_handle_wait Magenta syscallsRaph Levien-3/+3
The mx_handle_wait_* syscalls in Magenta were renamed to mx_object_wait. The syscall is used in the Magenta/Fuchsia implementation of std::process, to wait on child processes. In addition, this patch enables the use of the system provided libbacktrace library on Fuchsia targets. Symbolization is not yet working, but at least it allows printing hex addresses in a backtrace and makes building succeed when the backtrace feature is not disabled.
2017-02-08Rollup merge of #39512 - oconnor663:try_wait, r=alexcrichtonCorey Farwell-7/+7
make Child::try_wait return io::Result<Option<ExitStatus>> This is much nicer for callers who want to short-circuit real I/O errors with `?`, because they can write this if let Some(status) = foo.try_wait()? { ... } else { ... } instead of this match foo.try_wait() { Ok(status) => { ... } Err(err) if err.kind() == io::ErrorKind::WouldBlock => { ... } Err(err) => return Err(err), } The original design of `try_wait` was patterned after the `Read` and `Write` traits, which support both blocking and non-blocking implementations in a single API. But since `try_wait` is never blocking, it makes sense to optimize for the non-blocking case. Tracking issue: https://github.com/rust-lang/rust/issues/38903
2017-02-06make Child::try_wait return io::Result<Option<ExitStatus>>Jack O'Connor-7/+7
This is much nicer for callers who want to short-circuit real I/O errors with `?`, because they can write this if let Some(status) = foo.try_wait()? { ... } else { ... } instead of this match foo.try_wait() { Ok(status) => { ... } Err(err) if err.kind() == io::ErrorKind::WouldBlock => { ... } Err(err) => return Err(err), } The original design of `try_wait` was patterned after the `Read` and `Write` traits, which support both blocking and non-blocking implementations in a single API. But since `try_wait` is never blocking, it makes sense to optimize for the non-blocking case. Tracking issue: https://github.com/rust-lang/rust/issues/38903
2017-01-29Add support for test suites emulated in QEMUAlex Crichton-1/+5
This commit adds support to the build system to execute test suites that cannot run natively but can instead run inside of a QEMU emulator. A proof-of-concept builder was added for the `arm-unknown-linux-gnueabihf` target to show off how this might work. In general the architecture is to have a server running inside of the emulator which a local client connects to. The protocol between the server/client supports compiling tests on the host and running them on the target inside the emulator. Closes #33114
2017-01-24Updated Fuchsia support for std::process. Adds support for try_wait. Misc. ↵Theodore DeRego-23/+167
updates to reflect changes in Magenta
2017-01-06std: Add a nonblocking `Child::try_wait` methodAlex Crichton-0/+17
This commit adds a new method to the `Child` type in the `std::process` module called `try_wait`. This method is the same as `wait` except that it will not block the calling thread and instead only attempt to collect the exit status. On Unix this means that we call `waitpid` with the `WNOHANG` flag and on Windows it just means that we pass a 0 timeout to `WaitForSingleObject`. Currently it's possible to build this method out of tree, but it's unfortunately tricky to do so. Specifically on Unix you essentially lose ownership of the pid for the process once a call to `waitpid` has succeeded. Although `Child` tracks this state internally to be resilient to multiple calls to `wait` or a `kill` after a successful wait, if the child is waited on externally then the state inside of `Child` is not updated. This means that external implementations of this method must be extra careful to essentially not use a `Child`'s methods after a call to `waitpid` has succeeded (even in a nonblocking fashion). By adding this functionality to the standard library it should help canonicalize these external implementations and ensure they can continue to robustly reuse the `Child` type from the standard library without worrying about pid ownership.
2016-12-21Removes magenta build warning.Jason Campbell-1/+0
Small bug fix to remove an unused type in the magenta process code that causes build failures for magenta's rustc.
2016-12-01std::process fuchsia support cleanupTheodore DeRego-13/+203
2016-11-30Removed Option<ExitStatus> member from fuchsia Process struct. Destroy ↵Theodore DeRego-32/+19
launchpads and close handles in Drop impls rather than manually
2016-11-23Separated fuchsia-specific process stuff into 'process_fuchsia.rs' and ↵Theodore DeRego-0/+940
refactored out some now-duplicated code into a 'process_common.rs'