Skip to content

linux: add new flags for pwritev2/preadv2 #4452

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 13, 2025
Merged
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
9 changes: 9 additions & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4468,6 +4468,15 @@ fn test_linux(target: &str) {
// kernel 6.2 minimum
"TUN_F_USO4" | "TUN_F_USO6" | "IFF_NO_CARRIER" => true,

// kernel 6.9 minimum
"RWF_NOAPPEND" => true,

// kernel 6.11 minimum
"RWF_ATOMIC" => true,

// kernel 6.14 minimum
"RWF_DONTCACHE" => true,

// FIXME(linux): Requires more recent kernel headers
| "IFLA_PARENT_DEV_NAME" // linux v5.13+
| "IFLA_PARENT_DEV_BUS_NAME" // linux v5.13+
Expand Down
3 changes: 3 additions & 0 deletions libc-test/semver/linux-gnu.txt
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,11 @@ RTM_NEWCACHEREPORT
RTM_NEWSTATS
RUN_LVL
RWF_APPEND
RWF_ATOMIC
RWF_DONTCACHE
RWF_DSYNC
RWF_HIPRI
RWF_NOAPPEND
RWF_NOWAIT
RWF_SYNC
SECURITYFS_MAGIC
Expand Down
3 changes: 3 additions & 0 deletions libc-test/semver/linux-musl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@ PR_SET_VMA
PR_SET_VMA_ANON_NAME
RUN_LVL
RWF_APPEND
RWF_ATOMIC
RWF_DONTCACHE
RWF_DSYNC
RWF_HIPRI
RWF_NOAPPEND
RWF_NOWAIT
RWF_SYNC
USER_PROCESS
Expand Down
9 changes: 0 additions & 9 deletions src/unix/linux_like/linux/gnu/mod.rs
Copy link
Contributor

Choose a reason for hiding this comment

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

Since these are uapi, they can go in linux_like/linux/mod.rs to cover both glibc and musl (and others)

Original file line number Diff line number Diff line change
Expand Up @@ -946,15 +946,6 @@ pub const PTRACE_SYSCALL_INFO_SECCOMP: crate::__u8 = 3;
pub const PTRACE_SET_SYSCALL_USER_DISPATCH_CONFIG: crate::__u8 = 0x4210;
pub const PTRACE_GET_SYSCALL_USER_DISPATCH_CONFIG: crate::__u8 = 0x4211;

// linux/fs.h

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

// linux/rtnetlink.h
pub const TCA_PAD: c_ushort = 9;
pub const TCA_DUMP_INVISIBLE: c_ushort = 10;
Expand Down
12 changes: 12 additions & 0 deletions src/unix/linux_like/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2858,6 +2858,18 @@ pub const IFA_F_NOPREFIXROUTE: u32 = 0x200;
pub const IFA_F_MCAUTOJOIN: u32 = 0x400;
pub const IFA_F_STABLE_PRIVACY: u32 = 0x800;

// linux/fs.h

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

// linux/if_link.h
pub const IFLA_UNSPEC: c_ushort = 0;
pub const IFLA_ADDRESS: c_ushort = 1;
Expand Down
6 changes: 0 additions & 6 deletions src/unix/linux_like/linux/musl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -749,12 +749,6 @@ pub const PTRACE_PEEKSIGINFO: c_int = 0x4209;
pub const PTRACE_GETSIGMASK: c_uint = 0x420a;
pub const PTRACE_SETSIGMASK: c_uint = 0x420b;

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 AF_IB: c_int = 27;
pub const AF_MPLS: c_int = 28;
pub const AF_NFC: c_int = 39;
Expand Down
Loading