From 3725d5349967f9caffe57cb7a3deab869a0d654e Mon Sep 17 00:00:00 2001 From: Michal Biesek Date: Fri, 11 Aug 2023 23:02:25 +0200 Subject: [PATCH] Add `MADV_SOFT_OFFLINE` definition from linux v2.6.33 see linux commit afcf938ee0aac4ef95b1a23bac704c6fbeb26de6 HWPOISON: Add a madvise() injector for soft page offlining --- libc/sysv/consts.sh | 1 + libc/sysv/consts/MADV_SOFT_OFFLINE.S | 2 ++ libc/sysv/consts/madv.h | 1 + 3 files changed, 4 insertions(+) create mode 100644 libc/sysv/consts/MADV_SOFT_OFFLINE.S diff --git a/libc/sysv/consts.sh b/libc/sysv/consts.sh index 6b7df79cd..f0af04e88 100755 --- a/libc/sysv/consts.sh +++ b/libc/sysv/consts.sh @@ -269,6 +269,7 @@ syscon madv MADV_DOFORK 11 11 127 127 127 127 127 127 # TODO( 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? syscon madv MADV_HWPOISON 100 100 127 127 127 127 127 127 # TODO(jart): what is it? +syscon madv MADV_SOFT_OFFLINE 101 101 127 127 127 127 127 127 # TODO: add support ? syscon madv MADV_REMOVE 9 9 127 127 127 127 127 127 # TODO(jart): what is it? syscon fadv POSIX_FADV_NOREUSE 5 5 127 127 5 127 5 127 # wut diff --git a/libc/sysv/consts/MADV_SOFT_OFFLINE.S b/libc/sysv/consts/MADV_SOFT_OFFLINE.S new file mode 100644 index 000000000..a377bacbc --- /dev/null +++ b/libc/sysv/consts/MADV_SOFT_OFFLINE.S @@ -0,0 +1,2 @@ +#include "libc/sysv/consts/syscon.internal.h" +.syscon madv,MADV_SOFT_OFFLINE,101,101,127,127,127,127,127,127 diff --git a/libc/sysv/consts/madv.h b/libc/sysv/consts/madv.h index 85aa5b1e9..189ae1a80 100644 --- a/libc/sysv/consts/madv.h +++ b/libc/sysv/consts/madv.h @@ -19,6 +19,7 @@ extern const unsigned MADV_REMOVE; extern const unsigned MADV_SEQUENTIAL; extern const unsigned MADV_UNMERGEABLE; extern const unsigned MADV_WILLNEED; +extern const unsigned MADV_SOFT_OFFLINE; #define MADV_NORMAL 0 #define MADV_RANDOM 1