Class: Seccomp::Arg::Reference

Inherits:
Object
  • Object
show all
Defined in:
lib/seccomp/arg.rb

Overview

Builder bound to one syscall argument index.

Instance Method Summary collapse

Constructor Details

#initialize(index) ⇒ void

Examples:

Reference.new(0)

Parameters:

  • index (Integer)

    argument index from 0 through 5

Raises:

  • (ArgumentError)

    outside 0..5



68
69
70
71
72
73
74
# File 'lib/seccomp/arg.rb', line 68

def initialize(index)
  unless index.is_a?(Integer) && (0..5).cover?(index)
    raise ArgumentError, "arg must be an Integer between 0 and 5"
  end

  @index = index
end

Instance Method Details

#masked_eq(mask:, value:, width: 64) ⇒ ArgCmp

Build a masked equality comparison.

Examples:

reference.masked_eq(mask: 0xff, value: 1)

Parameters:

  • mask (Integer)

    bit mask

  • value (Integer)

    expected masked value

  • width (Integer) (defaults to: 64)

    32 or 64

Returns:

Raises:

  • (ArgumentError)

    for invalid data



91
92
93
# File 'lib/seccomp/arg.rb', line 91

def masked_eq(mask:, value:, width: 64)
  ArgCmp.new(arg: @index, op: :masked_eq, datum_a: mask, datum_b: value, width: width)
end