about summary refs log tree commit diff
path: root/library/std/src
AgeCommit message (Collapse)AuthorLines
2024-01-13Refactor uses of `objc_msgSend` to no longer have clashing definitionsMads Marquart-37/+44
This is very similar to what Apple's own headers encourage you to do (cast the function pointer before use instead of making new declarations). Additionally, I'm documenting a few of the memory management rules we're following, ensuring that the `args` function doesn't leak memory (if you wrap it in an autorelease pool).
2024-01-13xous: thread: mark thread_main() as divergentSean Cross-3/+7
The thread wrapper function never returns, so we can mark it as divergent. Signed-off-by: Sean Cross <sean@xobs.io>
2024-01-13std: xous: use constants for stdout and stderrSean Cross-3/+16
Use constants for the opcodes when writing to stdout or stderr. There still is no stdin operation. Signed-off-by: Sean Cross <sean@xobs.io>
2024-01-13std: xous: mark stdio structs as `repr(C)`Sean Cross-2/+2
Ensure these structs have a well-defined ABI layout. Signed-off-by: Sean Cross <sean@xobs.io>
2024-01-13xous: net: initial commit of network supportSean Cross-1/+1493
This is an initial commit of network support for Xous. On hardware, is backed by smoltcp running via a Xous server in a separate process space. This patch adds TCP and UDP client and server support as well as DNS resolution support using the dns Xous server. Signed-off-by: Sean Cross <sean@xobs.io>
2024-01-13std: move personality implementation out of PALjoboet-1/+2
2024-01-13std: xous: share allocator symbol in testsSean Cross-0/+8
When using the testing framework, a second copy of libstd is built and linked. Use a global symbol for the `DLMALLOC` variable and mark it as `extern` when building as a test. This ensures we only have a single allocator even when running tests. Signed-off-by: Sean Cross <sean@xobs.io>
2024-01-13std: xous: fix thread_local_key under testsSean Cross-38/+63
When running tests, libstd gets implemented as a second library. Due to this fact, the `create()` and `destroy()` functions come from different libraries. To work around this, stash the `destroy_tls()` pointer in the first unused slot in the thread local storage pool. That way even if the destruction comes from a different version of libstd, the correct `DTORS` list will be consulted. Signed-off-by: Sean Cross <sean@xobs.io>
2024-01-13std: once: use queue implementation on XousSean Cross-2/+1
Use the global queue implementation of Once when running on Xous. This gets us a thread-safe implementation, rather than using the non-threadsafe `unsupported` implementation. Signed-off-by: Sean Cross <sean@xobs.io>
2024-01-13std: xous: rewrite rwlock to be more robustSean Cross-21/+23
Add more checks to RwLock on Xous. As part of this, ensure the variable is in a good state when unlocking. Additionally, use the global `yield_now()` rather than platform-specific `do_yield()`. Signed-off-by: Sean Cross <sean@xobs.io>
2024-01-13std: xous: use blocking_scalars for mutex unlockSean Cross-13/+7
Use blocking scalars when unlocking a mutex. This ensures that mutexes are unlocked immediately rather than dangling. Signed-off-by: Sean Cross <sean@xobs.io>
2024-01-13std: xous: pass entire memory range to flag updaterSean Cross-1/+1
When updating memory flags via `update_memory_flags()`, ensure we multiply the slice length by the element size to get the full memory size. Signed-off-by: Sean Cross <sean@xobs.io>
2024-01-13std: xous: rework condvar to fix soundness issuesSean Cross-61/+98
Rework the Condvar implementation on Xous to ensure notifications are not missed. This involves keeping track of how many times a Condvar timed out and synchronizing based on that. Signed-off-by: Sean Cross <sean@xobs.io>
2024-01-13xous: std: thread_parking: fix deadlocksbunnie-22/+40
Fix a deadlock condition that can occur when a thread is awoken in between the point at which it checks its wake state and the point where it actually waits. This change will cause the waker to continuously send Notify messages until it actually wakes up the target thread. Signed-off-by: Sean Cross <sean@xobs.io>
2024-01-13xous: ffi: correct size of freed memorySean Cross-1/+1
The amount of memory allocated was multiplied by sizeof::<T>(), so the amount of memory to be freed should also be multiplied by sizeof::<T>(). Signed-off-by: Sean Cross <sean@xobs.io>
2024-01-13xous: ffi: fix lend_impl() return valuesSean Cross-8/+10
The `ret1` and `ret2` return values from lend operations are returned in $a1 and $a2. This function incorrectly pulled them from $a6 and $a7, causing them to always be `0`. Signed-off-by: Sean Cross <sean@xobs.io>
2024-01-13Auto merge of #117285 - joboet:move_platforms_to_pal, r=ChrisDentonbors-159/+165
Move platform modules into `sys::pal` This is the initial step of #117276. `sys` just re-exports everything from the current `sys` for now, I'll move the implementations for the individual features one-by-one after this PR merges.
2024-01-12update paths in commentsjoboet-4/+4
2024-01-11std: fix module references on Windowsjoboet-5/+5
2024-01-11std: fix module references on UNIXjoboet-8/+8
2024-01-11std: fix module references on UEFIjoboet-2/+2
2024-01-11std: fix module reference on SGXjoboet-1/+1
2024-01-11std: fix module references on hermitjoboet-15/+13
2024-01-11std: begin moving platform support modules into `pal`joboet-124/+132
2024-01-11removed nonfunctioning benchmarkNicholas Thompson-12/+0
It could also have been fixed by removing a semicolon instead.
2024-01-10Stabilize mutex_unpoison featureThayne McCombs-6/+2
Closes #96469 @rustbot +T-libs-api
2024-01-09Rollup merge of #118241 - fortanix:raoul/gh-530-make_userspace_types_send, ↵Guillaume Gomez-0/+6
r=Nilstrieb,dtolnay Making `User<T>` and `User<[T]>` `Send` All `User` types in SGX point to owned memory in userspace. Special care is always needed when accessing this memory as it must be assumed that an attacker is always able to change its content. Therefore, we can also easily transfer this memory between thread boundaries. cc: ``@mzohreva`` ``@vn971`` ``@belalH`` ``@jethrogb``
2024-01-09Rollup merge of #118748 - devnexen:fbsd_getrandom_simpl, r=Nilstrieb,dtolnayGuillaume Gomez-11/+1
std: getrandom simplification for freebsd. it is in the libcs' crate too now.
2024-01-09Rollup merge of #117556 - obeis:static-mut-ref-lint, r=davidtwcoGuillaume Gomez-0/+8
Disallow reference to `static mut` and adding `static_mut_ref` lint Closes #114447 r? `@scottmcm`
2024-01-09Backlog for HorizonOS UnixListenerAndrea Ciliberti-2/+8
2024-01-09Rollup merge of #119632 - ivmarkov:master, r=Nilstrieb,dtolnayMatthias Krüger-2/+3
Fix broken build for ESP IDF due to #119026 `target_os = "espidf"` in `libc` lacks the `SOMAXCONN` constant, but that's probably irrelevant in this context, as `UnixListener` is not supported on ESP IDF - it being a single process "OS" only. The PR just re-uses the `128` constant so that the code builds. Trying to use the listener on ESP IDF will fail with `ENOSYS`, which is fine. *UPDATE* Might not fail with `ENOSYS` - need to test what error code would be returned, but that doesn`t change anything.
2024-01-08Increase visibility of `join_path` and `split_paths`Trevor Gross-1/+17
Add some crosslinking among `std::env` pages. Also add aliases to help anyone searching for `PATH`.
2024-01-07Update test for `E0796` and `static_mut_ref` lintObei Sideg-0/+8
2024-01-06Rollup merge of #118781 - RalfJung:core-panic-feature, r=the8472Matthias Krüger-2/+1
merge core_panic feature into panic_internals I don't know why those are two separate features, but it does not seem intentional. This merge is useful because with https://github.com/rust-lang/rust/pull/118123, panic_internals is recognized as an internal feature, but core_panic is not -- but core_panic definitely should be internal.
2024-01-06library: Fix a symlink test failing on WindowsVadim Petrochenkov-2/+4
2024-01-05Fix broken build for ESP IDF due to #119026ivmarkov-2/+3
2024-01-05Auto merge of #118297 - shepmaster:warn-dead-tuple-fields, r=WaffleLapkinbors-1/+1
Merge `unused_tuple_struct_fields` into `dead_code` This implicitly upgrades the lint from `allow` to `warn` and places it into the `unused` lint group. [Discussion on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Moving.20.60unused_tuple_struct_fields.60.20from.20allow.20to.20warn)
2024-01-04Rollup merge of #119026 - devnexen:listener_upd, r=Mark-SimulacrumMatthias Krüger-2/+12
std::net::bind using -1 for openbsd which in turn sets it to somaxconn. trusting platform's SOMAXCONN instead of hardcoding to 128 otherwise.
2024-01-03Rollup merge of #119534 - tgross35:thread-local-example-updates, r=JohnTitorLeón Orell Valerian Liehr-18/+32
Update `thread_local` examples to use `local_key_cell_methods` `local_key_cell_methods` has been stable for a while and provides a much less clunky way to interface with thread-local Additionaly add context to the documentation about why types with interior mutability are needed. r? libs
2024-01-03Rollup merge of #119319 - chfogelman:buffered-file-doc, r=the8472León Orell Valerian Liehr-3/+9
Document that File does not buffer reads/writes ...and refer to `BufReader`/`BufWriter`. This is a common source of efficiency issues in Rust programs written naively. Including this information with the `File` docs, and adding a link to the wrapper types, will help discoverability.
2024-01-02Update `thread_local` examples to use `local_key_cell_methods`Trevor Gross-18/+32
`local_key_cell_methods` has been stable for a while and provides a much less clunky way to interface with thread-local variables. Additionaly add context to the documentation about why types with interior mutability are needed.
2024-01-02Make `Barrier::new()` constJules Bertholet-1/+3
2024-01-02Adjust library tests for unused_tuple_struct_fields -> dead_codeJake Goulding-1/+1
2023-12-31Document that File does not buffer reads/writes, refer to BufReader/BufWriterCarter Hunt Fogelman-3/+9
2023-12-30openbsd: available_parallelism: use the right APISebastien Marie-26/+6
use the standard sysconf(_SC_NPROCESSORS_ONLN) way to get the number of available processors (capable of running processes), and fallback to sysctl([CTL_HW, HW_NCPU]) (number of CPUs configured) only on error. it permits to differenciate CPUs online vs CPUs configured (and not necessary capable of running processes). while here, use the common code path for BSDs for doing that, and avoid code duplication. Problem initially reported to me by Jiri Navratil.
2023-12-26Rollup merge of #119235 - Urgau:missing-feature-gate-sanitizer-cfi-cfgs, ↵Michael Goulet-1/+2
r=Nilstrieb Add missing feature gate for sanitizer CFI cfgs Found during the review of https://github.com/rust-lang/rust/pull/118494 in https://github.com/rust-lang/rust/pull/118494#discussion_r1416079288. cc `@rcvalle`
2023-12-24Fix doc typo for read_exact_atAlexBuz-1/+1
2023-12-24Stabilize ip_in_core featureLinus Färnstrand-1/+0
2023-12-24std::net::bind using -1 for openbsd which in turn sets it to somaxconn.David Carlier-2/+12
trusting platform's SOMAXCONN instead of hardcoding to 128 otherwise.
2023-12-23Rollup merge of #119153 - rursprung:stabilize-file_create_new, r=dtolnayMatthias Krüger-3/+1
stabilize `file_create_new` closes #105135