Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2172,7 +2172,13 @@ fn test_android(target: &str) {
"SOF_TIMESTAMPING_OPT_RX_FILTER" => true,

// FIXME(android): Requires >= 6.9 kernel headers.
"AT_HWCAP3" | "AT_HWCAP4" => true,
"AT_HWCAP3" | "AT_HWCAP4" | "RWF_NOAPPEND" => true,

// FIXME(android): Requires >= 6.11 kernel headers.
"RWF_ATOMIC" => true,

// FIXME(android): Requires >= 6.14 kernel headers.
"RWF_DONTCACHE" => true,

_ => false,
}
Expand Down Expand Up @@ -2206,6 +2212,9 @@ fn test_android(target: &str) {
// Added in API level 30, but tests use level 28.
"memfd_create" | "mlock2" | "renameat2" | "statx" | "statx_timestamp" => true,

// Added in API level 33, but tests use level 28.
"preadv2" | "pwritev2" => true,

// Added in glibc 2.25.
"getentropy" => true,

Expand Down
10 changes: 10 additions & 0 deletions libc-test/semver/android.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2364,6 +2364,14 @@ RT_TABLE_MAIN
RT_TABLE_UNSPEC
RUSAGE_CHILDREN
RUSAGE_SELF
RWF_APPEND
RWF_ATOMIC
RWF_DONTCACHE
RWF_DSYNC
RWF_HIPRI
RWF_NOAPPEND
RWF_NOWAIT
RWF_SYNC
R_OK
SA_NOCLDSTOP
SA_NOCLDWAIT
Expand Down Expand Up @@ -3765,6 +3773,7 @@ prctl
pread
pread64
preadv
preadv2
preadv64
printf
prlimit
Expand Down Expand Up @@ -3868,6 +3877,7 @@ puts
pwrite
pwrite64
pwritev
pwritev2
pwritev64
qsort
raise
Expand Down
24 changes: 24 additions & 0 deletions src/unix/linux_like/android/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3284,6 +3284,16 @@ pub const AT_MINSIGSTKSZ: c_ulong = 51;
pub const SI_DETHREAD: c_int = -7;
pub const TRAP_PERF: c_int = 6;

// Flags for preadv2/pwritev2
pub const RWF_HIPRI: c_int = 0x00000001;
pub const RWF_DSYNC: c_int = 0x00000002;
pub const RWF_SYNC: c_int = 0x00000004;
pub const RWF_NOWAIT: c_int = 0x00000008;
pub const RWF_APPEND: c_int = 0x00000010;
pub const RWF_NOAPPEND: c_int = 0x00000020;
pub const RWF_ATOMIC: c_int = 0x00000040;
pub const RWF_DONTCACHE: c_int = 0x00000080;

// Most `*_SUPER_MAGIC` constants are defined at the `linux_like` level; the
// following are only available on newer Linux versions than the versions
// currently used in CI in some configurations, so we define them here.
Expand Down Expand Up @@ -3758,6 +3768,20 @@ extern "C" {
newpath: *const c_char,
flags: c_uint,
) -> c_int;
pub fn preadv2(
fd: c_int,
iov: *const crate::iovec,
iovcnt: c_int,
offset: off_t,
flags: c_int,
) -> ssize_t;
pub fn pwritev2(
fd: c_int,
iov: *const crate::iovec,
iovcnt: c_int,
offset: off_t,
flags: c_int,
) -> ssize_t;
}

cfg_if! {
Expand Down
16 changes: 0 additions & 16 deletions src/unix/linux_like/linux/gnu/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1017,22 +1017,6 @@ extern "C" {
dirfd: c_int,
path: *const c_char,
) -> c_int;
#[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;
pub fn preadv64v2(
fd: c_int,
iov: *const crate::iovec,
Expand Down
18 changes: 18 additions & 0 deletions src/unix/linux_like/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4070,6 +4070,24 @@ extern "C" {
flags: c_int,
) -> c_int;
pub fn open_by_handle_at(mount_fd: c_int, handle: *mut file_handle, flags: c_int) -> c_int;
#[cfg_attr(gnu_file_offset_bits64, link_name = "preadv64v2")]
#[cfg(not(target_env = "uclibc"))]
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")]
#[cfg(not(target_env = "uclibc"))]
pub fn pwritev2(
fd: c_int,
iov: *const crate::iovec,
iovcnt: c_int,
offset: off_t,
flags: c_int,
) -> ssize_t;
Comment on lines +4073 to +4090

@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.

}

// LFS64 extensions
Expand Down
14 changes: 0 additions & 14 deletions src/unix/linux_like/linux/musl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -778,20 +778,6 @@ extern "C" {
dirfd: c_int,
path: *const c_char,
) -> c_int;
pub fn preadv2(
fd: c_int,
iov: *const crate::iovec,
iovcnt: c_int,
offset: off_t,
flags: c_int,
) -> ssize_t;
pub fn pwritev2(
fd: c_int,
iov: *const crate::iovec,
iovcnt: c_int,
offset: off_t,
flags: c_int,
) -> ssize_t;
pub fn getauxval(type_: c_ulong) -> c_ulong;
pub fn renameat2(
olddirfd: c_int,
Expand Down