]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
bpf-util: merge two dlopen_bpf() declaration
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 6 Jul 2026 23:02:01 +0000 (08:02 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 10 Jul 2026 07:29:54 +0000 (16:29 +0900)
No functional change. Just for consistency with other dlopen_libfoo().

src/shared/bpf-util.c

index 92fc05f8fc8d5488dd920aed57523814c3c0340b..6cd4069580a1f3a1c79252a4adef524ba4550cff 100644 (file)
@@ -76,7 +76,10 @@ static int bpf_print_func(enum libbpf_print_level level, const char *fmt, va_lis
         return log_internalv(LOG_DEBUG, errno, NULL, 0, NULL, fmt, ap);
 }
 
+#endif
+
 int dlopen_bpf(int log_level) {
+#if HAVE_LIBBPF
         static void *bpf_dl = NULL;
         static int cached = 0;
         int r = -ENOENT;
@@ -153,8 +156,13 @@ int dlopen_bpf(int log_level) {
         (void) sym_libbpf_set_print(bpf_print_func);
 
         return 1;
+#else
+        return log_once_errno(log_level, SYNTHETIC_ERRNO(EOPNOTSUPP),
+                              "libbpf support is not compiled in, cgroup BPF features disabled.");
+#endif
 }
 
+#if HAVE_LIBBPF
 int bpf_get_error_translated(const void *ptr) {
         int r;
 
@@ -171,11 +179,4 @@ int bpf_get_error_translated(const void *ptr) {
                 return r;
         }
 }
-
-#else
-
-int dlopen_bpf(int log_level) {
-        return log_once_errno(log_level, SYNTHETIC_ERRNO(EOPNOTSUPP),
-                              "libbpf support is not compiled in, cgroup BPF features disabled.");
-}
 #endif