Fix the build problem with bpf project
Add the necessary Android.bp file and fix the compile error for the new
bpf project.
Fix the run time restart false alarm in bpf loader.
Bug: 112334572
Test: device boot and dumpsys netd show eBPF object okay, runtime
restart netd and no bpfloader error showed in logcat.
Change-Id: Iae193bda45e50b7d22479086d6403e3c4fb185c4
diff --git a/libbpf/BpfUtils.cpp b/libbpf/BpfUtils.cpp
index 955f2ec..cec8911 100644
--- a/libbpf/BpfUtils.cpp
+++ b/libbpf/BpfUtils.cpp
@@ -381,7 +381,7 @@
int parseProgramsFromFile(const char* path, BpfProgInfo* programs, size_t size,
const std::vector<BpfMapInfo>& mapPatterns) {
- unique_fd fd(open(path, O_RDONLY));
+ unique_fd fd(open(path, O_RDONLY | O_CLOEXEC));
int ret;
if (fd < 0) {
ret = -errno;