Skip to content

Commit 2de3ab9

Browse files
committed
Auto merge of #3159 - tatref:linux-madv, r=JohnTitor
Linux madv This is a followup of #2818
2 parents 9e90211 + f3e1417 commit 2de3ab9

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

libc-test/build.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1788,6 +1788,14 @@ fn test_android(target: &str) {
17881788
// kernel 5.10 minimum required
17891789
"MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ" | "MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ" => true,
17901790

1791+
// kernel 5.18 minimum
1792+
| "MADV_COLD"
1793+
| "MADV_DONTNEED_LOCKED"
1794+
| "MADV_PAGEOUT"
1795+
| "MADV_POPULATE_READ"
1796+
| "MADV_POPULATE_WRITE" => true,
1797+
1798+
17911799
_ => false,
17921800
}
17931801
});
@@ -3714,13 +3722,20 @@ fn test_linux(target: &str) {
37143722
// Added in Linux 5.13
37153723
"PTRACE_GET_RSEQ_CONFIGURATION" if sparc64 => true,
37163724

3725+
| "MADV_COLD"
3726+
| "MADV_PAGEOUT"
3727+
| "MADV_POPULATE_READ"
3728+
| "MADV_POPULATE_WRITE"
3729+
if sparc64 || musl => true,
3730+
37173731
// FIXME: Requires more recent kernel headers
37183732
| "IFLA_PARENT_DEV_NAME" // linux v5.13+
37193733
| "IFLA_PARENT_DEV_BUS_NAME" // linux v5.13+
37203734
| "IFLA_GRO_MAX_SIZE" // linux v5.16+
37213735
| "IFLA_TSO_MAX_SIZE" // linux v5.18+
37223736
| "IFLA_TSO_MAX_SEGS" // linux v5.18+
37233737
| "IFLA_ALLMULTI" // linux v6.0+
3738+
| "MADV_DONTNEED_LOCKED" // linux v5.18+
37243739
=> true,
37253740
"SCTP_FUTURE_ASSOC" | "SCTP_CURRENT_ASSOC" | "SCTP_ALL_ASSOC" | "SCTP_PEER_ADDR_THLDS_V2" => true, // linux 5.5+
37263741

libc-test/semver/linux.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,22 +1286,29 @@ LOG_FTP
12861286
LOG_NFACILITIES
12871287
LOG_PERROR
12881288
L_tmpnam
1289+
MADV_COLD
12891290
MADV_DODUMP
12901291
MADV_DOFORK
12911292
MADV_DONTDUMP
12921293
MADV_DONTFORK
12931294
MADV_DONTNEED
1295+
MADV_DONTNEED_LOCKED
12941296
MADV_FREE
12951297
MADV_HUGEPAGE
12961298
MADV_HWPOISON
1299+
MADV_KEEPONFORK
12971300
MADV_MERGEABLE
12981301
MADV_NOHUGEPAGE
12991302
MADV_NORMAL
1303+
MADV_PAGEOUT
1304+
MADV_POPULATE_READ
1305+
MADV_POPULATE_WRITE
13001306
MADV_RANDOM
13011307
MADV_REMOVE
13021308
MADV_SEQUENTIAL
13031309
MADV_UNMERGEABLE
13041310
MADV_WILLNEED
1311+
MADV_WIPEONFORK
13051312
MAP_DENYWRITE
13061313
MAP_EXECUTABLE
13071314
MAP_FILE

src/unix/linux_like/mod.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,18 @@ pub const MADV_HUGEPAGE: ::c_int = 14;
662662
pub const MADV_NOHUGEPAGE: ::c_int = 15;
663663
pub const MADV_DONTDUMP: ::c_int = 16;
664664
pub const MADV_DODUMP: ::c_int = 17;
665+
pub const MADV_WIPEONFORK: ::c_int = 18;
666+
pub const MADV_KEEPONFORK: ::c_int = 19;
667+
pub const MADV_COLD: ::c_int = 20;
668+
pub const MADV_PAGEOUT: ::c_int = 21;
665669
pub const MADV_HWPOISON: ::c_int = 100;
670+
cfg_if! {
671+
if #[cfg(not(target_os = "emscripten"))] {
672+
pub const MADV_POPULATE_READ: ::c_int = 22;
673+
pub const MADV_POPULATE_WRITE: ::c_int = 23;
674+
pub const MADV_DONTNEED_LOCKED: ::c_int = 24;
675+
}
676+
}
666677

667678
pub const IFF_UP: ::c_int = 0x1;
668679
pub const IFF_BROADCAST: ::c_int = 0x2;

0 commit comments

Comments
 (0)