Skip to content

Commit

Permalink
Merge pull request snabbco#192 from vavrusa/master
Browse files Browse the repository at this point in the history
linux/bpf_prog_load: support custom kernel builds
  • Loading branch information
justincormack committed May 22, 2016
2 parents 9981190 + 0da437f commit 21f3fd8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions syscall/linux/syscalls.lua
Original file line number Diff line number Diff line change
Expand Up @@ -787,9 +787,9 @@ if C.bpf then
if not version then
-- We have no better way to extract current kernel hex-string other
-- than parsing headers, compiling a helper function or reading /proc
local ver_str, count = S.sysctl('kernel.version'):match('%d.%d.%d'), 2
local ver_str, count = S.sysctl('kernel.osrelease'):match('%d+.%d+.%d+'), 2
version = 0
for i in ver_str:gmatch('%d') do -- Convert 'X.Y.Z' to 0xXXYYZZ
for i in ver_str:gmatch('%d+') do -- Convert 'X.Y.Z' to 0xXXYYZZ
version = bit.bor(version, bit.lshift(tonumber(i), 8*count))
count = count - 1
end
Expand Down

0 comments on commit 21f3fd8

Please sign in to comment.