summary refs log tree commit diff
path: root/library/std/src/sys/windows
AgeCommit message (Collapse)AuthorLines
2022-05-17Revert "Add `set_inheritable` for Windows `Handle`s"Mark Rousskov-4/+0
This reverts commit b89b0567427932fe37851a314610d795258f1834.
2022-05-17Revert "Windows: Make stdin pipes synchronous"Mark Rousskov-85/+31
This reverts commit 949b978ec9d63b0eea23d89bad16c6f022ac34a3.
2022-05-17Revert "Note the importance of using sync pipes"Mark Rousskov-19/+1
This reverts commit 1e7c15634d3b81b595d669382e45e6e136c730e1.
2022-05-11Rollup merge of #96861 - m-ou-se:std-use-prelude-2021, r=joshtriplettYuki Okushi-5/+0
Use Rust 2021 prelude in std itself.
2022-05-10Expose process main_thread_handle on Windowsunknown-7/+38
2022-05-09Use Rust 2021 prelude in std itself.Mara Bos-5/+0
2022-05-09Auto merge of #96802 - gimbles:windows_slice, r=thomccbors-0/+1
[feat] Make sys::windows::os_str::Slice repr(transparent) Fixes #96577
2022-05-08fix panic in Path::strip_prefixname1e5s-0/+12
2022-05-07[fix] remove pub(crate) visibilitygimbles-1/+1
2022-05-06[feat] Make sys::windows::os_str::Slice repr(transparent)gimbles-1/+2
2022-04-29Auto merge of #96441 - ChrisDenton:sync-pipes, r=m-ou-sebors-31/+107
Windows: Make stdin pipes synchronous Stdin pipes do not need to be used asynchronously within the standard library. This is a first step in making pipes mostly synchronous. r? `@m-ou-se`
2022-04-28Auto merge of #96393 - joboet:pthread_parker, r=thomccbors-7/+13
std: directly use pthread in UNIX parker implementation `Mutex` and `Condvar` are being replaced by more efficient implementations, which need thread parking themselves (see #93740). Therefore we should use the `pthread` synchronization primitives directly. Also, we can avoid allocating the mutex and condition variable because the `Parker` struct is being placed in an `Arc` anyways. This basically is just a copy of the current `Mutex` and `Condvar` code, which will however be removed (again, see #93740). An alternative implementation could be to use dedicated private `OsMutex` and `OsCondvar` types, but all the other platforms supported by std actually have their own thread parking primitives. I used `Pin` to guarantee a stable address for the `Parker` struct, while the current implementation does not, rather using extra unsafe declaration. Since the thread struct is shared anyways, I assumed this would not add too much clutter while being clearer.
2022-04-27Note the importance of using sync pipesChris Denton-1/+19
2022-04-26Windows: Make stdin pipes synchronousChris Denton-31/+85
Stdin pipes do not need to be used asynchronously within the standard library.
2022-04-26Add `set_inheritable` for Windows `Handle`sChris Denton-0/+4
2022-04-25std: directly use pthread in UNIX parker implementationjoboet-7/+13
Mutex and Condvar are being replaced by more efficient implementations, which need thread parking themselves (see #93740). Therefore use the pthread synchronization primitives directly. Also, avoid allocating because the Parker struct is being placed in an Arc anyways.
2022-04-25Auto merge of #95246 - ChrisDenton:command-args, r=joshtriplettbors-91/+191
Windows Command: Don't run batch files using verbatim paths Fixes #95178 Note that the first commit does some minor refactoring (moving command line argument building to args.rs). The actual changes are in the second.
2022-04-23Auto merge of #96314 - AronParker:issue-96297-fix, r=thomccbors-1/+7
Reduce allocations for path conversions on Windows Previously, UTF-8 to UTF-16 Path conversions on Windows unnecessarily allocate twice, as described in #96297. This commit fixes that issue.
2022-04-23Auto merge of #94887 - dylni:move-normpath-crate-impl-to-libstd, r=ChrisDentonbors-29/+115
Improve Windows path prefix parsing This PR fixes improves parsing of Windows path prefixes. `parse_prefix` now supports both types of separators on Windows (`/` and `\`).
2022-04-22Remove redundant type annotationAron Parker-1/+1
2022-04-22Reduce allocations for path conversions on WindowsAron Parker-1/+7
Previously, UTF-8 to UTF-16 Path conversions on Windows unnecessarily allocate twice, as described in #96297. This commit fixes that issue.
2022-04-17Improve Windows path prefix parsingdylni-29/+115
2022-04-16Use a single ReentrantMutex implementation on all platforms.Mara Bos-50/+1
2022-04-15Auto merge of #94079 - petrochenkov:cstr, r=joshtriplettbors-1/+0
library: Move `CStr` to libcore, and `CString` to liballoc Closes https://github.com/rust-lang/rust/issues/46736 Interesting points: - Stability: - To make `CStr(ing)` from libcore/liballoc unusable without enabling features I had to make these structures unstable, and reexport them from libstd using stable type aliases instead of `pub use` reexports. (Because stability of `use` items is not checked.) - Relying on target ABI in libcore is ok: - https://github.com/rust-lang/rust/pull/94079#issuecomment-1044263371 - `trait CStrExt` (UPDATE: used only in `cfg(bootstrap)` mode, otherwise lang items are used instead) - https://github.com/rust-lang/rust/pull/94079#issuecomment-1047863450 - `strlen` - https://github.com/rust-lang/rust/pull/94079#issuecomment-1047863450 Otherwise it's just a code move + some minor hackery usual for liballoc in `cfg(test)` mode.
2022-04-15Auto merge of #95841 - ChrisDenton:pipe-server, r=m-ou-sebors-1/+50
Windows: Use a pipe relay for chaining pipes Fixes #95759 This fixes the issue by chaining pipes synchronously and manually pumping messages between them. It's not ideal but it has the advantage of not costing anything if pipes are not chained ("don't pay for what you don't use") and it also avoids breaking existing code that rely on our end of the pipe being asynchronous (which includes rustc's own testing framework). Libraries can avoid needing this by using their own pipes to chain commands.
2022-04-14library: Remove definitions and reexports of `strlen` from libstdVadim Petrochenkov-1/+0
2022-04-09Rollup merge of #95802 - RalfJung:unused-win, r=Dylan-DPCDylan DPC-0/+1
fix unused constant warning on some Windows targets When none of those `cfg_if!` apply (and on Miri), the constant remains unused.
2022-04-08fix some unused constant warning on some Windows targetsRalf Jung-0/+1
2022-04-08Auto merge of #95798 - Dylan-DPC:rollup-51hx1wl, r=Dylan-DPCbors-2/+5
Rollup of 7 pull requests Successful merges: - #95102 (Add known-bug for #95034) - #95579 (Add `<[[T; N]]>::flatten{_mut}`) - #95634 (Mailmap update) - #95705 (Promote x86_64-unknown-none target to Tier 2 and distribute build artifacts) - #95761 (Kickstart the inner usage of `macro_metavar_expr`) - #95782 (Windows: Increase a pipe's buffer capacity to 64kb) - #95791 (hide an #[allow] directive from the Arc::new_cyclic doc example) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-04-08Windows: Use a pipe relay for chaining pipesChris Denton-1/+50
2022-04-08Auto merge of #95775 - RalfJung:miri-windows-compat, r=ChrisDentonbors-8/+17
make windows compat_fn (crudely) work on Miri With https://github.com/rust-lang/rust/pull/95469, Windows `compat_fn!` now has to be supported by Miri to even make stdout work. Unfortunately, it relies on some outside-of-Rust linker hacks (`#[link_section = ".CRT$XCU"]`) that are rather hard to make work in Miri. So I came up with this crude hack to make this stuff work in Miri regardless. It should come at no cost for regular executions, so I hope this is okay. Cc https://github.com/rust-lang/rust/issues/95627 `@ChrisDenton`
2022-04-07Windows: Increase a pipe's buffer capacity to 64kbChris Denton-2/+5
This brings it inline with typical Linux defaults: https://www.man7.org/linux/man-pages/man7/pipe.7.html
2022-04-07do not round-trip function pointer through integerRalf Jung-5/+4
2022-04-07make windows compat_fn (crudely) work on MiriRalf Jung-4/+14
2022-04-06Rename RWLock to RwLock in std::sys.Mara Bos-8/+8
2022-04-05Use rtabortChris Denton-2/+1
2022-04-05Make `synchronous_write` safe to callChris Denton-23/+18
2022-04-05Complete reads and writes synchronously or abortChris Denton-66/+137
2022-04-05Correct definition of `IO_STATUS_BLOCK`Chris Denton-5/+11
2022-04-04Rollup merge of #95467 - ChrisDenton:async-read-pipe, r=joshtriplettDylan DPC-2/+140
Windows: Synchronize asynchronous pipe reads and writes On Windows, the pipes used for spawned processes are opened for asynchronous access but `read` and `write` are done using the standard methods that assume synchronous access. This means that the buffer (and variables on the stack) may be read/written to after the function returns. This PR ensures reads/writes complete before returning. Note that this only applies to pipes we create and does not affect the standard file read/write methods. Fixes #95411
2022-04-04Correct calling conventionChris Denton-2/+2
2022-04-04Update library/std/src/sys/windows/pipe.rsChris Denton-4/+6
2022-03-30Synchronize asynchronous pipe reads and writesChris Denton-2/+138
2022-03-29Make the stdlib largely conform to strict provenance.Aria Beingessner-16/+19
Some things like the unwinders and system APIs are not fully conformant, this only covers a lot of low-hanging fruit.
2022-03-25Check for `"` and `\` in a filenameChris Denton-1/+9
And also fix typo.
2022-03-23Auto merge of #95173 - m-ou-se:sys-locks-module, r=dtolnaybors-5/+9
Move std::sys::{mutex, condvar, rwlock} to std::sys::locks. This cleans up the the std::sys modules a bit by putting the locks in a single module called `locks` rather than spread over the three modules `mutex`, `condvar`, and `rwlock`. This makes it easier to organise lock implementations, which helps with https://github.com/rust-lang/rust/issues/93740.
2022-03-23Command: handle exe and batch files separatelyChris Denton-22/+113
2022-03-23Refactor: Move argument building into argsChris Denton-69/+70
2022-03-22Move std::sys::{mutex, condvar, rwlock} to std::sys::locks.Mara Bos-5/+9
2022-03-19Skip a test if symlink creation is not possibleChris Denton-2/+9