std: make positioned I/O unsupported on VxWorks - #160031
Open
JohnTitor wants to merge 1 commit into
Open
Conversation
Collaborator
|
r? @Darksonn rustbot has assigned @Darksonn. Use Why was this reviewer chosen?The reviewer was selected based on:
|
Darksonn
reviewed
Jul 28, 2026
Comment on lines
+22
to
32
| #[cfg(not(target_os = "vxworks"))] | ||
| cfg_select! { | ||
| any( | ||
| all(target_os = "linux", not(target_env = "musl")), | ||
| target_os = "android", | ||
| target_os = "hurd", | ||
| ) => { | ||
| // Prefer explicit pread64 for 64-bit offset independently of libc | ||
| // #[cfg(gnu_file_offset_bits64)]. | ||
| use libc::pread64; | ||
| } |
Member
There was a problem hiding this comment.
Hmm, this is a bit messy. The current code has isolated all the conditional logic to this cfg_select!, but this PR introduces conditional logic in a bunch of other places.
If you do this, you can keep the conditional logic in one place:
Suggested change
| cfg_select! { | |
| target_os = "vxworks" => { | |
| pub unsafe fn pread64( | |
| _fd: c_int, | |
| _buf: *mut c_void, | |
| _count: size_t, | |
| _offset: off64_t | |
| ) -> ssize_t { | |
| -1 | |
| } | |
| } | |
| any( | |
| all(target_os = "linux", not(target_env = "musl")), | |
| target_os = "android", | |
| target_os = "hurd", | |
| ) => { | |
| // Prefer explicit pread64 for 64-bit offset independently of libc | |
| // #[cfg(gnu_file_offset_bits64)]. | |
| use libc::pread64; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, build-std for VxWorks fails because std calls pread/pwrite for positioned I/O.
Previously libc defined them as shims, but recently these were removed to align the actual state of SDK: rust-lang/libc#5129
It should make sense to return an unsupported error for VxWorks.
Fix rust-lang/libc#5328