about summary refs log tree commit diff
path: root/src/libstd/sys/windows
AgeCommit message (Collapse)AuthorLines
2019-04-14Rollup merge of #59852 - alexcrichton:more-vectored, r=sfacklerMazdak Farrokhzad-3/+31
std: Add `{read,write}_vectored` for more types This commit implements the `{read,write}_vectored` methods on more types in the standard library, namely: * `std::fs::File` * `std::process::ChildStd{in,out,err}` * `std::io::Std{in,out,err}` * `std::io::Std{in,out,err}Lock` * `std::io::Std{in,out,err}Raw` Where supported the OS implementations hook up to native support, otherwise it falls back to the already-defaulted implementation.
2019-04-10std: Add `{read,write}_vectored` for more typesAlex Crichton-3/+31
This commit implements the `{read,write}_vectored` methods on more types in the standard library, namely: * `std::fs::File` * `std::process::ChildStd{in,out,err}` * `std::io::Std{in,out,err}` * `std::io::Std{in,out,err}Lock` * `std::io::Std{in,out,err}Raw` Where supported the OS implementations hook up to native support, otherwise it falls back to the already-defaulted implementation.
2019-04-10Eliminate `FnBox` usages from libstd.CrLF0710-2/+1
2019-04-04std: Avoid usage of `Once` in `Instant`Alex Crichton-6/+18
This commit removes usage of `Once` from the internal implementation of time utilities on OSX and Windows. It turns out that we accidentally hit a deadlock today (#59020) via events that look like: * A thread invokes `park_timeout` * Internally, only on OSX, `park_timeout` calls `Instant::elapsed` * Inside of `Instant::elapsed` on OSX we enter a `Once` to initialize global timer data * Inside of `Once`, it attempts to `park` This means on the same stack frame, when there's contention, we're calling `park` from inside `park_timeout`, causing a deadlock! The solution implemented in this commit was to remove usage of `Once` and instead just do a small dance with atomics. There's no real need we need to guarantee that the global information is only learned once, only that it's only *stored* once. This implementation may have multiple threads invoke `mach_timebase_info`, but only one will store the global information which will amortize the cost for all other threads. A similar fix has been applied to windows to be uniform across our implementations, but looking at the code on Windows no deadlock was possible. This is purely just a consistency update for Windows and in theory a slightly leaner implementation. Closes #59020
2019-03-31libstd: deny(elided_lifetimes_in_paths)Mazdak Farrokhzad-17/+17
2019-03-29implement `AsRawFd` for stdio locksAndy Russell-0/+21
2019-03-27Rollup merge of #59284 - RalfJung:maybe-uninit, r=sfacklerJosh Stone-1/+1
adjust MaybeUninit API to discussions uninitialized -> uninit into_initialized -> assume_init read_initialized -> read set -> write
2019-03-26fix some uses I missedRalf Jung-1/+1
2019-03-22Update sys::time impls to have checked_sub_instantLinus Färnstrand-4/+4
2019-03-11Improvements to comments in libstd, libcore, liballoc.Alexander Regueiro-3/+3
2019-03-02Auto merge of #58216 - pitdicker:sqos_flags, r=alexcrichtonbors-8/+25
Set secure flags when opening a named pipe on Windows Fixes https://github.com/rust-lang/rust/issues/42036, see also the previous attempt in https://github.com/rust-lang/rust/pull/44556. Whether this is correct depends on if it is somehow possible to create a symlink to a named pipe, outside the named pipe filesystem (NPFS). But as far as I can tell that should be impossible. Also fixes that `security_qos_flags(SECURITY_ANONYMOUS)` does not set the `SECURITY_SQOS_PRESENT` flag, and the incorrect documentation about the default value of `security_qos_flags`.
2019-02-28Fix rebase failTaiki Endo-4/+4
2019-02-28libstd => 2018Taiki Endo-249/+257
2019-02-26Auto merge of #58357 - sfackler:vectored-io, r=alexcrichtonbors-14/+144
Add vectored read and write support This functionality has lived for a while in the tokio ecosystem, where it can improve performance by minimizing copies. r? @alexcrichton
2019-02-23Correct OpenOptions::security_qos_flags documentationPaul Dicker-6/+20
2019-02-23Remove pub(crate) from stderr_rawPaul Dicker-1/+1
2019-02-20Use standard Read/Write traits in sys::stdioPaul Dicker-36/+45
2019-02-20Address review commentsPaul Dicker-22/+36
2019-02-20Refactor Windows stdio and remove stdin double bufferingPaul Dicker-116/+178
2019-02-20Remove unused Read implementation on sys::Windows::StdinPaul Dicker-9/+0
2019-02-20Remove sys::*::Stderr Write implementationPaul Dicker-14/+1
2019-02-15Fix SECURITY_SQOS_PRESENT missingPaul Dicker-2/+5
if security_qos_flags(SECURITY_ANONYMOUS) is set
2019-02-13impl Deref/DerefMut for IoVec typesSteven Fackler-3/+3
Returning &'a mut [u8] was unsound, and we may as well just have them directly deref to their slices to make it easier to work with them.
2019-02-13Add vectored read and write supportSteven Fackler-14/+144
This functionality has lived for a while in the tokio ecosystem, where it can improve performance by minimizing copies.
2019-02-10libs: doc commentsAlexander Regueiro-7/+7
2019-02-10tests: doc commentsAlexander Regueiro-8/+8
2019-02-03Improve error message and docs for non-UTF-8 bytes in stdio on WindowsAustin Bonander-1/+3
cc #23344
2019-01-26Replace deprecated ATOMIC_INIT constsMark Rousskov-2/+2
2019-01-23Add a comment on the meaning of Instant t: DurationAlex Berghage-0/+2
2019-01-22Rebase and fix new instantiation fnAlex Berghage-1/+1
2019-01-22Move Instant backing type to DurationAlex Berghage-22/+14
Per review comments, this commit switches out the backing type for Instant on windows to a Duration. Tests all pass, and the code's a lot simpler (plus it should be portable now, with the exception of the QueryPerformanceWhatever functions).
2019-01-22Simplify units in Duration/Instant math on WindowsAlex Berghage-42/+78
Right now we do unit conversions between PerfCounter measurements and nanoseconds for every add/sub we do between Durations and Instants on Windows machines. This leads to goofy behavior, like this snippet failing: ``` let now = Instant::now(); let offset = Duration::from_millis(5); assert_eq!((now + offset) - now, (now - now) + offset); ``` with precision problems like this: ``` thread 'main' panicked at 'assertion failed: `(left == right)` left: `4.999914ms`, right: `5ms`', src\main.rs:6:5 ``` To fix it, this changeset does the unit conversion once, when we measure the clock, and all the subsequent math in u64 nanoseconds. It also adds an exact associativity test to the `sys/time.rs` test suite to make sure we don't regress on this in the future.
2019-01-13Cosmetic improvementsAlexander Regueiro-3/+2
2019-01-10std: Render large exit codes as hex on WindowsAlex Crichton-1/+10
On Windows process exit codes are never signals but rather always 32-bit integers. Most faults like segfaults and such end up having large integers used to represent them, like STATUS_ACCESS_VIOLATION being 0xC0000005. Currently, however, when an `ExitStatus` is printed this ends up getting rendered as 3221225477 which is somewhat more difficult to debug. This commit adds a branch in `Display for ExitStatus` on Windows which handles exit statuses where the high bit is set and prints those exit statuses as hex instead of with decimals. This will hopefully preserve the current display for small exit statuses (like `exit code: 22`), but assist in quickly debugging segfaults/access violations/etc. I've found at least that the hex codes are easier to search for than decimal. I wasn't able to find any official documentation saying that all system exit codes have the high bit set, but I figure it's a good enough heuristic for now.
2019-01-07std: Force `Instant::now()` to be monotonicAlex Crichton-0/+8
This commit is an attempt to force `Instant::now` to be monotonic through any means possible. We tried relying on OS/hardware/clock implementations, but those seem buggy enough that we can't rely on them in practice. This commit implements the same hammer Firefox recently implemented (noted in #56612) which is to just keep whatever the lastest `Instant::now()` return value was in memory, returning that instead of the OS looks like it's moving backwards. Closes #48514 Closes #49281 cc #51648 cc #56560 Closes #56612 Closes #56940
2019-01-05Rollup merge of #57314 - wiktorkuchta:master, r=Centrilkennytm-1/+1
Fix repeated word typos Inspired by #57295 (I skipped 'be be' because of it) and my [PR in another repo ](https://github.com/e-maxx-eng/e-maxx-eng/pull/389) Not a stupid `sed`, I actually tried to fix case by case.
2019-01-05Rollup merge of #57238 - Zoxc:bt-fix, r=alexcrichtonkennytm-1/+10
Fix backtraces for inlined functions on Windows Fixes an regression introduced in https://github.com/rust-lang/rust/pull/50526 r? @alexcrichton
2019-01-03Fix repeated word typosWiktor Kuchta-1/+1
Found with `git grep -P '\b([a-z]+)\s+\1\b'`
2019-01-01privacy: Use common `DefId` visiting infra for all privacy visitorsVadim Petrochenkov-10/+0
2018-12-31Fix backtraces on WindowsJohn Kåre Alsaker-1/+10
2018-12-25Remove licensesMark Rousskov-379/+0
2018-12-21Auto merge of #56813 - oli-obk:main_🧶, r=pnkfelixbors-1/+0
Always run rustc in a thread cc @ishitatsuyuki @eddyb r? @pnkfelix [Previously](https://github.com/rust-lang/rust/pull/48575) we moved to only producing threads when absolutely necessary. Even before we opted to only create threads in some cases, which [is unsound](https://github.com/rust-lang/rust/pull/48575#issuecomment-380635967) due to the way we use thread local storage.
2018-12-14Remove dead codeOliver Scherer-1/+0
2018-12-14Auto merge of #56568 - notriddle:master, r=alexcrichtonbors-52/+209
Remove dependency on shell32.dll Closes #56510 if it works on MinGW (I've only tested it on MSVC).
2018-12-14Auto merge of #56490 - faern:add-checked-add-to-instant, r=alexcrichtonbors-36/+23
Add checked_add method to Instant time type Appending functionality to the already opened topic of `checked_add` on time types over at #55940. Doing checked addition between an `Instant` and a `Duration` is important to reliably determine a future instant. We could use this in the `parking_lot` crate to compute an instant when in the future to wake a thread up without risking a panic.
2018-12-13Add checked_sub for Instant and SystemTimeLinus Färnstrand-16/+9
2018-12-13Add checked_add method to Instant time typeLinus Färnstrand-20/+14
2018-12-12Bump to 1.33.0Alex Crichton-1/+1
* Update bootstrap compiler * Update version to 1.33.0 * Remove some `#[cfg(stage0)]` annotations Actually updating the version number is blocked on updating Cargo
2018-12-11Use iterators instead of raw offsets in Windows argument parserMichael Howell-49/+45
2018-12-10Fix iterator nitsMichael Howell-18/+7