summaryrefslogtreecommitdiffstats
path: root/tools/lib/bpf/libbpf.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@kernel.org>2024-03-21 17:01:58 +0100
committerAndrii Nakryiko <andrii@kernel.org>2024-03-21 19:27:17 +0100
commitddb2ffdc474a3000887dc776b971d04bde29decc (patch)
treeb19420fdd37dc8a46668e115ed24ee50310c000d /tools/lib/bpf/libbpf.c
parentarm64: bpf: fix 32bit unconditional bswap (diff)
downloadlinux-ddb2ffdc474a3000887dc776b971d04bde29decc.tar.xz
linux-ddb2ffdc474a3000887dc776b971d04bde29decc.zip
libbpf: Define MFD_CLOEXEC if not available
Since its going directly to the syscall to avoid not having memfd_create() available in some systems, do the same for its MFD_CLOEXEC flags, defining it if not available. This fixes the build in those systems, noticed while building perf on a set of build containers. Fixes: 9fa5e1a180aa639f ("libbpf: Call memfd_create() syscall directly") Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/ZfxZ9nCyKvwmpKkE@x1
Diffstat (limited to 'tools/lib/bpf/libbpf.c')
-rw-r--r--tools/lib/bpf/libbpf.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 1e3e697b98bc..a2061fcd612d 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -1650,6 +1650,10 @@ static int sys_memfd_create(const char *name, unsigned flags)
return syscall(__NR_memfd_create, name, flags);
}
+#ifndef MFD_CLOEXEC
+#define MFD_CLOEXEC 0x0001U
+#endif
+
static int create_placeholder_fd(void)
{
int fd;