about summary refs log tree commit diff
path: root/library/std/src/sys/unix
AgeCommit message (Collapse)AuthorLines
2023-09-24Auto merge of #104385 - BlackHoleFox:apple-minimum-bumps, r=petrochenkovbors-3/+2
Raise minimum supported Apple OS versions This implements the proposal to raise the minimum supported Apple OS versions as laid out in the now-completed MCP (https://github.com/rust-lang/compiler-team/issues/556). As of this PR, rustc and the stdlib now support these versions as the baseline: - macOS: 10.12 Sierra - iOS: 10 - tvOS: 10 - watchOS: 5 (Unchanged) In addition to everything this breaks indirectly, these changes also erase the `armv7-apple-ios` target (currently tier 3) because the oldest supported iOS device now uses ARMv7s. Not sure what the policy around tier3 target removal is but shimming it is not an option due to the linker refusing. [Per comment](https://github.com/rust-lang/compiler-team/issues/556#issuecomment-1297175073), this requires a FCP to merge. cc `@wesleywiser.`
2023-09-23Raise minimum supported iOS version to 10.0BlackHoleFox-1/+1
Drop the armv7-apple-ios target too because its no longer supported with the hardware iOS 10 requires.
2023-09-23Raise minimum supported macOS to 10.12BlackHoleFox-2/+1
2023-09-22Rollup merge of #116038 - the8472:panic-on-sched_getaffinity-bug, r=cuviperMatthias Krüger-6/+19
Fall back to _SC_NPROCESSORS_ONLN if sched_getaffinity returns an empty mask Followup to #115946 A gentler fix for #115868, one that doesn't panic, [suggested on zulip](https://rust-lang.zulipchat.com/#narrow/stream/259402-t-libs.2Fmeetings/topic/Meeting.202023-09-19/near/391942927) In that situation - on the buggy kernel versions - a zero-mask means no affinities have been set so `_SC_NPROCESSORS_ONLN` provides the right value.
2023-09-22Rollup merge of #114379 - RalfJung:command-removed-env-vars, r=m-ou-seMatthias Krüger-0/+17
Command: also print removed env vars There is no real shell syntax for unsetting an env var so easily, so we have to make one up. But we already do that for showing the 'program' name so I hope that's okay here, too. No strong opinion on what that should look like, I went with `unset(VAR_NAME)` for now.
2023-09-21Auto merge of #115230 - Vtewari2311:mod-hurd-latest, r=b-naberbors-27/+119
added support for GNU/Hurd adding support for i686-unknown-hurd-gnu
2023-09-21Fall back to _SC_NPROCESSORS_ONLN if sched_getaffinity returns an empty maskThe 8472-6/+19
2023-09-21added support for GNU/HurdSamuel Thibault-27/+119
2023-09-18panic when encountering an illegal cpumaskThe 8472-2/+4
2023-09-13Disabled socketpair for VitaNikolay Arhipov-2/+2
2023-09-10Auto merge of #114967 - japaric:ja-gh114966, r=Mark-Simulacrumbors-0/+4
QNX: pass a truncated thread name to the OS The maximum length the thread name can have is `_NTO_THREAD_NAME_MAX` fixes #114966
2023-09-09Auto merge of #114590 - ijackson:stdio-stdio-2, r=dtolnaybors-1/+29
Allow redirecting subprocess stdout to our stderr etc. (redux) This is the code from #88561, tidied up, including review suggestions, and with the for-testing-only CI commit removed. FCP for the API completed in #88561. I have made a new MR to facilitate review. The discussion there is very cluttered and the branch is full of changes (in many cases as a result of changes to other Rust stdlib APIs since then). Assuming this MR is approvedl we should close that one. ### Reviewer doing a de novo review Just code review these four commits.. FCP discussion starts here: https://github.com/rust-lang/rust/pull/88561#issuecomment-1640527595 Portability tests: you can see that this branch works on Windows too by looking at the CI results in #88561, which has the same code changes as this branch but with an additional "DO NOT MERGE" commit to make the Windows tests run. ### Reviewer doing an incremental review from some version of #88561 Review the new commits since your last review. I haven't force pushed the branch there. git diff the two branches (eg `git diff 176886197d6..0842b69c219`). You'll see that the only difference is in gitlab CI files. You can also see that *this* MR doesn't touch those files.
2023-09-06fix typoRalf Jung-1/+1
Co-authored-by: Marcin S. <marcin@realemail.net>
2023-09-03Rollup merge of #115489 - saethlin:is-interrupted, r=thomccMatthias Krüger-4/+4
Use std::io::Error::is_interrupted everywhere In https://github.com/rust-lang/rust/pull/115228 I introduced this helper and started using it, this PR uses it to replace all applicable uses of `std::io::Error::kind`. The justification is the same; for whatever reason LLVM totally flops optimizing `Error::kind` so it's nice to use it less. FYI ``@mkroening`` I swear the hermit changes look good, but I was so sure about the previous PR.
2023-09-03Use std::io::Error::is_interrupted everywhereBen Kimock-4/+4
2023-09-01fix(std): Rename os_str_bytes to encoded_bytesEd Page-10/+10
2023-08-29std::thread::set_name exploit the return on haikuDavid CARLIER-1/+3
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-25Add a new helper to avoid calling io::Error::kindBen Kimock-0/+5
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-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-18Fix UB in `std::sys::os::getenv()`ShE3py-8/+13
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-12Rollup merge of #114132 - tamird:better-env-debug-impls, r=AmanieuMatthias Krüger-0/+28
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/+3
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-0/+4
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-4/+4
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.
2023-08-07Better Debug for Vars and VarsOsTamir Duberstein-0/+28
Display actual vars instead of two dots. The same was done for Args and ArgsOs in 275f9a04af6191e3aee3852a5a1713.
2023-08-07impl Default for ExitStatusIan Jackson-4/+4
2023-08-07std::process (unix): Implement From<io::Stdout> etc. for imp::StdioIan Jackson-1/+29
This involves adding a new variant `imp::Stdio::StaticFd`. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2023-08-05use offset_of! to calculate dirent64 field offsetsThe 8472-25/+2
2023-08-03unix/kernel_copy.rs: copy_file_range_candidate allows empty output filesxstaticxgpx-4/+14
This is for https://github.com/rust-lang/rust/issues/114341 The `meta.len() > 0` condition here is intended for inputs only, ie. when input is in the `/proc` filesystem as documented. That inaccurately included empty output files which are then shunted to the sendfile() routine leading to higher than nescessary IO util in some cases, specifically with CoW filesystems like btrfs. Further, `NoneObtained` is not relevant in this context, so remove it. Simply, determine what is input or output given the passed enum Unit.
2023-07-31Add gamma and ln_gamma functions to f32 and f64Andrew Kane-0/+4
2023-07-30rand use getrandom for freebsd (available since 12.x)David Carlier-9/+7
2023-07-28inline trivial (noop) flush callsThom Chiovoloni-0/+3
2023-07-26Rollup merge of #101994 - devnexen:rand_fbsd_update, r=workingjubileeMatthias Krüger-4/+18
rand: freebsd update, using getrandom. supported since the 12th release, while 11.4 is EOL since 2021.
2023-07-24`unix::init`: Don't use `signal` on Unikraft.Martin Kröning-1/+8
Signed-off-by: Martin Kröning <martin.kroening@eonerc.rwth-aachen.de>
2023-07-24`unix::init`: Handle `ENOSYS` from `poll` on Unikraft.Martin Kröning-0/+5
Signed-off-by: Martin Kröning <martin.kroening@eonerc.rwth-aachen.de>
2023-07-07Allow limited access to `OsString` bytesEd Page-0/+10
This extends #109698 to allow no-cost conversion between `Vec<u8>` and `OsString` as suggested in feedback from `os_str_bytes` crate in #111544.