commit 125469acbb4d8731925172fe3465f03c0eb21911
parent 97846e446726de8d9d2ac77ca838d9e855d7ce63
Author: Eyal Sawady <ecs@d2evs.net>
Date: Wed, 1 Sep 2021 22:20:52 +0000
rt: add mlock et al
Signed-off-by: Eyal Sawady <ecs@d2evs.net>
Diffstat:
2 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/rt/+linux/syscalls.ha b/rt/+linux/syscalls.ha
@@ -643,3 +643,21 @@ export fn io_uring_enter(
fd: u64, to_submit: u64, min_complete: u64,
flags: u64, sig: uintptr: u64))?: uint;
};
+
+export fn mlock2(addr: *void, length: size, flags: uint) (void | errno) = {
+ return wrap_return(syscall3(SYS_mlock2, addr: uintptr: u64,
+ length: u64, flags: u64))?: void;
+};
+
+export fn munlock(addr: *void, length: size) (void | errno) = {
+ return wrap_return(syscall2(SYS_munlock, addr: uintptr: u64,
+ length: u64))?: void;
+};
+
+export fn mlockall(flags: int) (void | errno) = {
+ return wrap_return(syscall1(SYS_mlockall, flags: u64))?: void;
+};
+
+export fn munlockall() (void | errno) = {
+ return wrap_return(syscall0(SYS_munlockall))?: void;
+};
diff --git a/rt/+linux/types.ha b/rt/+linux/types.ha
@@ -573,3 +573,9 @@ export type winsize = struct {
};
export def TIOCGWINSZ: u64 = 0x5413;
+
+export def MLOCK_ONFAULT: uint = 0x01;
+
+export def MCL_CURRENT: int = 1;
+export def MCL_FUTURE: int = 2;
+export def MCL_ONFAULT: int = 4;