Skip to content

unix: add preadv2 and pwritev2 to android#5157

Merged
tgross35 merged 1 commit into
rust-lang:mainfrom
Elie-Kh:linux-preadwritev2
Jul 20, 2026
Merged

unix: add preadv2 and pwritev2 to android#5157
tgross35 merged 1 commit into
rust-lang:mainfrom
Elie-Kh:linux-preadwritev2

Conversation

@Elie-Kh

@Elie-Kh Elie-Kh commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Add preadv2 and pwrite2 to linux and Android, making majority of linux_like based systems have support, to allow using the new flags introduced in #4452. Move definitions to linux_like/mod.rs instead of each separate system alone.

  • Relevant tests in libc-test/semver have been updated - no tests to modify
  • No placeholder or unstable values like *LAST or *MAX are
    included (see #3131)
  • [~] Tested locally (cd libc-test && cargo test --target mytarget);
    especially relevant for platforms that may not be checked in CI

Getting error while testing locally due to different linux version and mismatch of SW_MAX and MS_NOUSER. Modifying those to match local system (0x11 and 0x80000000) shows passing tests using cargo test.

Unable to test other systems, need to run CI

Android source for preadv2 and pwritev2 support: https://android.googlesource.com/platform/bionic/+/cf59e19e22fc7c4795fd955eeecd1f457d79eba0/libc/include/sys/uio.h#117

@rustbot

rustbot commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in an Android module

cc @maurer

@Elie-Kh
Elie-Kh force-pushed the linux-preadwritev2 branch from ec99a98 to fe75a48 Compare June 8, 2026 16:47
@rustbot rustbot added the A-CI Area: CI-related items label Jun 8, 2026
@rustbot

This comment has been minimized.

@Elie-Kh Elie-Kh changed the title unix: add preadv2 and pwritev2 unix-wide. unix: add preadv2 and pwritev2 to android and linux Jun 8, 2026
@JohnTitor

Copy link
Copy Markdown
Member

Seems you messed up the commits in the branch, could you fix it to have exact one commit?

@Elie-Kh

Elie-Kh commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

Sure thing, it's been a minute since I've worked with github, let me fix that

@Elie-Kh
Elie-Kh force-pushed the linux-preadwritev2 branch from 5ce60e5 to 0257c2a Compare June 8, 2026 21:41
@Elie-Kh

Elie-Kh commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

And that should have it fixed!

@Elie-Kh
Elie-Kh force-pushed the linux-preadwritev2 branch from 0257c2a to 3c6d867 Compare June 9, 2026 00:59
@rustbot

This comment has been minimized.

@Elie-Kh
Elie-Kh force-pushed the linux-preadwritev2 branch from 3c6d867 to b55b402 Compare June 9, 2026 18:26
@rustbot

This comment has been minimized.

@Elie-Kh
Elie-Kh force-pushed the linux-preadwritev2 branch from b55b402 to d158103 Compare June 9, 2026 18:26
@rustbot

This comment has been minimized.

@JohnTitor
JohnTitor force-pushed the linux-preadwritev2 branch from d158103 to 1d61311 Compare June 14, 2026 00:13
@rustbot

This comment has been minimized.

@JohnTitor

Copy link
Copy Markdown
Member

@Elie-Kh
Elie-Kh force-pushed the linux-preadwritev2 branch from 1d61311 to 49416c1 Compare June 17, 2026 16:53
@rustbot

This comment has been minimized.

@tgross35 tgross35 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you please link the Android sources you are referencing so we don't need to dig them up? (This is requested in the PR template)

View changes since this review

Comment thread src/unix/linux_like/linux/mod.rs Outdated
Comment on lines +4373 to +4388
#[cfg_attr(gnu_file_offset_bits64, link_name = "preadv64v2")]
pub fn preadv2(
fd: c_int,
iov: *const crate::iovec,
iovcnt: c_int,
offset: off_t,
flags: c_int,
) -> ssize_t;
#[cfg_attr(gnu_file_offset_bits64, link_name = "pwritev64v2")]
pub fn pwritev2(
fd: c_int,
iov: *const crate::iovec,
iovcnt: c_int,
offset: off_t,
flags: c_int,
) -> ssize_t;

@tgross35 tgross35 Jun 21, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think these aren't available in uclibc so should be left as is (link a source please if this isn't accurate)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can the linux_like/ilnux module be restored to the way it was before? I don't think there is any reason for this part of the change.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You are correct for uclibc, I added a cfg to skip. I explained in another comment that the change is being introduced in crosvm, we benefit from having Linux support.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It was already supported on Linux prior to this PR? You're moving the definitions from the gnu and musl modules to linux then disabling uclibc, which is no net change.

@rustbot

rustbot commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rustbot

This comment has been minimized.

