Skip to content

Commit ddb2ffd

Browse files
acmelanakryiko
authored andcommitted
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: 9fa5e1a ("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
1 parent a51cd6b commit ddb2ffd

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

tools/lib/bpf/libbpf.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1650,6 +1650,10 @@ static int sys_memfd_create(const char *name, unsigned flags)
16501650
return syscall(__NR_memfd_create, name, flags);
16511651
}
16521652

1653+
#ifndef MFD_CLOEXEC
1654+
#define MFD_CLOEXEC 0x0001U
1655+
#endif
1656+
16531657
static int create_placeholder_fd(void)
16541658
{
16551659
int fd;

0 commit comments

Comments
 (0)