bpfloader: more 4.9-T support
(older kernels don't support naming maps/programs) Test: TreeHugger Signed-off-by: Maciej Żenczykowski <maze@google.com> Change-Id: If59b8947021394e1ce0a91326fee4272a5bddd38
This commit is contained in:
parent
d18d86dfe9
commit
3fee9f5367
1 changed files with 4 additions and 2 deletions
|
@ -631,6 +631,7 @@ static int createMaps(const char* elfPath, ifstream& elfFile, vector<unique_fd>&
|
||||||
.max_entries = max_entries,
|
.max_entries = max_entries,
|
||||||
.map_flags = md[i].map_flags,
|
.map_flags = md[i].map_flags,
|
||||||
};
|
};
|
||||||
|
if (isAtLeastKernelVersion(4, 14, 0))
|
||||||
strlcpy(req.map_name, mapNames[i].c_str(), sizeof(req.map_name));
|
strlcpy(req.map_name, mapNames[i].c_str(), sizeof(req.map_name));
|
||||||
fd.reset(bpf(BPF_MAP_CREATE, req));
|
fd.reset(bpf(BPF_MAP_CREATE, req));
|
||||||
saved_errno = errno;
|
saved_errno = errno;
|
||||||
|
@ -791,6 +792,7 @@ static int loadCodeSections(const char* elfPath, vector<codeSection>& cs, const
|
||||||
.log_size = static_cast<__u32>(log_buf.size()),
|
.log_size = static_cast<__u32>(log_buf.size()),
|
||||||
.expected_attach_type = cs[i].expected_attach_type,
|
.expected_attach_type = cs[i].expected_attach_type,
|
||||||
};
|
};
|
||||||
|
if (isAtLeastKernelVersion(4, 14, 0))
|
||||||
strlcpy(req.prog_name, cs[i].name.c_str(), sizeof(req.prog_name));
|
strlcpy(req.prog_name, cs[i].name.c_str(), sizeof(req.prog_name));
|
||||||
fd.reset(bpf(BPF_PROG_LOAD, req));
|
fd.reset(bpf(BPF_PROG_LOAD, req));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue