-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide optional Read
/Write
methods for stdio
#136769
base: master
Are you sure you want to change the base?
Provide optional Read
/Write
methods for stdio
#136769
Conversation
r? @Noratrieb rustbot has assigned @Noratrieb. Use |
This comment has been minimized.
This comment has been minimized.
6d101c2
to
3deb1ce
Compare
r? joboet |
Read
/Write
method for stdioRead
/Write
methods for stdio
f51bb4e
to
118bb74
Compare
I dropped a few commits from this PR:
|
As per rust-lang#117276, this moves the platform definitions of `Stdout` and friends into `sys`. This PR also unifies the UNIX and Hermit implementations and moves the `__rust_print_err` function needed by libunwind on SGX into the dedicated module for such helper functions.
Since this touches a lot of targets, I'm going to split this into multiple PRs for more target-focused review, once #136780 goes through the merge queue. |
That'd be great, thank you! Especially the SGX stuff would be much simpler to review as a dedicated PR. |
This seems to be the pattern for newer pal stdio types.
118bb74
to
ade071b
Compare
The raw types for standard I/O across platforms vary by which of the optional
io::Read
andio::Write
methods they provide and most just use the defaults. Only Unix implementsread_buf
,read_vectored
, andwrite_vectored
for its stdio. Provide these methods for the platforms which support them or when useful. Additionally, provide missing methods forStdinRaw
,StdoutLock
, andStderrLock
, which the other similar types provide.I have checked the code against a target per platform modified, with wasm32-unknown-unknown for unsupported stdio, as well as Linux, macOS, and Windows.
Progress on optional
Read
/Write
methods is tracked in #136756.Later work
Windows and UEFI stdio use UTF-16, so will take more work to flesh out. I plan to refactor the WTF-8 abstraction from
OsStr
to accommodate this in a future PR.