about summary refs log tree commit diff
path: root/library/std/src/os
AgeCommit message (Collapse)AuthorLines
2023-10-31Stabilize `file_set_times`Josh Triplett-12/+12
Approved via FCP in https://github.com/rust-lang/rust/issues/98245 .
2023-10-29Don't use LFS64 symbols on muslgit-bruh-1/+8
Simplify #[cfg] blocks fmt don't try to use the more appropriate direntry on musl
2023-10-20changes from feedbackDavid Carlier-10/+0
2023-10-17Updated libc and doc for Vita targetNikolay Arhipov-3/+3
2023-10-14Auto merge of #116407 - Mark-Simulacrum:bootstrap-bump, r=onur-ozkanbors-6/+6
Bump bootstrap compiler to just-released beta https://forge.rust-lang.org/release/process.html#master-bootstrap-update-t-2-day-tuesday
2023-10-09Support AIX in Rust standard libraryQiu Chaofan-0/+367
2023-10-03Bump version placeholdersMark Rousskov-6/+6
2023-09-28Auto merge of #114882 - ChrisDenton:riddle-me, r=dtolnaybors-4/+4
Update windows ffi bindings Bump `windows-bindgen` to version 0.51.1. This brings with it some changes to the generated FFI bindings, but little that affects the code. One change that does have more of an impact is `SOCKET` being `usize` instead of either `u64` or `u32` (as is used in std's public `SOCKET` type). However, it's now easy enough to abstract over that difference. Finally I added a few new bindings that are likely to be used in pending PRs, mostly to make sure they're ok with the new metadata. r? libs
2023-09-28Auto merge of #98704 - vthib:impl-from-raw-for-childstd-structs, r=dtolnaybors-0/+81
Implement From<OwnedFd/Handle> for ChildStdin/out/err object ## Summary Comments in `library/std/src/process.rs` ( https://github.com/rust-lang/rust/commit/ab08639e5950f5c8a42a2870c9636181308c3686 ) indicates that `ChildStdin`, `ChildStdout`, `ChildStderr` implements some traits that are not actually implemented: `FromRawFd`, `FromRawHandle`, and the `From<OwnedFd>/From<OwnedHandle>` from the io_safety feature. In this PR I implement `FromRawHandle` and `FromRawFd` for those 3 objects. ## Usecase I have a usecase where those implementations are basically needed. I want to customize in the `Command::spawn` API how the pipes for the parent/child communications are created (mainly to strengthen the security attributes on them). I can properly setup the pipes, and the "child" handles can be provided to `Child::spawn` easily using `Stdio::from_raw_handle`. However, there is no way to generate the `ChildStd*` objects from the raw handle of the created name pipe, which would be very useful to still expose the same API than in other OS (basically a `spawn(...) -> (Child, ChildStdin, ChildStdout, ChildSterr)`, where on windows this is customized), and to for example use `tokio::ChildStdin::from_std` afterwards. ## Questions * Are those impls OK to add? I have searched to see if those impls were missing on purpose, or if it was just never implemented because never needed. I haven't found any indication on why they couldn't be added, although the user clearly has to be very careful that the handle provided makes sense (i think, mainly that it is in overlapped mode for windows). * If this change is ok, adding the impls for the io_safety feature would probably be best, or should it be done in another PR? * I just copy-pasted the `#[stable(...)]` attributes, but the `since` value has to be updated, I'm not sure to which value.
2023-09-28Update stability attribute for child stream From implsDavid Tolnay-6/+6
2023-09-25Auto merge of #116057 - RalfJung:io-safety, r=Mark-Simulacrumbors-8/+14
fix OS-specific I/O safety docs since the io_safety feature is stable Looks like this text was forgotten to be updated when `io_safety` got stabilized: it still says "once the io_safety feature is stable". Also adjust the wording a bit for how these docs relate to the general concept of I/O safety.
2023-09-22Fixes from PRAyush Singh-1/+1
- Hide Docs - Use repr_unpacked error Signed-off-by: Ayush Singh <ayushdevel1325@gmail.com>
2023-09-22Rebase to masterAyush Singh-22/+33
- Update Example - Add thread_parking to sys::uefi - Fix unsafe in unsafe errors - Improve docs - Improve os/exit - Some asserts - Switch back to atomics Signed-off-by: Ayush Singh <ayushdevel1325@gmail.com>
2023-09-22Fixes from PRAyush Singh-1/+1
- Some comment fixes. - Make some functions unsafe. - Make helpers module private. - Rebase on master - Update r-efi to v4.2.0 Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
2023-09-22Add support for building `std::os::uefi` docsAyush Singh-14/+20
Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
2023-09-22Handle ExitBootServicesAyush Singh-10/+33
- Make BootServices unavailable if ExitBootServices event is signaled. - Use thread locals for SystemTable and ImageHandle Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
2023-09-22Fixes from PRAyush Singh-6/+5
Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
2023-09-22Add Minimal Std implementation for UEFIAyush Singh-0/+63
Implemented modules: 1. alloc 2. os_str 3. env 4. math Tracking Issue: https://github.com/rust-lang/rust/issues/100499 API Change Proposal: https://github.com/rust-lang/libs-team/issues/87 This was originally part of https://github.com/rust-lang/rust/pull/100316. Since that PR was becoming too unwieldy and cluttered, and with suggestion from @dvdhrm, I have extracted a minimal std implementation to this PR. Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
2023-09-22fix OS-specific I/O safety docs since the io_safety feature is stableRalf Jung-8/+14
2023-09-22Auto merge of #114780 - RalfJung:io-safety, r=Amanieubors-28/+52
add more explicit I/O safety documentation Fixes https://github.com/rust-lang/unsafe-code-guidelines/issues/434 Cc https://github.com/rust-lang/rust/issues/114167 Cc `@Manishearth` `@sunfishcode` `@joshtriplett`
2023-09-21added support for GNU/HurdSamuel Thibault-0/+391
2023-09-19Auto merge of #104101 - betrusted-io:xous-libstd-initial, r=bjorn3bors-0/+1390
Add initial libstd support for Xous This patchset adds some minimal support to the tier-3 target `riscv32imac-unknown-xous-elf`. The following features are supported: * alloc * thread creation and joining * thread sleeping * thread_local * panic_abort * mutex * condvar * stdout Additionally, internal support for the various Xous primitives surrounding IPC have been added as part of the Xous FFI. These may be exposed as part of `std::os::xous::ffi` in the future, however for now they are not public. This represents the minimum viable product. A future patchset will add support for networking and filesystem support.
2023-09-16Rollup merge of #115329 - xzmeng:fix-std-doc, r=dtolnayMatthias Krüger-1/+1
fix std::primitive doc: homogenous -> homogeneous replace "homogenous" with the more commonly used "homogeneous".
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-08-29fix a doc typo at std::os::unix::fs::FileExt::write_atMeng Xiangzhuo-1/+1
2023-08-28Abstract over internal `SOCKET` typeChris Denton-4/+4
This allows `SOCKET` to be `usize` internally
2023-08-28Auto merge of #114848 - michaelvanstraten:spawn_with_attributes, r=ChrisDentonbors-0/+69
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-28Rollup merge of #114512 - devnexen:fix_tests_fbsd, r=thomccMatthias Krüger-1/+1
std/tests: disable ancillary tests on freebsd since the feature itsel… …f is.
2023-08-25Added option to set ProcThreadAttributes for Windows processesMichael van Straten-0/+69
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-22std: xous: add support for locksSean Cross-0/+4
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 services supportSean Cross-0/+264
Xous has a concept of `services` that provide various features. Processes may connect to these services by name or by address. Most services require a name server in order to connect. Add a file with the most common services, and provide a way to connect to a service by querying the name server. Signed-off-by: Sean Cross <sean@xobs.io>
2023-08-22std: xous: add os-specific ffi callsSean Cross-0/+1122
Xous has no C FFI. Instead, all FFI is done via syscalls that are specified in Rust. Add these FFI calls to libstd, as well as some of the currently-supported syscalls. This enables Rust programs to interact with the Xous operating system while avoiding adding an extra dependency to libstd. Signed-off-by: Sean Cross <sean@xobs.io>
2023-08-22Replace version placeholders with 1.73.0Mark Rousskov-3/+3
2023-08-14add a csky-unknown-linux-gnuabiv2 targetDirreke-0/+2
2023-08-14mention /proc/self/fd with /proc/self/memRalf Jung-3/+3
2023-08-14wording; and explain some of the possible consequences of violating io-safetyRalf Jung-2/+2
2023-08-14typosRalf Jung-1/+1
2023-08-14sync the various FromRawFd trait docs, and remove 'valid'Ralf Jung-21/+32
2023-08-13add more explicit I/O safety documentationRalf Jung-9/+22
2023-08-10Rollup merge of #114194 - thomcc:flushinline, r=cuviperMichael Goulet-0/+1
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-05std/tests: disable ancillary tests on freebsd since the feature itself is.David CARLIER-1/+1
2023-07-28inline trivial (noop) flush callsThom Chiovoloni-0/+1
2023-07-26Add definitions for riscv64_linux_android targetChris Wailes-1/+1
2023-07-26Auto merge of #102757 - pcc:android-std-tests, r=workingjubileebors-0/+18
Make std tests pass on newer Android Newer versions of Android forbid the creation of hardlinks as well as Unix domain sockets in the /data filesystem via SELinux rules, which causes several tests depending on this behavior to fail. So let's skip these tests on Android if we see an EACCES from one of these syscalls. To achieve this, introduce a macro with the horrible name of or_panic_or_skip_on_android_eacces (better suggestions welcome) which skips (returns from) the test if an EACCES return value is seen on Android.
2023-07-22Rollup merge of #113876 - darklyspaced:master, r=cuviperMatthias Krüger-1/+30
fix docs & example for `std::os::unix::prelude::FileExt::write_at` Changelog: * used `File::create` instead of `File::read` to get a writeable file * explicity mentioned the bug with `pwrite64` in docs Unfortunately, I don't think that there is really much we can do about this since the feature has already been stabilised. We could potentially add a clippy lint warning people on Linux that using `write_at` with the `O_APPEND` flag does not exhibit the behaviour that they would have assumed. fixes #113627
2023-07-22Rollup merge of #112490 - Alexendoo:c-char-cfg-all, r=cuviperMatthias Krüger-5/+0
Remove `#[cfg(all())]` workarounds from `c_char` Casts to type aliases are now ignored by Clippy https://github.com/rust-lang/rust-clippy/pull/8596 Closes https://github.com/rust-lang/rust-clippy/issues/8093
2023-07-22Auto merge of #113033 - JohnTitor:stabilize-unix-chown, r=cuviperbors-6/+3
Stabilize chown functions (`unix_chown`) Closes #88989 FCP is complete here: https://github.com/rust-lang/rust/issues/88989#issuecomment-1561125635
2023-07-20added a problematic exampledarklyspaced-3/+25
2023-07-20fix docs & example for FileExt::write_atdarklyspaced-1/+8