core/bpf-foreign: drop unnecessary check for cgroup v1

This commit is contained in:
Yu Watanabe
2025-04-16 03:56:04 +09:00
parent ff7f99db30
commit 3fcb98cbff
3 changed files with 2 additions and 21 deletions
-4
View File
@@ -4,10 +4,6 @@
#include "unit.h"
static inline int bpf_foreign_supported(void) {
return cg_all_unified();
}
/*
* Attach cgroup-bpf programs foreign to systemd, i.e. loaded to the kernel by an entity
* external to systemd.
+2 -6
View File
@@ -3542,12 +3542,8 @@ static int cg_bpf_mask_supported(CGroupMask *ret) {
if (r > 0)
mask |= CGROUP_MASK_BPF_DEVICES;
/* BPF pinned prog */
r = bpf_foreign_supported();
if (r < 0)
return r;
if (r > 0)
mask |= CGROUP_MASK_BPF_FOREIGN;
/* BPF pinned prog (always supported by cgroup v2) */
mask |= CGROUP_MASK_BPF_FOREIGN;
/* BPF-based bind{4|6} hooks */
r = bpf_socket_bind_supported();
-11
View File
@@ -714,17 +714,6 @@ static int bus_cgroup_set_transient_property(
return r;
unit_write_setting(u, flags, name, buf);
if (c->bpf_foreign_programs) {
r = bpf_foreign_supported();
if (r < 0)
return r;
if (r == 0)
log_full(LOG_DEBUG,
"Transient unit %s configures a BPF program pinned to BPF "
"filesystem, but the local system does not support that.\n"
"Starting this unit will fail!", u->id);
}
}
return 1;