rust/library/std/src/sys/unix
bors e2d6aa77ed Auto merge of #98704 - vthib:impl-from-raw-for-childstd-structs, r=dtolnay
Implement From<OwnedFd/Handle> for ChildStdin/out/err object

## Summary

Comments in `library/std/src/process.rs` ( ab08639e59 ) 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-28 09:59:03 +00:00
..
fd I/O safety. 2021-08-19 12:02:39 -07:00
kernel_copy test that modifications to the source don't become visible after io::copy 2023-04-03 21:10:02 +02:00
locks Finish up preliminary tvos support in libstd 2023-06-21 14:59:39 -07:00
os Refactor weak symbols in std::sys::unix 2021-11-12 15:25:16 -08:00
os_str fix(std): Rename os_str_bytes to encoded_bytes 2023-09-01 19:33:16 -05:00
process Rollup merge of #114379 - RalfJung:command-removed-env-vars, r=m-ou-se 2023-09-22 12:15:25 +02:00
thread_parking Raise minimum supported macOS to 10.12 2023-09-23 19:14:25 -05:00
alloc.rs wasi: round up the size for aligned_alloc 2023-08-26 11:50:16 -07:00
android.rs Replace libstd, libcore, liballoc in docs. 2022-12-30 14:00:40 +01:00
args.rs added support for GNU/Hurd 2023-09-21 17:31:25 +02:00
cmath.rs Add gamma and ln_gamma functions to f32 and f64 2023-07-31 07:41:50 -07:00
env.rs added support for GNU/Hurd 2023-09-21 17:31:25 +02:00
fd.rs added support for GNU/Hurd 2023-09-21 17:31:25 +02:00
fs.rs added support for GNU/Hurd 2023-09-21 17:31:25 +02:00
futex.rs remove some unneeded imports 2023-04-12 19:27:18 +02:00
io.rs Add IsTerminal trait to determine if a descriptor or handle is a terminal 2022-10-15 00:35:38 +01:00
kernel_copy.rs added support for GNU/Hurd 2023-09-21 17:31:25 +02:00
l4re.rs fix: get the l4re target working again 2023-06-13 20:41:33 +00:00
memchr.rs mark FIXMES for all the places found that are probably offset_from 2022-03-29 20:18:28 -04:00
mod.rs added support for GNU/Hurd 2023-09-21 17:31:25 +02:00
net.rs added support for GNU/Hurd 2023-09-21 17:31:25 +02:00
os.rs added support for GNU/Hurd 2023-09-21 17:31:25 +02:00
os_str.rs fix(std): Rename os_str_bytes to encoded_bytes 2023-09-01 19:33:16 -05:00
path.rs fix(std): Rename os_str_bytes to encoded_bytes 2023-09-01 19:33:16 -05:00
pipe.rs Auto merge of #98704 - vthib:impl-from-raw-for-childstd-structs, r=dtolnay 2023-09-28 09:59:03 +00:00
rand.rs Rollup merge of #101994 - devnexen:rand_fbsd_update, r=workingjubilee 2023-07-26 20:49:11 +02:00
stack_overflow.rs added support for GNU/Hurd 2023-09-21 17:31:25 +02:00
stdio.rs inline trivial (noop) flush calls 2023-07-28 18:09:12 -07:00
thread.rs Rollup merge of #116038 - the8472:panic-on-sched_getaffinity-bug, r=cuviper 2023-09-22 12:15:27 +02:00
thread_local_dtor.rs Auto merge of #104385 - BlackHoleFox:apple-minimum-bumps, r=petrochenkov 2023-09-24 02:35:05 +00:00
thread_local_key.rs std: optimize TLS on Windows 2022-10-08 20:19:21 +02:00
time.rs added support for GNU/Hurd 2023-09-21 17:31:25 +02:00
weak.rs wip: Support Apple tvOS in libstd 2023-06-21 14:59:37 -07:00