Skip to content

Commit a1e4649

Browse files
authored
Merge pull request #4452 from rust-lang/more-pwritev2-flags
linux: add new flags for pwritev2/preadv2
2 parents 76696a2 + 6e7549d commit a1e4649

File tree

6 files changed

+27
-15
lines changed

6 files changed

+27
-15
lines changed

libc-test/build.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4468,6 +4468,15 @@ fn test_linux(target: &str) {
44684468
// kernel 6.2 minimum
44694469
"TUN_F_USO4" | "TUN_F_USO6" | "IFF_NO_CARRIER" => true,
44704470

4471+
// kernel 6.9 minimum
4472+
"RWF_NOAPPEND" => true,
4473+
4474+
// kernel 6.11 minimum
4475+
"RWF_ATOMIC" => true,
4476+
4477+
// kernel 6.14 minimum
4478+
"RWF_DONTCACHE" => true,
4479+
44714480
// FIXME(linux): Requires more recent kernel headers
44724481
| "IFLA_PARENT_DEV_NAME" // linux v5.13+
44734482
| "IFLA_PARENT_DEV_BUS_NAME" // linux v5.13+

libc-test/semver/linux-gnu.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,8 +389,11 @@ RTM_NEWCACHEREPORT
389389
RTM_NEWSTATS
390390
RUN_LVL
391391
RWF_APPEND
392+
RWF_ATOMIC
393+
RWF_DONTCACHE
392394
RWF_DSYNC
393395
RWF_HIPRI
396+
RWF_NOAPPEND
394397
RWF_NOWAIT
395398
RWF_SYNC
396399
SECURITYFS_MAGIC

libc-test/semver/linux-musl.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,11 @@ PR_SET_VMA
3232
PR_SET_VMA_ANON_NAME
3333
RUN_LVL
3434
RWF_APPEND
35+
RWF_ATOMIC
36+
RWF_DONTCACHE
3537
RWF_DSYNC
3638
RWF_HIPRI
39+
RWF_NOAPPEND
3740
RWF_NOWAIT
3841
RWF_SYNC
3942
USER_PROCESS

src/unix/linux_like/linux/gnu/mod.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -946,15 +946,6 @@ pub const PTRACE_SYSCALL_INFO_SECCOMP: crate::__u8 = 3;
946946
pub const PTRACE_SET_SYSCALL_USER_DISPATCH_CONFIG: crate::__u8 = 0x4210;
947947
pub const PTRACE_GET_SYSCALL_USER_DISPATCH_CONFIG: crate::__u8 = 0x4211;
948948

949-
// linux/fs.h
950-
951-
// Flags for preadv2/pwritev2
952-
pub const RWF_HIPRI: c_int = 0x00000001;
953-
pub const RWF_DSYNC: c_int = 0x00000002;
954-
pub const RWF_SYNC: c_int = 0x00000004;
955-
pub const RWF_NOWAIT: c_int = 0x00000008;
956-
pub const RWF_APPEND: c_int = 0x00000010;
957-
958949
// linux/rtnetlink.h
959950
pub const TCA_PAD: c_ushort = 9;
960951
pub const TCA_DUMP_INVISIBLE: c_ushort = 10;

src/unix/linux_like/linux/mod.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2858,6 +2858,18 @@ pub const IFA_F_NOPREFIXROUTE: u32 = 0x200;
28582858
pub const IFA_F_MCAUTOJOIN: u32 = 0x400;
28592859
pub const IFA_F_STABLE_PRIVACY: u32 = 0x800;
28602860

2861+
// linux/fs.h
2862+
2863+
// Flags for preadv2/pwritev2
2864+
pub const RWF_HIPRI: c_int = 0x00000001;
2865+
pub const RWF_DSYNC: c_int = 0x00000002;
2866+
pub const RWF_SYNC: c_int = 0x00000004;
2867+
pub const RWF_NOWAIT: c_int = 0x00000008;
2868+
pub const RWF_APPEND: c_int = 0x00000010;
2869+
pub const RWF_NOAPPEND: c_int = 0x00000020;
2870+
pub const RWF_ATOMIC: c_int = 0x00000040;
2871+
pub const RWF_DONTCACHE: c_int = 0x00000080;
2872+
28612873
// linux/if_link.h
28622874
pub const IFLA_UNSPEC: c_ushort = 0;
28632875
pub const IFLA_ADDRESS: c_ushort = 1;

src/unix/linux_like/linux/musl/mod.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -749,12 +749,6 @@ pub const PTRACE_PEEKSIGINFO: c_int = 0x4209;
749749
pub const PTRACE_GETSIGMASK: c_uint = 0x420a;
750750
pub const PTRACE_SETSIGMASK: c_uint = 0x420b;
751751

752-
pub const RWF_HIPRI: c_int = 0x00000001;
753-
pub const RWF_DSYNC: c_int = 0x00000002;
754-
pub const RWF_SYNC: c_int = 0x00000004;
755-
pub const RWF_NOWAIT: c_int = 0x00000008;
756-
pub const RWF_APPEND: c_int = 0x00000010;
757-
758752
pub const AF_IB: c_int = 27;
759753
pub const AF_MPLS: c_int = 28;
760754
pub const AF_NFC: c_int = 39;

0 commit comments

Comments
 (0)