@Elie-Kh
Elie-Kh requested a review from tgross35 June 24, 2026 01:22
Comment thread src/unix/linux_like/linux/mod.rs Outdated
Comment on lines +4373 to +4388
#[cfg_attr(gnu_file_offset_bits64, link_name = "preadv64v2")]
pub fn preadv2(
fd: c_int,
iov: *const crate::iovec,
iovcnt: c_int,
offset: off_t,
flags: c_int,
) -> ssize_t;
#[cfg_attr(gnu_file_offset_bits64, link_name = "pwritev64v2")]
pub fn pwritev2(
fd: c_int,
iov: *const crate::iovec,
iovcnt: c_int,
offset: off_t,
flags: c_int,
) -> ssize_t;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can the linux_like/ilnux module be restored to the way it was before? I don't think there is any reason for this part of the change.

@rustbot

This comment has been minimized.

@rustbot

This comment has been minimized.

@Elie-Kh
Elie-Kh force-pushed the linux-preadwritev2 branch from 2775a5a to 94788f5 Compare July 13, 2026 17:08
@rustbot

This comment has been minimized.

@Elie-Kh
Elie-Kh requested a review from tgross35 July 13, 2026 17:21
Comment thread src/unix/linux_like/linux/mod.rs Outdated
Comment on lines +4373 to +4388
#[cfg_attr(gnu_file_offset_bits64, link_name = "preadv64v2")]
pub fn preadv2(
fd: c_int,
iov: *const crate::iovec,
iovcnt: c_int,
offset: off_t,
flags: c_int,
) -> ssize_t;
#[cfg_attr(gnu_file_offset_bits64, link_name = "pwritev64v2")]
pub fn pwritev2(
fd: c_int,
iov: *const crate::iovec,
iovcnt: c_int,
offset: off_t,
flags: c_int,
) -> ssize_t;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It was already supported on Linux prior to this PR? You're moving the definitions from the gnu and musl modules to linux then disabling uclibc, which is no net change.

@Elie-Kh
Elie-Kh force-pushed the linux-preadwritev2 branch from 94788f5 to a74100f Compare July 20, 2026 18:31
@rustbot

This comment has been minimized.

@Elie-Kh
Elie-Kh force-pushed the linux-preadwritev2 branch from a74100f to 80fa27b Compare July 20, 2026 18:31
@Elie-Kh Elie-Kh changed the title unix: add preadv2 and pwritev2 to android and linux unix: add preadv2 and pwritev2 to android Jul 20, 2026
Add preadv2 and pwrite2 to Android, to allow using the new flags
introduced in rust-lang#4452. Add flags to Android too
Skip test on Android due to the definitions being introduced in API 33
@Elie-Kh
Elie-Kh force-pushed the linux-preadwritev2 branch from 80fa27b to 0c97767 Compare July 20, 2026 18:32
@rustbot

rustbot commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@Elie-Kh
Elie-Kh requested a review from tgross35 July 20, 2026 18:33

@tgross35 tgross35 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@tgross35
tgross35 enabled auto-merge July 20, 2026 18:42
@tgross35
tgross35 added this pull request to the merge queue Jul 20, 2026
Merged via the queue into rust-lang:main with commit 63fde92 Jul 20, 2026
57 checks passed
@tgross35 tgross35 added the stable-nominated This PR should be considered for cherry-pick to libc's stable release branch label Jul 20, 2026
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Jul 20, 2026
Add preadv2 and pwrite2 to Android, to allow using the new flags
introduced in rust-lang#4452. Add flags to Android too
Skip test on Android due to the definitions being introduced in API 33

(backport <rust-lang#5157>)
(cherry picked from commit 63fde92)
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Jul 20, 2026
Add preadv2 and pwrite2 to Android, to allow using the new flags
introduced in rust-lang#4452. Add flags to Android too
Skip test on Android due to the definitions being introduced in API 33

(backport <rust-lang#5157>)
(cherry picked from commit 63fde92)
@tgross35 tgross35 mentioned this pull request Jul 20, 2026
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Jul 20, 2026
Add preadv2 and pwrite2 to Android, to allow using the new flags
introduced in rust-lang#4452. Add flags to Android too
Skip test on Android due to the definitions being introduced in API 33

(backport <rust-lang#5157>)
(cherry picked from commit 63fde92)
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Jul 20, 2026
Add preadv2 and pwrite2 to Android, to allow using the new flags
introduced in rust-lang#4452. Add flags to Android too
Skip test on Android due to the definitions being introduced in API 33

(backport <rust-lang#5157>)
(cherry picked from commit 63fde92)
@tgross35 tgross35 added stable-applied This PR has been cherry-picked to libc's stable release branch and removed stable-nominated This PR should be considered for cherry-pick to libc's stable release branch labels Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CI Area: CI-related items O-android O-gnu O-linux O-linux-like O-musl O-unix S-waiting-on-author stable-applied This PR has been cherry-picked to libc's stable release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants