From ac2d192e0df96a2be705b846e1d35da967776933 Mon Sep 17 00:00:00 2001 From: Michal Biesek Date: Fri, 11 Aug 2023 23:31:53 +0200 Subject: [PATCH] Add `MADV_POPULATE_WRITE` definition from linux v5.14 see linux commit 4ca9b3859dac14bbef0c27d00667bb5b10917adb mm/madvise: introduce MADV_POPULATE_(READ|WRITE) to prefault page tables --- libc/sysv/consts.sh | 1 + libc/sysv/consts/MADV_POPULATE_WRITE.S | 2 ++ libc/sysv/consts/madv.h | 1 + 3 files changed, 4 insertions(+) create mode 100644 libc/sysv/consts/MADV_POPULATE_WRITE.S diff --git a/libc/sysv/consts.sh b/libc/sysv/consts.sh index d8b346226..038619359 100755 --- a/libc/sysv/consts.sh +++ b/libc/sysv/consts.sh @@ -270,6 +270,7 @@ syscon madv MADV_KEEPONFORK 19 19 127 127 127 127 127 127 # T syscon madv MADV_COLD 20 20 127 127 127 127 127 127 # TODO: add support ? syscon madv MADV_PAGEOUT 21 21 127 127 127 127 127 127 # TODO: add support ? syscon madv MADV_POPULATE_READ 22 22 127 127 127 127 127 127 # TODO: add support ? +syscon madv MADV_POPULATE_WRITE 23 23 127 127 127 127 127 127 # TODO: add support ? syscon madv MADV_DOFORK 11 11 127 127 127 127 127 127 # TODO(jart): what is it? syscon madv MADV_DONTDUMP 16 16 127 127 127 127 127 127 # see MAP_CONCEAL in OpenBSD; TODO(jart): what is it? syscon madv MADV_DONTFORK 10 10 127 127 127 127 127 127 # TODO(jart): what is it? diff --git a/libc/sysv/consts/MADV_POPULATE_WRITE.S b/libc/sysv/consts/MADV_POPULATE_WRITE.S new file mode 100644 index 000000000..2b0992039 --- /dev/null +++ b/libc/sysv/consts/MADV_POPULATE_WRITE.S @@ -0,0 +1,2 @@ +#include "libc/sysv/consts/syscon.internal.h" +.syscon madv,MADV_POPULATE_WRITE,23,23,127,127,127,127,127,127 diff --git a/libc/sysv/consts/madv.h b/libc/sysv/consts/madv.h index b70fc831b..5b00895c1 100644 --- a/libc/sysv/consts/madv.h +++ b/libc/sysv/consts/madv.h @@ -25,6 +25,7 @@ extern const unsigned MADV_KEEPONFORK; extern const unsigned MADV_COLD; extern const unsigned MADV_PAGEOUT; extern const unsigned MADV_POPULATE_READ; +extern const unsigned MADV_POPULATE_WRITE; #define MADV_NORMAL 0 #define MADV_RANDOM 1