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 @@ -2171,7 +2171,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 @@ -2205,6 +2211,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
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 @@ -3286,6 +3286,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 @@ -3757,6 +3767,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 @@ -1029,22 +1029,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
16 changes: 16 additions & 0 deletions src/unix/linux_like/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4370,6 +4370,22 @@ 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")]
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;
Comment on lines +4373 to +4388

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

}

// 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 @@ -780,20 +780,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