about summary refs log tree commit diff
path: root/src/libstd/sys
AgeCommit message (Collapse)AuthorLines
2017-01-27Rollup merge of #39307 - alexcrichton:stabilize-1.16, r=brsonAlex Crichton-3/+3
std: Stabilize APIs for the 1.16.0 release This commit applies the stabilization/deprecations of the 1.16.0 release, as tracked by the rust-lang/rust issue tracker and the final-comment-period tag. The following APIs were stabilized: * `VecDeque::truncate` * `VecDeque::resize` * `String::insert_str` * `Duration::checked_{add,sub,div,mul}` * `str::replacen` * `SocketAddr::is_ipv{4,6}` * `IpAddr::is_ipv{4,6}` * `str::repeat` * `Vec::dedup_by` * `Vec::dedup_by_key` * `Result::unwrap_or_default` * `<*const T>::wrapping_offset` * `<*mut T>::wrapping_offset` * `CommandExt::creation_flags` (on Windows) * `File::set_permissions` * `String::split_off` The following APIs were deprecated * `EnumSet` - replaced with other ecosystem abstractions, long since unstable Closes #27788 Closes #35553 Closes #35774 Closes #36436 Closes #36949 Closes #37079 Closes #37087 Closes #37516 Closes #37827 Closes #37916 Closes #37966 Closes #38080
2017-01-25std: Stabilize APIs for the 1.16.0 releaseAlex Crichton-3/+3
This commit applies the stabilization/deprecations of the 1.16.0 release, as tracked by the rust-lang/rust issue tracker and the final-comment-period tag. The following APIs were stabilized: * `VecDeque::truncate` * `VecDeque::resize` * `String::insert_str` * `Duration::checked_{add,sub,div,mul}` * `str::replacen` * `SocketAddr::is_ipv{4,6}` * `IpAddr::is_ipv{4,6}` * `str::repeat` * `Vec::dedup_by` * `Vec::dedup_by_key` * `Result::unwrap_or_default` * `<*const T>::wrapping_offset` * `<*mut T>::wrapping_offset` * `CommandExt::creation_flags` (on Windows) * `File::set_permissions` * `String::split_off` The following APIs were deprecated * `EnumSet` - replaced with other ecosystem abstractions, long since unstable Closes #27788 Closes #35553 Closes #35774 Closes #36436 Closes #36949 Closes #37079 Closes #37087 Closes #37516 Closes #37827 Closes #37916 Closes #37966 Closes #38080
2017-01-25Rollup merge of #39212 - redox-os:master, r=brsonGuillaume Gomez-1/+8
Use libc errno in Redox submodule This fixes https://github.com/redox-os/redox/issues/830, and is necessary when using libc in Redox
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-12/+12
See #38644.
2017-01-20Use libc errnoJeremy Soller-1/+8
2017-01-16Rollup merge of #39065 - frewsxcv:libstd-os-unix-ffi-docs, r=GuillaumeGomezGuillaume Gomez-3/+57
Add doc examples & description in `std::os::unix::ffi`. None
2017-01-14Add doc examples & description in `std::os::unix::ffi`.Corey Farwell-3/+57
2017-01-13Add try_wait to Redox processJeremy Soller-0/+14
2017-01-09Auto merge of #38866 - alexcrichton:try-wait, r=aturonbors-0/+33
std: Add a nonblocking `Child::try_wait` method 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.
2017-01-06std: Add a nonblocking `Child::try_wait` methodAlex Crichton-0/+33
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.
2017-01-04std: Don't pass overlapped handles to processesAlex Crichton-29/+63
This commit fixes a mistake introduced in #31618 where overlapped handles were leaked to child processes on Windows. On Windows once a handle is in overlapped mode it should always have I/O executed with an instance of `OVERLAPPED`. Most child processes, however, are not prepared to have their stdio handles in overlapped mode as they don't use `OVERLAPPED` on reads/writes to the handle. Now we haven't had any odd behavior in Rust up to this point, and the original bug was introduced almost a year ago. I believe this is because it turns out that if you *don't* pass an `OVERLAPPED` then the system will [supply one for you][link]. In this case everything will go awry if you concurrently operate on the handle. In Rust, however, the stdio handles are always locked, and there's no way to not use them unlocked in libstd. Due to that change we've always had synchronized access to these handles, which means that Rust programs typically "just work". Conversely, though, this commit fixes the test case included, which exhibits behavior that other programs Rust spawns may attempt to execute. Namely, the stdio handles may be concurrently used and having them in overlapped mode wreaks havoc. [link]: https://blogs.msdn.microsoft.com/oldnewthing/20121012-00/?p=6343 Closes #38811
2017-01-04Auto merge of #38707 - redox-os:master, r=brsonbors-26/+128
Add socket timeout and ttl support in `sys::redox` This adds support for `read_timeout`, `write_timeout`, and `ttl` on `TcpStream`, `TcpListener`, and `UdpSocket` in the `sys::redox` module. The DNS lookup has been set to use a 5 second timeout by default.
2017-01-02Reword 'stupid' and 'crazy' in docs.Clar Charr-1/+1
2016-12-30Add socket timeout and ttl supportJeremy Soller-26/+128
2016-12-29Rollup merge of #38622 - alexcrichton:read-lengths, r=sfacklerAlex Crichton-12/+24
std: Clamp max read/write sizes on Unix 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-27Fix arguments on RedoxJeremy Soller-9/+5
2016-12-27Auto merge of #38577 - redox-os:master, r=alexcrichtonbors-2/+3
Add Debug to OpenOptions and DirBuilder This fixes the build on Redox as the platform independent structs now implement Debug.
2016-12-26Auto merge of #38274 - elahn:windows-readconsole-ctrl-z, r=alexcrichtonbors-4/+33
Ctrl-Z returns from Stdin.read() when reading from the console on Windows Fixes #19914. Fixes read(), read_to_string(), read_to_end(), etc. r? @alexcrichton
2016-12-26std: Clamp max read/write sizes on UnixAlex Crichton-12/+24
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-23Cloexec when creating directoriesJeremy Soller-1/+1
2016-12-23Add Debug to OpenOptions and DirBuilderJeremy Soller-1/+2
2016-12-23Auto merge of #38401 - redox-os:redox_cross, r=brsonbors-22/+1317
Redox Cross Compilation I will admit - there are things here that I wish I did not have to do. This completes the ability to create a cross compiler from the rust repository for `x86_64-unknown-redox`. I will document this PR with inline comments explaining some things. [View this gist to see how a cross compiler is built](https://gist.github.com/jackpot51/6680ad973986e84d69c79854249f2b7e) Prior discussion of a smaller change is here: https://github.com/rust-lang/rust/pull/38366
2016-12-22Remove start functions, use newlib instead of openlibm + rallocJeremy Soller-155/+0
2016-12-21Add RawFd traits for netJeremy Soller-15/+64
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 tidyJeremy Soller-3/+6
2016-12-20Fix building without backtraceJeremy Soller-0/+1
2016-12-20Readd statvfsJeremy Soller-0/+26
2016-12-20Move rt into sys::rt, fix tidyJeremy Soller-334/+161
2016-12-20Fix compile errors and suchAlex Crichton-4/+5
2016-12-20Rollup merge of #38236 - GuillaumeGomez:unix_socket_doc, r=frewsxcvAlex Crichton-26/+566
Unix socket doc r? @frewsxcv
2016-12-20Rollup merge of #38006 - frewsxcv:libstd-debug, r=alexcrichtonAlex Crichton-2/+12
Implement `fmt::Debug` for all structures in libstd. Part of https://github.com/rust-lang/rust/issues/31869. Also turn on the `missing_debug_implementations` lint at the crate level.
2016-12-20Add arm syscallsJeremy Soller-2/+78
2016-12-18Implement `fmt::Debug` for all structures in libstd.Corey Farwell-2/+12
Part of https://github.com/rust-lang/rust/issues/31869. Also turn on the `missing_debug_implementations` lint at the crate level.
2016-12-18Auto merge of #38051 - sanxiyn:unused-type-alias-3, r=eddybbors-3/+2
Warn unused type aliases, reimplemented Reimplementation of #37631. Fix #37455.
2016-12-18Fix WindowsSeo Sanghyeon-3/+2
2016-12-16Address falloutAaron Turon-1/+1
2016-12-16Add missing doc examples for UnixDatagramGuillaume Gomez-38/+285
2016-12-15Add start functions, switch allocation crate to rallocJeremy Soller-3/+78
2016-12-15WIP: Cross-compilation for Redox targetJeremy Soller-7/+1400
2016-12-15Stabilize std::os::unix::process::CommandExt::before_execAaron Turon-1/+1
2016-12-15Stabilize std::os::*::fs::FileExtAaron Turon-10/+10
2016-12-12Fix tidy checksJeremy Soller-1/+2
2016-12-12Merge branch 'master' into redoxJeremy Soller-250/+731
2016-12-12Fix accidental removal of importJeremy Soller-0/+1
2016-12-12Rollback prefixJeremy Soller-3/+3
2016-12-10Ctrl-Z returns from Stdin.read() when reading from the console onElahn Ientile-4/+33
Windows. Fixes #19914. Fixes read(), read_to_string(), read_to_end(), etc.
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