Module: SeccompTools::Const::Endian

Defined in:
lib/seccomp-tools/const.rb

Overview

Endianness constants.

Constant Summary collapse

AUDIT_ARCH_LE =

__AUDIT_ARCH_LE from uapi/linux/audit.h: the bit an AUDIT_ARCH_* value carries iff the architecture is little-endian. The kernel encodes endianness in the arch token itself, so it never needs to be guessed from an architecture's name.

0x40000000
ENDIAN =

Endianness of each architecture as a pack/unpack format modifier, derived from the Audit::ARCH values instead of being maintained by hand.

Audit::ARCH_NAME.transform_values do |name|
  Audit::ARCH[name].anybits?(AUDIT_ARCH_LE) ? '<' : '>'
end.freeze

Class Method Summary collapse

Class Method Details

.big?(arch) ⇒ Boolean

Whether arch is big-endian, i.e. stores the high 32-bit word of a 64-bit seccomp_data field (+instruction_pointer+ or an argument) first. See arch_arg_offset_lo/hi in libseccomp and the syscall_arg macro of the kernel's seccomp selftests.

Parameters:

  • arch (Symbol)

Returns:

  • (Boolean)


249
250
251
# File 'lib/seccomp-tools/const.rb', line 249

def self.big?(arch)
  ENDIAN[arch] == '>'
end