about summary refs log tree commit diff
path: root/library/std/src/sys
AgeCommit message (Collapse)AuthorLines
2024-02-27handle unavailable creation time as `io::ErrorKind::Unsupported`Jan Starke-1/+1
2024-02-27Auto merge of #119636 - devnexen:linux_tcp_defer_accept, r=m-ou-sebors-0/+12
os::net: expanding TcpStreamExt for Linux with `tcp_deferaccept`. allows for socket to process only when there is data to process, the option sets a number of seconds until the data is ready.
2024-02-27Rename wasm32-wasi-preview2 to wasm32-wasip2Ryan Levick-4/+4
Signed-off-by: Ryan Levick <me@ryanlevick.com>
2024-02-27Add the wasm32-wasi-preview2 targetRyan Levick-123/+213
Signed-off-by: Ryan Levick <me@ryanlevick.com>
2024-02-27Use the OS thread name by default for the current threadChris Denton-2/+75
2024-02-26change std::process to drop supplementary groups based on CAP_SETGIDElliot Roberts-3/+11
2024-02-26Remove _tls_used trickery unless neededChris Denton-5/+2
2024-02-26Use volatile to make `p_thread_callback` usedChris Denton-17/+11
2024-02-26Win10: Use GetSystemTimePreciseAsFileTime directlyChris Denton-0/+6
2024-02-26Auto merge of #121317 - ChrisDenton:win10-sync, r=Mark-Simulacrumbors-106/+154
Always use WaitOnAddress on Win10+ `WaitOnAddress` and `WakeByAddressSingle` are always available since Windows 8 so they can now be used without needing to delay load. I've also moved the Windows 7 thread parking fallbacks into a separate sub-module.
2024-02-25Auto merge of #121591 - matthiaskrgr:rollup-8wfhh3v, r=matthiaskrgrbors-0/+0
Rollup of 9 pull requests Successful merges: - #119590 (Stabilize `cfg_target_abi`) - #120805 (make non-PartialEq-typed consts as patterns a hard error) - #121060 (Add newtypes for bool fields/params/return types) - #121284 (Add test cases for inlining compiler-private items) - #121324 (pattern_analysis: factor out unspecialization) - #121409 (Prevent cycle in implied predicates computation) - #121513 (Fix sgx unit test compilation) - #121570 (Make most bootstrap step types !Copy) - #121586 (Don't use `unwrap()` in `ArrayIntoIter` lint when typeck fails) r? `@ghost` `@rustbot` modify labels: rollup
2024-02-25Rollup merge of #121513 - nshyrei:fix_tests_module, r=cuviperMatthias Krüger-0/+0
Fix sgx unit test compilation Fixes a compilation error: ``` error[E0583]: file not found for module `tests` --> library/std/src/sys/locks/rwlock/sgx.rs:2:1 | 2 | mod tests; | ^^^^^^^^^^ | = help: to create the module `tests`, create file "library/std/src/sys/locks/rwlock/sgx/tests.rs" or "library/std/src/sys/locks/rwlock/sgx/tests/mod.rs" = note: if there is a `mod tests` elsewhere in the crate already, import it with `use crate::...` instead For more information about this error, try `rustc --explain E0583`. error: could not compile `std` (lib test) due to 1 previous error` ``` When running command: ``` `TF_BUILD=True RUST_TEST_THREADS=1 ./x.py test --stage 1 "library/std" tests/assembly tests/run-make --target=x86_64-fortanix-unknown-sgx --no-doc --exclude src/tools/linkchecker --exclude src/tools/rust-demangler --no-fail-fast 2>&1 ``` The fix is done by moving a file to the location suggested by the compiler. The issue was introduced by PR: https://github.com/rust-lang/rust/pull/121177
2024-02-25Windows: Use ProcessPrng for random keysChris Denton-44/+28
2024-02-24library: use `addr_of!`Pavel Grigorenko-37/+37
2024-02-23moved tests fileNikitaShyrei-0/+0
2024-02-23Make timespec capping public to crate::sysFlorian Bartels-2/+2
It is used in: - `library/std/src/sys/locks/condvar/pthread.rs` - `library/std/src/sys/pal/unix/thread_parking/pthread.rs`
2024-02-22std support for wasm32 panic=unwindNoa-4/+4
2024-02-22Auto merge of #117174 - Ayush1325:uefi-stdio-improve, r=workingjubileebors-37/+94
Improve UEFI stdio Fixed some things suggested in last PR: #116207 cc `@dvdhrm` cc `@nicholasbishop`
2024-02-21Always use WaitOnAddress on Win10+Chris Denton-106/+154
2024-02-21os::net: expanding TcpStreamExt for Linux with `tcp_deferaccept`.David Carlier-0/+12
allows for socket to process only when there is data to process, the option sets a number of seconds until the data is ready.
2024-02-21rename ptr::invalid -> ptr::without_provenanceRalf Jung-16/+27
also introduce ptr::dangling matching NonNull::dangling
2024-02-20Delete architecture-specific memchr code in std::sysArthur Carcano-91/+6
Currently all architecture-specific memchr code is only used in `std::io`. Most of the actual `memchr` capacity exposed to the user through the slice API is instead implemented in core::slice::memchr. Hence this commit deletes memchr from std::sys[_common] and replace calls to it by calls to core::slice::memchr functions. This deletes (r)memchr from the list of symbols linked to libc.
2024-02-19Auto merge of #121177 - joboet:move_pal_locks, r=ChrisDentonbors-164/+141
Move locks to `sys` Part of #117276. r? `@ChrisDenton`
2024-02-18Auto merge of #121101 - GnomedDev:dyn-small-c-string, r=Nilstriebbors-57/+60
Reduce monomorphisation bloat in small_c_string This is a code path usually next to an FFI call, so taking the `dyn` slowdown for the 1159 llvm-line (fat lto, codegen-units 1, release build) drop in my testing program [t2fanrd](https://github.com/GnomedDev/t2fanrd) is worth it imo.
2024-02-18Dyn erase at call siteDavid Thomas-59/+50
2024-02-18Add some comments to prevent regressionDavid Thomas-0/+5
2024-02-18Reduce monomorphisation bloat in small_c_stringDavid Thomas-8/+15
2024-02-18Rollup merge of #118569 - blyxxyz:platform-os-str-slice, r=Mark-SimulacrumMatthias Krüger-1/+49
Move `OsStr::slice_encoded_bytes` validation to platform modules This delegates OS string slicing (`OsStr::slice_encoded_bytes`) validation to the underlying platform implementation. For now that results in increased performance and better error messages on Windows without any changes to semantics. In the future we may want to provide different semantics for different platforms. The existing implementation is still used on Unix and most other platforms and is now optimized a little better. Tracking issue: https://github.com/rust-lang/rust/issues/118485 cc `@epage,` `@BurntSushi`
2024-02-18Improve wording of static_mut_refObei Sideg-4/+6
Rename `static_mut_ref` lint to `static_mut_refs`.
2024-02-17Rollup merge of #119032 - smmalis37:patch-1, r=ChrisDentonGuillaume Boisseau-5/+25
Use a hardcoded constant instead of calling OpenProcessToken. Now that Win 7 support is dropped, we can resurrect #90144. GetCurrentProcessToken is defined in processthreadsapi.h as: FORCEINLINE HANDLE GetCurrentProcessToken ( VOID ) { return (HANDLE)(LONG_PTR) -4; } Since it's very unlikely that this constant will ever change, let's just use it instead of making calls to get the same information.
2024-02-17Auto merge of #120741 - a1phyr:safe_buffer_advance, r=m-ou-sebors-9/+9
Make `io::BorrowedCursor::advance` safe This also keeps the old `advance` method under `advance_unchecked` name. This makes pattern like `std::io::default_read_buf` safe to write.
2024-02-16Remove cfg_attrSteven-1/+0
2024-02-16Use a hardcoded constant instead of calling OpenProcessToken.Steven-5/+26
Now that Win 7 support is dropped, we can resurrect #90144. GetCurrentProcessToken is defined in processthreadsapi.h as: FORCEINLINE HANDLE GetCurrentProcessToken ( VOID ) { return (HANDLE)(LONG_PTR) -4; } Since it's very unlikely that this constant will ever change, let's just use it instead of making calls to get the same information.
2024-02-16std: move locks to `sys` on platforms without threadsjoboet-17/+10
2024-02-16std: move locks to `sys` on xousjoboet-10/+11
2024-02-16std: move locks to `sys` on Windowsjoboet-8/+10
2024-02-16std: move locks to `sys` on UNIX and other futex platformsjoboet-218/+55
2024-02-16std: move locks to `sys` on teeosjoboet-10/+158
2024-02-16std: move locks to `sys` on SGXjoboet-23/+19
2024-02-16std: move locks to `sys` on µITRONjoboet-41/+41
2024-02-16Auto merge of #120486 - reitermarkus:use-generic-nonzero, r=dtolnaybors-80/+80
Use generic `NonZero` internally. Tracking issue: https://github.com/rust-lang/rust/issues/120257
2024-02-16Auto merge of #120889 - Ayush1325:uefi-instant, r=joshtriplettbors-0/+116
Implement Instant for UEFI - Uses Timestamp Protocol if present. Else use rdtsc for x86 and x86-64
2024-02-15Rollup merge of #120672 - devnexen:update_thread_stack_guardpages_fbsd, ↵Guillaume Gomez-5/+25
r=m-ou-se std::thread update freebsd stack guard handling. up to now, it had been assumed the stack guard setting default is not touched in the field but some user might just want to disable it or increase it. checking it once at runtime should be enough.
2024-02-15Rollup merge of #121098 - ShoyuVanilla:thread-local-unnecessary-else, ↵Matthias Krüger-1/+2
r=Nilstrieb Remove unnecessary else block from `thread_local!` expanded code Some expanded codes make ["unnecessary else block" warnings](https://github.com/rust-lang/rust-analyzer/issues/16556#issuecomment-1944271716) for Rust Analyzer
2024-02-15Rollup merge of #118749 - ChrisDenton:winsys, r=cuviperMatthias Krüger-9/+10
Make contributing to windows bindings easier This PR does three things: - Automatically sorts bindings so contributors don't have to. I should have done this to begin with but was lazy. - Renames `windows_sys.lst` to `bindings.txt`. This [matches the windows-rs repository](https://github.com/microsoft/windows-rs/blob/8e71051ea8a57594478e585d2740126893f9dbb7/crates/tools/sys/bindings.txt) (and repos that copy it). I believe consistency with other projects helps get people orientated. - Adds a `README.md` file explaining what this is about and how to add bindings. This has the benefit of being directly editable and it's rendered when viewed online. Also people are understandably jumping right into the `windows_sys.rs` file via ripgrep or github search and so missing that it's generated. A `README.md` alongside it is at least slightly more obvious in that case. There is still a small note at the top of `windows_sys` in case people do read from the beginning. None of this has any impact on the actual code generated. It's purely to make the new contributors workflow a bit nicer.
2024-02-15Replace `NonZero::<_>::new` with `NonZero::new`.Markus Reiter-26/+24
2024-02-15Use generic `NonZero` internally.Markus Reiter-78/+80
2024-02-15Remove unnecessary else block from `thread_local!` expanded codeShoyu Vanilla-1/+2
2024-02-14Rollup merge of #118738 - devnexen:netbsd10_update, r=cuviperOli Scherer-4/+6
Netbsd10 update
2024-02-14Automatically sort windows_sys bindingsChris Denton-8/+1