Skip to content

Commit

Permalink
Auto merge of #3159 - tatref:linux-madv, r=JohnTitor
Browse files Browse the repository at this point in the history
Linux madv

This is a followup of #2818
  • Loading branch information
bors committed Apr 22, 2023
2 parents 9e90211 + f3e1417 commit 2de3ab9
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
15 changes: 15 additions & 0 deletions libc-test/build.rs
Expand Up @@ -1788,6 +1788,14 @@ fn test_android(target: &str) {
// kernel 5.10 minimum required
"MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ" | "MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ" => true,

// kernel 5.18 minimum
| "MADV_COLD"
| "MADV_DONTNEED_LOCKED"
| "MADV_PAGEOUT"
| "MADV_POPULATE_READ"
| "MADV_POPULATE_WRITE" => true,


_ => false,
}
});
Expand Down Expand Up @@ -3714,13 +3722,20 @@ fn test_linux(target: &str) {
// Added in Linux 5.13
"PTRACE_GET_RSEQ_CONFIGURATION" if sparc64 => true,

| "MADV_COLD"
| "MADV_PAGEOUT"
| "MADV_POPULATE_READ"
| "MADV_POPULATE_WRITE"
if sparc64 || musl => true,

// FIXME: Requires more recent kernel headers
| "IFLA_PARENT_DEV_NAME" // linux v5.13+
| "IFLA_PARENT_DEV_BUS_NAME" // linux v5.13+
| "IFLA_GRO_MAX_SIZE" // linux v5.16+
| "IFLA_TSO_MAX_SIZE" // linux v5.18+
| "IFLA_TSO_MAX_SEGS" // linux v5.18+
| "IFLA_ALLMULTI" // linux v6.0+
| "MADV_DONTNEED_LOCKED" // linux v5.18+
=> true,
"SCTP_FUTURE_ASSOC" | "SCTP_CURRENT_ASSOC" | "SCTP_ALL_ASSOC" | "SCTP_PEER_ADDR_THLDS_V2" => true, // linux 5.5+

Expand Down
7 changes: 7 additions & 0 deletions libc-test/semver/linux.txt
Expand Up @@ -1286,22 +1286,29 @@ LOG_FTP
LOG_NFACILITIES
LOG_PERROR
L_tmpnam
MADV_COLD
MADV_DODUMP
MADV_DOFORK
MADV_DONTDUMP
MADV_DONTFORK
MADV_DONTNEED
MADV_DONTNEED_LOCKED
MADV_FREE
MADV_HUGEPAGE
MADV_HWPOISON
MADV_KEEPONFORK
MADV_MERGEABLE
MADV_NOHUGEPAGE
MADV_NORMAL
MADV_PAGEOUT
MADV_POPULATE_READ
MADV_POPULATE_WRITE
MADV_RANDOM
MADV_REMOVE
MADV_SEQUENTIAL
MADV_UNMERGEABLE
MADV_WILLNEED
MADV_WIPEONFORK
MAP_DENYWRITE
MAP_EXECUTABLE
MAP_FILE
Expand Down
11 changes: 11 additions & 0 deletions src/unix/linux_like/mod.rs
Expand Up @@ -662,7 +662,18 @@ pub const MADV_HUGEPAGE: ::c_int = 14;
pub const MADV_NOHUGEPAGE: ::c_int = 15;
pub const MADV_DONTDUMP: ::c_int = 16;
pub const MADV_DODUMP: ::c_int = 17;
pub const MADV_WIPEONFORK: ::c_int = 18;
pub const MADV_KEEPONFORK: ::c_int = 19;
pub const MADV_COLD: ::c_int = 20;
pub const MADV_PAGEOUT: ::c_int = 21;
pub const MADV_HWPOISON: ::c_int = 100;
cfg_if! {
if #[cfg(not(target_os = "emscripten"))] {
pub const MADV_POPULATE_READ: ::c_int = 22;
pub const MADV_POPULATE_WRITE: ::c_int = 23;
pub const MADV_DONTNEED_LOCKED: ::c_int = 24;
}
}

pub const IFF_UP: ::c_int = 0x1;
pub const IFF_BROADCAST: ::c_int = 0x2;
Expand Down

0 comments on commit 2de3ab9

Please sign in to comment.