about summary refs log tree commit diff
path: root/src/libstd/sys/unix
AgeCommit message (Collapse)AuthorLines
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-22libstd: replace all `try!` with `?` in documentation examplesUtkarsh Kukreti-5/+5
See #38644.
2017-01-14Add doc examples & description in `std::os::unix::ffi`.Corey Farwell-3/+57
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-26std: Clamp max read/write sizes on UnixAlex Crichton-5/+22
Turns out that even though all these functions take a `size_t` they don't actually work that well with anything larger than the maximum value of `ssize_t`, the return value. Furthermore it looks like OSX rejects any read/write requests larger than `INT_MAX - 1`. Handle all these cases by just clamping the maximum size of a read/write on Unix to a platform-specific value. Closes #38590
2016-12-24Rollup merge of #38521 - jxson:remove-magenta-warnings, r=sfacklerSteve Klabnik-1/+0
Removes magenta build warning. Small bug fix to remove an unused type in the magenta process code that causes build failures for magenta's rustc. r? @alexcrichton @tedsta @raphlinus
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-20Fix compile errors and suchAlex Crichton-4/+3
2016-12-20Rollup merge of #38236 - GuillaumeGomez:unix_socket_doc, r=frewsxcvAlex Crichton-26/+566
Unix socket doc r? @frewsxcv
2016-12-18Implement `fmt::Debug` for all structures in libstd.Corey Farwell-1/+10
Part of https://github.com/rust-lang/rust/issues/31869. Also turn on the `missing_debug_implementations` lint at the crate level.
2016-12-16Add missing doc examples for UnixDatagramGuillaume Gomez-38/+285
2016-12-15Stabilize std::os::unix::process::CommandExt::before_execAaron Turon-1/+1
2016-12-15Stabilize std::os::*::fs::FileExtAaron Turon-5/+5
2016-12-12Merge branch 'master' into redoxJeremy Soller-248/+705
2016-12-09Auto merge of #38197 - mneumann:dragonfly-fixes-2016-12-06, r=alexcrichtonbors-7/+2
Fix current_exe() on DragonFly (again) This is a follow up on [this pull request][1]. Since DragonFly 4.6.1 ([this commit][2]), the ```kern.proc.pathname``` sysctl works correctly, i.e. it does not return paths including a ```:``` (see [here][3]). Use it and don't try to fix old versions of DragonFly! There are not many DragonFly installations out there that we can't control and no one is compiling Rust from source. If someone wants to run Rust on a pre-4.6.1 DragonFly system, the ports system should provide a patch. [1]: https://github.com/rust-lang/rust/pull/35494 [2]: https://gitweb.dragonflybsd.org/dragonfly.git/commit/726f7ca07e193db73635e9c4e24e40c96087d6d9 [3]: https://gist.github.com/mneumann/a2f6b6a0a03935b561d6185872a4b222
2016-12-08Add Incoming doc examplesGuillaume Gomez-3/+30
2016-12-08Add UnixListener doc examplesGuillaume Gomez-10/+101
2016-12-08Add doc examples for UnixStreamGuillaume Gomez-6/+145
2016-12-08Add missing doc examples for SocketAddr structGuillaume Gomez-0/+36
2016-12-08Auto merge of #38146 - kali:master, r=alexcrichtonbors-2/+15
fix objc ABI in std::env::args iOS use different calling convention for `objc_msgSend` depending on the platform. armv7 expect good old variadic arguments, but aarch64 wants "normal" convention: `objc_msgSend` has to be called mimicking the actual callee prototype. https://developer.apple.com/library/content/documentation/General/Conceptual/CocoaTouch64BitGuide/ConvertingYourAppto64-Bit/ConvertingYourAppto64-Bit.html#//apple_ref/doc/uid/TP40013501-CH3-SW26 This currently breaks std::env:args() on aarch64 iOS devices. As far as I can tell, in the standard library, this is the only occurrence of ObjectiveC dispatching.
2016-12-06Fix current_exe() on DragonFly (again)Michael Neumann-7/+2
This is a follow up on [this pull request][1]. Since DragonFly 4.6.1 ([this commit][2]), the "kern.proc.pathname" sysctl works correctly, i.e. it does not return paths including a ":" (see [here][3]). Use it and don't try to fix old versions of DragonFly! There are not many DragonFly installations out there that we can't control and no one is compiling Rust from source. If someone wants to run Rust on a pre-4.6.1 DragonFly system, the ports system should provide a patch. [1]: https://github.com/rust-lang/rust/pull/35494 [2]: https://gitweb.dragonflybsd.org/dragonfly.git/commit/726f7ca07e193db73635e9c4e24e40c96087d6d9 [3]: https://gist.github.com/mneumann/a2f6b6a0a03935b561d6185872a4b222
2016-12-04Fix small typoGuillaume Gomez-1/+1
2016-12-03fix objc ABI in std::env::argsMathieu Poumeyrol-2/+15
2016-12-02Auto merge of #37936 - tedsta:fuchsia_std_process, r=alexcrichtonbors-238/+687
Fuchsia support for std::process via liblaunchpad. Now we can launch processes on Fuchsia via the Rust standard library! ... Mostly. Right now, ~5% of the time, reading the stdout/stderr off the pipes will fail. Some Magenta kernel people think it's probably a bug in Magenta's pipes. I wrote a unit test that demonstrates the issue in C, which I was told will expedite a fix. https://fuchsia-review.googlesource.com/#/c/15628/ Hopefully this can get merged once the issue is fixed :) @raphlinus
2016-12-01std::process fuchsia support cleanupTheodore DeRego-34/+26
2016-11-30Removed Option<ExitStatus> member from fuchsia Process struct. Destroy ↵Theodore DeRego-32/+45
launchpads and close handles in Drop impls rather than manually
2016-11-28Commit to fix make tidyJeremy Soller-1/+1
2016-11-28Move stdout/err flush into sysJeremy Soller-1/+12
2016-11-23Separated fuchsia-specific process stuff into 'process_fuchsia.rs' and ↵Theodore DeRego-868/+940
refactored out some now-duplicated code into a 'process_common.rs'
2016-11-22Cleaned up and appeased the linterTheodore DeRego-66/+28
2016-11-22Fuchsia support for std::process via liblaunchpad.Theodore DeRego-3/+413
2016-11-22Add a method for setting permissions directly on an open file.Steven Allen-0/+5
On unix like systems, the underlying file corresponding to any given path may change at any time. This function makes it possible to set the permissions of the a file corresponding to a `File` object even if its path changes.
2016-11-04std: Track change to cprng syscall signature (Fuchsia)Raph Levien-8/+20
The mx_cprng_draw syscall has changed signature to separate the status and size return values, rather than multiplexing them into a single value with errors interpreted as a negative value. This patch tracks that change.
2016-11-01std: Move platform-specific out of sys_common::utilBrian Anderson-0/+11
2016-11-01std: Move a plattform-specific constant to sys::stdioBrian Anderson-0/+1
2016-11-01std: Move elf TLS to sys::fast_thread_localBrian Anderson-0/+168
2016-10-28Auto merge of #37385 - raphlinus:fuchsia_random, r=alexcrichtonbors-1/+53
Add support for kernel randomness for Fuchsia Wire up cprng syscall as provider for rand::os::OsRng on Fuchsia.
2016-10-24Add support for kernel randomness for FuchsiaRaph Levien-1/+53
Wire up cprng syscall as provider for rand::os::OsRng on Fuchsia.
2016-10-22Fix tidy warningRaph Levien-1/+1
Prefer FIXME to TODO
2016-10-22Fix missing DirEntryExt::inoRaph Levien-2/+2
The DirEntryExt::ino() implementation was omitted from the first iteration of this patch, because a dependency needed to be configured. The fix is straightforward enough.
2016-10-22Add Fuchsia supportRaph Levien-5/+30
Adds support for the x86_64-unknown-fuchsia target, which covers the Fuchsia operating system.
2016-10-16impl Debug for ReadDirDavid Henningsson-0/+8
It is good practice to implement Debug for public types, and indicating what directory you're reading seems useful. Signed-off-by: David Henningsson <diwic@ubuntu.com>
2016-10-14Auto merge of #35704 - tbu-:pr_pread_pwrite, r=alexcrichtonbors-6/+160
Implement `read_offset` and `write_offset` These functions allow to read from and write to a file from multiple threads without changing the per-file cursor, avoiding the race between the seek and the read.
2016-10-14Android: Fix unused-imports warningTobias Bucher-1/+2
2016-10-14Only use Android fallback for {ftruncate,pread,pwrite} on 32 bitTobias Bucher-0/+24
2016-10-12Remove unnecessary `unsafe` blockTobias Bucher-20/+16
2016-10-11Fix Android compilation `io::Error` -> `io::ErrorKind`Tobias Bucher-2/+2
2016-10-09use MSG_NOSIGNAL on all relevant platformsMathieu Poumeyrol-3/+9
2016-10-09Use `try_into` and move some functionsTobias Bucher-29/+37
2016-10-09Dynamically detect presence of `p{read,write}64` on AndroidTobias Bucher-23/+68