2
0
mirror of git://github.com/lxc/lxc synced 2025-08-31 01:29:33 +00:00

Merge pull request #3909 from petris/bpf_enosys_warn

bpf: simplify detection if BPF is supported
This commit is contained in:
Christian Brauner
2021-07-21 15:25:36 +02:00
committed by GitHub

View File

@@ -538,6 +538,10 @@ bool bpf_devices_cgroup_supported(void)
return log_trace(false,
"The bpf device cgroup requires real root");
ret = bpf(BPF_PROG_LOAD, NULL, sizeof(union bpf_attr));
if (ret < 0 && errno == ENOSYS)
return log_trace(false, "The bpf syscall is not available");
prog = bpf_program_new(BPF_PROG_TYPE_CGROUP_DEVICE);
if (!prog)
return log_trace(false, "Failed to allocate new bpf device cgroup program");