1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
3 #include "bpf-dlopen.h"
5 #include "cgroup-util.h"
6 #include "initrd-util.h"
9 bool cgroup_bpf_supported(void) {
10 static int supported
= -1;
16 r
= cg_unified_controller(SYSTEMD_CGROUP_CONTROLLER
);
18 log_warning_errno(r
, "Can't determine whether the unified hierarchy is used: %m");
19 return (supported
= false);
23 log_info_errno(SYNTHETIC_ERRNO(EOPNOTSUPP
),
24 "Not running with unified cgroup hierarchy, disabling cgroup BPF features.");
25 return (supported
= false);
30 log_full_errno(in_initrd() ? LOG_DEBUG
: LOG_INFO
,
31 r
, "Failed to open libbpf, cgroup BPF features disabled: %m");
32 return (supported
= false);
35 return (supported
= true);