Top Level Namespace

Defined Under Namespace

Classes: Fiber, Thread, UringMachine

Constant Summary collapse

UM =
UringMachine
KERNEL_INFO_RE =
/Linux (\d)\.(\d+)(?:\.)?((?:\d+\.?)*)(?:\-)?([\w\-]+)?/

Instance Method Summary collapse

Instance Method Details

#get_configObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'ext/um/extconf.rb', line 10

def get_config
  if RUBY_PLATFORM !~ /linux/
    raise "UringMachine only works on Linux!"
  end

  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 "UringMachine requires kernel version 6.7 or newer!" if combined_version < 607

  {
    kernel_version:       combined_version,
    prep_bind:            combined_version >= 611,
    prep_listen:          combined_version >= 611,
    send_vectoized:       combined_version >= 617
  }
end