about summary refs log tree commit diff
path: root/library/std/src/sys
AgeCommit message (Collapse)AuthorLines
2023-08-29Auto merge of #115309 - hermitcore:hermit-net-init, r=cuviperbors-8/+1
fix(sys/hermit): remove obsolete network initialization This function does not exist as of hermit-sys 0.4.1 ([`e38f246`]). Once std does not call this function, we can remove it entirely. CC: `@stlankes` [`e38f246`]: https://github.com/hermitcore/hermit-rs/commit/e38f246e046c3ad50bd2f5e33d8d810d33891cbd#diff-a9b7fa816defab285f0d4fe69d4df4a0cbbcf1c89913000df3273aded949f257R10
2023-08-28Remove old bindings that have been movedChris Denton-7/+1
2023-08-28Add GetActiveProcessorCount and process attributesChris Denton-0/+7
2023-08-28Abstract over internal `SOCKET` typeChris Denton-16/+22
This allows `SOCKET` to be `usize` internally
2023-08-28Update windows ffi bindingsChris Denton-98/+82
2023-08-28Auto merge of #114848 - michaelvanstraten:spawn_with_attributes, r=ChrisDentonbors-2/+152
Add ability to spawn Windows process with Proc Thread Attributes | Take 2 This is the second attempt to merge pull request #88193 into the standard library. This PR implements the ability to add arbitrary attributes to a command on Windows targets using a new `raw_attribute` method on the [`CommandExt`](https://doc.rust-lang.org/stable/std/os/windows/process/trait.CommandExt.html) trait. `@TyPR124` and my main motivation behind adding this feature is to enable the support of pseudo terminals in the std library, but there are many more applications. A good starting point to get into this topic is to head over to the [`Win32 API documentation`](https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-updateprocthreadattribute).
2023-08-28fix(sys/hermit): add is_interruptedMartin Kröning-0/+5
Signed-off-by: Martin Kröning <martin.kroening@eonerc.rwth-aachen.de>
2023-08-28fix(sys/hermit): remove obsolete network initializationMartin Kröning-8/+1
This function does not exist as of hermit-sys 0.4.1 [1]. Once std does not call this function, we can remove it entirely. [1]: https://github.com/hermitcore/hermit-rs/commit/e38f246e046c3ad50bd2f5e33d8d810d33891cbd#diff-a9b7fa816defab285f0d4fe69d4df4a0cbbcf1c89913000df3273aded949f257R10 Signed-off-by: Martin Kröning <martin.kroening@eonerc.rwth-aachen.de>
2023-08-26wasi: round up the size for `aligned_alloc`Josh Stone-1/+5
C11 `aligned_alloc` requires that the size be a multiple of the alignment. This is enforced in the wasi-libc emmalloc implementation, which always returns NULL if the size is not a multiple. (The default `MALLOC_IMPL=dlmalloc` does not currently check this.)
2023-08-26Auto merge of #115228 - saethlin:is-interrupted, r=thomccbors-0/+46
Add a new helper to avoid calling io::Error::kind On `cfg(unix)`, `Error::kind` emits an enormous jump table that LLVM seems unable to optimize out. I don't really understand why, but see for yourself: https://godbolt.org/z/17hY496KG This change lets us check for `ErrorKind::Interrupted` without going through a big match. I've checked the codegen locally, and it has the desired effect on the codegen for `BufReader::read_exact`.
2023-08-25Add a new helper to avoid calling io::Error::kindBen Kimock-0/+46
2023-08-25Added option to set ProcThreadAttributes for Windows processesMichael van Straten-2/+152
This implements the ability to add arbitrary attributes to a command on Windows targets using a new `raw_attribute` method on the [`CommandExt`](https://doc.rust-lang.org/stable/std/os/windows/process/trait.CommandExt.html) trait. Setting these attributes provides extended configuration options for Windows processes. Co-authored-by: Tyler Ruckinger <t.ruckinger@gmail.com>
2023-08-24Rollup merge of #115124 - ↵Weihang Lo-1/+1
solid-rs:patch/kmc-solid/import-poison-error-in-os, r=cuviper kmc-solid: Import `std::sync::PoisonError` in `std::sys::solid::os` Follow-up to #114968. Fixes a missing import in [`*-kmc-solid_*`](https://doc.rust-lang.org/nightly/rustc/platform-support/kmc-solid.html) Tier 3 targets. ``` error[E0433]: failed to resolve: use of undeclared type `PoisonError` C:\Users\xxxxx\.rustup\toolchains\nightly-2023-08-23-x86_64-pc-windows-gnu\lib\rustlib\src\rust\library\std\src\sys\solid\os.rs(85,36) | 85 | ENV_LOCK.read().unwrap_or_else(PoisonError::into_inner) | ^^^^^^^^^^^ use of undeclared type `PoisonError` | ```
2023-08-24also use 'env' for printing unsettingRalf Jung-7/+3
2023-08-24also print clearing the environment entirelyRalf Jung-12/+17
2023-08-24make unsetting env vars print as executable commandRalf Jung-2/+16
2023-08-24Command: also print removed env varsRalf Jung-0/+2
2023-08-23Rollup merge of #114696 - g0djan:godjan/fix_114610, r=Mark-SimulacrumGuillaume Gomez-0/+8
Fix a pthread_t handle leak #114610 https://github.com/rust-lang/rust/issues/114610 Ran the tests as described in https://github.com/rust-lang/rust/blob/master/src/doc/rustc/src/platform-support/wasm32-wasi-preview1-threads.md?plain=1#L125
2023-08-23kmc-solid: Import `std::sync::PoisonError` in `std::sys::solid::os`Tomoaki Kawada-1/+1
2023-08-22std: unix process_unsupported: Provide a wait status emulation (tidy)Ian Jackson-36/+39
Move tests into a module as demanded by tidy.
2023-08-22fixup! std: unix process: Test exit statuses / wait statusesIan Jackson-1/+1
2023-08-22std: unix process_unsupported: Provide a wait status emulation (fmt)Ian Jackson-15/+3
Worsify formatting as required by rustfmt.
2023-08-22fixup! std: unix process_unsupported: Provide a wait status emulationIan Jackson-1/+1
2023-08-22std: unix process: Test exit statuses / wait statusesIan Jackson-0/+33
This is a pretty basic test but should spot any other platforms which are `#[cfg(unix)]` but not Unix and where the wait status representation is wrong. (And any actual Unix platforms where it's not as expected, but I don't think they exist.)
2023-08-22std: unix process_unsupported: Provide a wait status emulationIan Jackson-50/+120
Fixes #114593 Needs FCP due to behavioural changes.
2023-08-22std: xous: add support for locksSean Cross-1/+306
Add support for Condvar, Mutex, and RWLock. These are all backed by the ticktimer server. Signed-off-by: Sean Cross <sean@xobs.io>
2023-08-22std: xous: add thread_local_keySean Cross-1/+190
Add an implementation of thread local storage. This uses a container that is pointed to by the otherwise-unsed `$tp` register. This container is allocated on-demand, so threads that use no TLS will not allocate this extra memory. Signed-off-by: Sean Cross <sean@xobs.io>
2023-08-22std: xous: add thread supportSean Cross-1/+144
Add initial support for threads on Xous. This includes thread creation and joining. Signed-off-by: Sean Cross <sean@xobs.io>
2023-08-22std: xous: add support for timeSean Cross-1/+57
Add support for determining the current time. This connects to the ticktimer server in order to get the system uptime. Signed-off-by: Sean Cross <sean@xobs.io>
2023-08-22std: xous: add output support for stdioSean Cross-1/+131
Add support for stdout. This enables basic console printing via `println!()`. Output is written to the log server. Signed-off-by: Sean Cross <sean@xobs.io>
2023-08-22std: xous: add alloc supportSean Cross-1/+62
Basic alloc support on Xous is supported by the `dlmalloc` crate. This necessitates bumping the dlmalloc version to 0.2.4. Signed-off-by: Sean Cross <sean@xobs.io>
2023-08-22std: xous: the basics of `os`Sean Cross-1/+147
Add the basics to get the operating system running, including how to exit the operating system. Since Xous has no libc, there is no default entrypoint. Add a `_start` entrypoint to the system-specific os module. Signed-off-by: Sean Cross <sean@xobs.io>
2023-08-22libstd: add xous to libstdSean Cross-0/+47
Add the `xous` target to libstd. Currently this defers everything to the `unsupported` target. Signed-off-by: Sean Cross <sean@xobs.io>
2023-08-20Rollup merge of #114968 - ShE3py:unix-getsetenv-ub, r=thomccMatthias Krüger-27/+47
Fix UB in `std::sys::os::getenv()` Fixes #114949. Reduced the loops to 1k iterations (100k was taking way too long), Miri no longer shows any UB. `@rustbot` label +A-process +C-bug +I-unsound +O-unix
2023-08-19Usage zero as language id for FormatMessageW()Charles Lew-6/+2
2023-08-18Fix UB in `std::sys::os::getenv()`ShE3py-27/+47
2023-08-18QNX: pass a truncated thread name to the OSJorge Aparicio-0/+4
The maximum length the thread name can have is `_NTO_THREAD_NAME_MAX`
2023-08-16address commentsGeorgii Rylov-11/+7
2023-08-16Fix a pthread_t handle leak #114610Georgii Rylov-0/+12
2023-08-15Rollup merge of #114619 - g0djan:godjan/fix_#114608, r=m-ou-seMatthias Krüger-3/+3
Fix pthread_attr_union layout on Wasi Fixes https://github.com/rust-lang/rust/issues/114608 Ran the tests as described in https://github.com/rust-lang/rust/blob/master/src/doc/rustc/src/platform-support/wasm32-wasi-preview1-threads.md?plain=1#L125
2023-08-15Rollup merge of #114800 - RalfJung:transparent, r=cuviperGuillaume Gomez-2/+8
std: add some missing repr(transparent) For some types we don't want to stably guarantee this, so hide the `repr` from rustdoc. This nice approach was suggested by `@thomcc.`
2023-08-14add a csky-unknown-linux-gnuabiv2 targetDirreke-0/+4
2023-08-14std: add some missing repr(transparent)Ralf Jung-2/+8
2023-08-12Rollup merge of #114132 - tamird:better-env-debug-impls, r=AmanieuMatthias Krüger-8/+228
Better Debug for Vars and VarsOs Display actual vars instead of two dots. The same was done for Args and ArgsOs in 275f9a04af6191e3aee3852a5a1713.
2023-08-10Rollup merge of #114194 - thomcc:flushinline, r=cuviperMichael Goulet-0/+4
Inline trivial (noop) flush calls At work I noticed that `writer.flush()?` didn't get optimized away in cases where the flush is obviously a no-op, which I had expected (well, desired). I went through and added `#[inline]` to a bunch of cases that were obviously noops, or delegated to ones that were obviously noops. I omitted platforms I don't have access to (some tier3). I didn't do this very scientifically, in cases where it was non-obvious I left `#[inline]` off.
2023-08-09Auto merge of #114646 - matthiaskrgr:rollup-xf7qnmn, r=matthiaskrgrbors-90/+156
Rollup of 6 pull requests Successful merges: - #113939 (open pidfd in child process and send to the parent via SOCK_SEQPACKET+CMSG) - #114548 (Migrate a trait selection error to use diagnostic translation) - #114606 (fix: not insert missing lifetime for `ConstParamTy`) - #114634 (Mention riscv64-linux-android support in Android documentation) - #114638 (Remove old RPITIT tests (revisions were removed)) - #114641 (Rename copying `ascii::Char` methods from `as_` to `to_`) r? `@ghost` `@rustbot` modify labels: rollup
2023-08-09Rollup merge of #113939 - the8472:pidfd-from-child, r=Mark-SimulacrumMatthias Krüger-90/+156
open pidfd in child process and send to the parent via SOCK_SEQPACKET+CMSG This avoids using `clone3` when a pidfd is requested while still getting it in a 100% race-free manner by passing it up from the child process. This should solve most concerns in #82971
2023-08-09Auto merge of #99747 - ankane:float_gamma, r=workingjubileebors-1/+9
Add gamma function to f32 and f64 Adds the [gamma function](https://en.wikipedia.org/wiki/Gamma_function) to `f32` and `f64` (`tgamma` and `tgammaf` from C). Refs: - https://github.com/rust-lang/rfcs/issues/864 - https://github.com/rust-lang/rust/issues/18271
2023-08-08open pidfd in child process and send to the parent via SOCK_SEQPACKET+CMSGThe 8472-90/+156
This is a 100% race-free way to obtain a child's pidfd while avoiding `clone3`.
2023-08-08Rollup merge of #106425 - ijackson:exit-status-default, r=dtolnayMatthias Krüger-23/+24
Make ExitStatus implement Default And, necessarily, make it inhabited even on platforms without processes. I noticed while preparing https://github.com/rust-lang/rfcs/pull/3362 that there was no way for anyone to construct an `ExitStatus`. This would be insta-stable so needs an FCP.