Skip to content

std: make positioned I/O unsupported on VxWorks - #160031

Open
JohnTitor wants to merge 1 commit into
rust-lang:mainfrom
JohnTitor:vxworks-pread-pwrite-unsupported
Open

std: make positioned I/O unsupported on VxWorks#160031
JohnTitor wants to merge 1 commit into
rust-lang:mainfrom
JohnTitor:vxworks-pread-pwrite-unsupported

Conversation

@JohnTitor

Copy link
Copy Markdown
Member

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

@rustbot

rustbot commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

r? @Darksonn

rustbot has assigned @Darksonn.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @ChrisDenton, libs
  • @ChrisDenton, libs expanded to 13 candidates
  • Random selection from 6 candidates

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jul 27, 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;
}

@Darksonn Darksonn Jul 28, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
}

View changes since the review

@Darksonn Darksonn added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

libc 0.2.187 dropped pread/pwrite for vxworks, but std still imports them

3 participants