about summary refs log tree commit diff
path: root/library/std/src/sys/pal
AgeCommit message (Collapse)AuthorLines
2024-02-18Reduce monomorphisation bloat in small_c_stringDavid Thomas-8/+15
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-140/+1
2024-02-16std: move locks to `sys` on xousjoboet-340/+0
2024-02-16std: move locks to `sys` on Windowsjoboet-151/+0
2024-02-16std: move locks to `sys` on UNIX and other futex platformsjoboet-1609/+0
2024-02-16std: move locks to `sys` on teeosjoboet-153/+0
2024-02-16std: move locks to `sys` on SGXjoboet-337/+1
2024-02-16std: move locks to `sys` on µITRONjoboet-491/+10
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
2024-02-14Add windows_sys readmeChris Denton-0/+9
2024-02-14Move windows_sys.lst to bindings.txtChris Denton-1/+0
2024-02-13Implement Instant for UEFIAyush Singh-0/+116
- Uses Timestamp Protocol if present. Else use rdtsc for x86 and x86-64 Signed-off-by: Ayush Singh <ayushdevel1325@gmail.com>
2024-02-13Auto merge of #120938 - Ayush1325:uefi-thread, r=joboet,Nilstriebbors-1/+60
Implement sys/thread for UEFI Since UEFI has no concept of threads, most of this module can be ignored. However, implementing parts that make sense. - Implement sleep - Implement available_parallelism
2024-02-12Auto merge of #110211 - joboet:queue_lock, r=Amanieubors-197/+559
Replace pthread `RwLock` with custom implementation This is one of the last items in #93740. I'm doing `RwLock` first because it is more self-contained and has less tradeoffs to make. The motivation is explained in the documentation, but in short: the pthread rwlock is slow and buggy and `std` can do much better. I considered implementing a parking lot, as was discussed in the tracking issue, but settled for the queue-based version because writing self-balancing binary trees is not fun in Rust... This is a rather complex change, so I have added quite a bit of documentation to help explain it. Please point out any part that could be explained better. ~~The read performance is really good, I'm getting 4x the throughput of the pthread version and about the same performance as usync/parking_lot on an Apple M1 Max in the usync benchmark suite, but the write performance still falls way behind what usync and parking_lot achieve. I tried using a separate queue lock like what usync uses, but that didn't help. I'll try to investigate further in the future, but I wanted to get some eyes on this first.~~ [Resolved](https://github.com/rust-lang/rust/pull/110211#issuecomment-1513682336) r? `@m-ou-se` CC `@kprotty`
2024-02-11Implement sys/thread for UEFIAyush Singh-1/+60
Since UEFI has no concept of threads, most of this module can be ignored. However, implementing parts that make sense. - Implement sleep - Implement available_parallelism Signed-off-by: Ayush Singh <ayushdevel1325@gmail.com>
2024-02-11add doc-comment to `unlock_queue`joboet-0/+3
2024-02-11std: enabling new netbsd (10) calls.David Carlier-4/+6
Introducing a new config for this purpose as NetBSD 9 or 8 will be still around for a good while. For now, we re finally enabling sys::unix::rand::getrandom.
2024-02-09Auto merge of #120852 - matthiaskrgr:rollup-01pr8gj, r=matthiaskrgrbors-644/+136
Rollup of 11 pull requests Successful merges: - #120351 (Implement SystemTime for UEFI) - #120354 (improve normalization of `Pointee::Metadata`) - #120776 (Move path implementations into `sys`) - #120790 (better error message on download CI LLVM failure) - #120806 (Clippy subtree update) - #120815 (Improve `Option::inspect` docs) - #120822 (Emit more specific diagnostics when enums fail to cast with `as`) - #120827 (Print image input file and checksum in CI only) - #120836 (hide impls if trait bound is proven from env) - #120844 (Build DebugInfo for async closures) - #120851 (Remove duplicate release note) r? `@ghost` `@rustbot` modify labels: rollup
2024-02-09std::thread update freebsd stack guard handling.David Carlier-5/+25
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-09Rollup merge of #120776 - joboet:move_pal_path, r=ChrisDentonMatthias Krüger-643/+3
Move path implementations into `sys` Part of #117276. r? `@ChrisDenton`
2024-02-09Rollup merge of #120351 - Ayush1325:uefi-time, r=m-ou-seMatthias Krüger-1/+133
Implement SystemTime for UEFI - Uses SystemTable->RuntimeServices->GetTime() - Uses the algorithm described [here](https://blog.reverberate.org/2020/05/12/optimizing-date-algorithms.html) for conversion to UNIX time
2024-02-09Auto merge of #120676 - Mark-Simulacrum:bootstrap-bump, r=clubby789bors-3/+2
Bump bootstrap compiler to just-built 1.77 beta https://forge.rust-lang.org/release/process.html#master-bootstrap-update-t-2-day-tuesday
2024-02-09address review commentsjoboet-21/+19
2024-02-09be more explicit about why adding backlinks eagerly makes sensejoboet-6/+7
2024-02-09format using latest rustfmtjoboet-4/+12
2024-02-09inline some single-use functions, add documentationjoboet-23/+23
2024-02-09queue_rwlock: use a separate `QUEUE_LOCKED` bit to synchronize waiter queue ↵joboet-144/+195
updates
2024-02-09use exponential backoff in `lock_contended`joboet-2/+4
2024-02-09immediately register writer node if threads are queuedjoboet-2/+3
2024-02-09avoid unnecessary `Thread` handle allocationjoboet-1/+2
2024-02-09use braces to make operator precedence less ambiguousjoboet-1/+1
2024-02-09adjust code documentationjoboet-2/+2
2024-02-09std: replace pthread `RwLock` with custom implementation inspired by usyncjoboet-197/+494
2024-02-09Auto merge of #120238 - joboet:always_confirm_lock_success, r=Mark-Simulacrumbors-1/+18
Always check the result of `pthread_mutex_lock` Fixes #120147. Instead of manually adding a list of "good" platforms, I've simply made the check unconditional. pthread's mutex is already quite slow on most platforms, so one single well-predictable branch shouldn't hurt performance too much.
2024-02-09Implement SystemTime for UEFIAyush Singh-1/+133
- Uses SystemTable->RuntimeServices->GetTime() Signed-off-by: Ayush Singh <ayushdevel1325@gmail.com>
2024-02-08Step all bootstrap cfgs forwardMark Rousskov-3/+2
This also takes care of other bootstrap-related changes.