Skip to content

Commit dec033d

Browse files
committed
Add mlock2 on Android and Linux.
1 parent c781f0b commit dec033d

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/unix/linux_like/android/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2327,6 +2327,9 @@ pub const ALG_SET_AEAD_AUTHSIZE: ::c_int = 5;
23272327
pub const ALG_OP_DECRYPT: ::c_int = 0;
23282328
pub const ALG_OP_ENCRYPT: ::c_int = 1;
23292329

2330+
// sys/mman.h
2331+
pub const MLOCK_ONFAULT: ::c_int = 0x01;
2332+
23302333
// uapi/linux/vm_sockets.h
23312334
pub const VMADDR_CID_ANY: ::c_uint = 0xFFFFFFFF;
23322335
pub const VMADDR_CID_HYPERVISOR: ::c_uint = 0;
@@ -2581,6 +2584,7 @@ extern "C" {
25812584
pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int;
25822585

25832586
pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::timezone) -> ::c_int;
2587+
pub fn mlock2(addr: *const ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int;
25842588
pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int;
25852589
pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
25862590
pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int;

src/unix/linux_like/linux/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2583,6 +2583,7 @@ pub const MAP_SHARED_VALIDATE: ::c_int = 0x3;
25832583

25842584
// include/uapi/asm-generic/mman-common.h
25852585
pub const MAP_FIXED_NOREPLACE: ::c_int = 0x100000;
2586+
pub const MLOCK_ONFAULT: ::c_uint = 0x01;
25862587

25872588
// uapi/linux/vm_sockets.h
25882589
pub const VMADDR_CID_ANY: ::c_uint = 0xFFFFFFFF;
@@ -3533,6 +3534,7 @@ extern "C" {
35333534
pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long);
35343535

35353536
pub fn telldir(dirp: *mut ::DIR) -> ::c_long;
3537+
pub fn mlock2(addr: *const ::c_void, len: ::size_t, flags: ::c_uint) -> ::c_int;
35363538
pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int;
35373539

35383540
pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int;

0 commit comments

Comments
 (0)