10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'ext/iou/extconf.rb', line 10
def get_config
config = { linux: !!(RUBY_PLATFORM =~ /linux/) }
raise "IOU only works on Linux!" if !config[:linux]
kernel_info = `uname -sr`
m = kernel_info.match(KERNEL_INFO_RE)
raise "Could not parse Linux kernel information (#{kernel_info.inspect})" if !m
version, major_revision, distribution = m[1].to_i, m[2].to_i, m[4]
combined_version = version.to_i * 100 + major_revision.to_i
raise "IOU requires kernel version 6.4 or newer!" if combined_version < 604
config[:kernel_version] = combined_version
config[:pidfd_open] = combined_version > 503
config[:multishot_accept] = combined_version >= 519
config[:multishot_recv] = combined_version >= 600
config[:multishot_recvmsg] = combined_version >= 600
config[:multishot_timeout] = combined_version >= 604
config[:submit_all_flag] = combined_version >= 518
config[:coop_taskrun_flag] = combined_version >= 519
config[:single_issuer_flag] = combined_version >= 600
config
end
|