Module: SeccompTools::Const::Syscall
- Defined in:
- lib/seccomp-tools/const.rb
Overview
Define syscall numbers for all architectures. Since the list is too long, split it to files in consts/*.rb and load them in this module.
Class Method Summary collapse
-
.const_missing(cons) ⇒ Object
To dynamically fetch constants from files.
-
.load_args ⇒ Object
Helper for loading syscall prototypes from generated sys_arg.rb.
-
.load_const(cons) ⇒ Object
Load from file and define const value.
Class Method Details
.const_missing(cons) ⇒ Object
To dynamically fetch constants from files.
110 111 112 |
# File 'lib/seccomp-tools/const.rb', line 110 def const_missing(cons) load_const(cons) || super end |
.load_args ⇒ Object
Helper for loading syscall prototypes from generated sys_arg.rb.
127 128 129 130 131 132 133 134 135 |
# File 'lib/seccomp-tools/const.rb', line 127 def load_args hash = instance_eval(File.read(File.join(__dir__, 'consts', 'sys_arg.rb'))) Hash.new do |_h, k| next hash[k] if hash[k] next hash[k.to_s[4..].to_sym] if k.to_s.start_with?('x32_') nil end end |
.load_const(cons) ⇒ Object
Load from file and define const value.
118 119 120 121 122 123 124 |
# File 'lib/seccomp-tools/const.rb', line 118 def load_const(cons) arch = cons.to_s.downcase filename = File.join(__dir__, 'consts', 'sys_nr', "#{arch}.rb") return unless File.exist?(filename) const_set(cons, instance_eval(File.read(filename))) end |