NetBpfLoad: don't call bpfGetFdMapId in kernels < 4.14
The function is not available in older kernels. But when we do call it, fail on error - should not happen. Test: TreeHugger Signed-off-by: Maciej Żenczykowski <maze@google.com> Change-Id: I2695bf01762abcbc087a3bd67f1718e0e326576a
This commit is contained in:
parent
000f20ddcc
commit
a003ace532
1 changed files with 7 additions and 5 deletions
|
|
@ -859,11 +859,13 @@ static int createMaps(const char* elfPath, ifstream& elfFile, vector<unique_fd>&
|
|||
}
|
||||
}
|
||||
|
||||
int mapId = bpfGetFdMapId(fd);
|
||||
if (mapId == -1) {
|
||||
if (isAtLeastKernelVersion(4, 14, 0))
|
||||
ALOGE("bpfGetFdMapId failed, ret: %d [%d]", mapId, errno);
|
||||
} else {
|
||||
if (isAtLeastKernelVersion(4, 14, 0)) {
|
||||
int mapId = bpfGetFdMapId(fd);
|
||||
if (mapId == -1) {
|
||||
const int err = errno;
|
||||
ALOGE("bpfGetFdMapId failed, errno: %d", err);
|
||||
return -err;
|
||||
}
|
||||
ALOGI("map %s id %d", mapPinLoc.c_str(), mapId);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue