unix: add SetMemPolicy and its mode/flag values

This reuses CPUSet type as it fits perfectly.

No GetMemPolicy support yet.

Change-Id: I549361bc1ed95ee73fd38d00277ec0f9f348a9ba
Reviewed-on: https://go-review.googlesource.com/c/sys/+/706917
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Antti Kervinen <antti.kervinen@gmail.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
This commit is contained in:
Kir Kolyshkin
2025-10-08 14:29:03 -07:00
committed by Gopher Robot
parent b731f782ac
commit 28c5bda5d4
4 changed files with 75 additions and 0 deletions
+32
View File
@@ -135,6 +135,7 @@ struct termios2 {
#include <linux/landlock.h>
#include <linux/loop.h>
#include <linux/lwtunnel.h>
#include <linux/mempolicy.h>
#include <linux/mpls_iptunnel.h>
#include <linux/ncsi.h>
#include <linux/net_namespace.h>
@@ -6250,3 +6251,34 @@ type SockDiagReq C.struct_sock_diag_req
// Removed in Linux 6.13, kept for backwards compatibility.
const RTM_NEWNVLAN = 0x70
// Memory policy modes and flags for [SetMemPolicy], as defined in /usr/include/linux/mempolicy.h.
// Not all can be used, see set_mempolicy(2).
// Generated by:
// $ { perl -nlE '/^#define (MPOL_\w+)/ && say "\t$1 = C.$1"' /usr/include/linux/mempolicy.h; perl -nlE '/^\s*(MPOL_\w+)/ && say "\t$1 = C.$1"' /usr/include/linux/mempolicy.h; } | sort | uniq
const (
MPOL_BIND = C.MPOL_BIND
MPOL_DEFAULT = C.MPOL_DEFAULT
MPOL_F_ADDR = C.MPOL_F_ADDR
MPOL_F_MEMS_ALLOWED = C.MPOL_F_MEMS_ALLOWED
MPOL_F_MOF = C.MPOL_F_MOF
MPOL_F_MORON = C.MPOL_F_MORON
MPOL_F_NODE = C.MPOL_F_NODE
MPOL_F_NUMA_BALANCING = C.MPOL_F_NUMA_BALANCING
MPOL_F_RELATIVE_NODES = C.MPOL_F_RELATIVE_NODES
MPOL_F_SHARED = C.MPOL_F_SHARED
MPOL_F_STATIC_NODES = C.MPOL_F_STATIC_NODES
MPOL_INTERLEAVE = C.MPOL_INTERLEAVE
MPOL_LOCAL = C.MPOL_LOCAL
MPOL_MAX = C.MPOL_MAX
MPOL_MF_INTERNAL = C.MPOL_MF_INTERNAL
MPOL_MF_LAZY = C.MPOL_MF_LAZY
MPOL_MF_MOVE_ALL = C.MPOL_MF_MOVE_ALL
MPOL_MF_MOVE = C.MPOL_MF_MOVE
MPOL_MF_STRICT = C.MPOL_MF_STRICT
MPOL_MF_VALID = C.MPOL_MF_VALID
MPOL_MODE_FLAGS = C.MPOL_MODE_FLAGS
MPOL_PREFERRED = C.MPOL_PREFERRED
MPOL_PREFERRED_MANY = C.MPOL_PREFERRED_MANY
MPOL_WEIGHTED_INTERLEAVE = C.MPOL_WEIGHTED_INTERLEAVE
)