Module: FFI::Platform
Relationships & Source Files | |
Defined in: | lib/ffi/platform.rb, ext/ffi_c/Platform.c |
Overview
This module defines different constants and class methods to play with various platforms.
Constant Summary
-
ARCH =
# File 'lib/ffi/platform.rb', line 65FFI.make_shareable(case CPU.downcase when /amd64|x86_64|x64/ "x86_64" when /i\d86|x86|i86pc/ "i386" when /ppc64|powerpc64/ "powerpc64" when /ppc|powerpc/ "powerpc" when /sparcv9|sparc64/ "sparcv9" when /arm64|aarch64/ # MacOS calls it "arm64", other operating systems "aarch64" "aarch64" when /^arm/ if OS == "darwin" # Ruby before 3.0 reports "arm" instead of "arm64" as host_cpu on darwin "aarch64" else "arm" end else RbConfig::CONFIG['host_cpu'] end)
-
BIG_ENDIAN =
# File 'ext/ffi_c/Platform.c', line 734321
-
BYTE_ORDER =
# File 'ext/ffi_c/Platform.c', line 71INT2FIX(BYTE_ORDER)
-
CONF_DIR =
# File 'lib/ffi/platform.rb', line 111FFI.make_shareable(File.join(File.dirname(__FILE__), 'platform', NAME))
-
CPU =
# File 'lib/ffi/platform.rb', line 63FFI.make_shareable(RbConfig::CONFIG['host_cpu'])
-
GNU_LIBC =
# File 'ext/ffi_c/Platform.c', line 75rb_str_new2(LIBC_SO)
-
IS_BSD =
# File 'lib/ffi/platform.rb', line 105IS_MAC || IS_FREEBSD || IS_NETBSD || IS_OPENBSD || IS_DRAGONFLYBSD
-
IS_DRAGONFLYBSD =
# File 'lib/ffi/platform.rb', line 102is_os("dragonfly")
-
IS_FREEBSD =
# File 'lib/ffi/platform.rb', line 99is_os("freebsd")
-
IS_GNU =
# File 'lib/ffi/platform.rb', line 96defined?(GNU_LIBC)
-
IS_LINUX =
# File 'lib/ffi/platform.rb', line 97is_os("linux")
-
IS_MAC =
# File 'lib/ffi/platform.rb', line 98is_os("darwin")
-
IS_NETBSD =
# File 'lib/ffi/platform.rb', line 100is_os("netbsd")
-
IS_OPENBSD =
# File 'lib/ffi/platform.rb', line 101is_os("openbsd")
-
IS_SOLARIS =
# File 'lib/ffi/platform.rb', line 103is_os("solaris")
-
IS_WINDOWS =
# File 'lib/ffi/platform.rb', line 104is_os("windows")
-
LIBC =
# File 'lib/ffi/platform.rb', line 136FFI.make_shareable(if IS_WINDOWS crtname = RbConfig::CONFIG["RUBY_SO_NAME"][/msvc\w+/] || 'ucrtbase' "#{crtname}.dll" elsif IS_GNU GNU_LIBC elsif OS == 'cygwin' "cygwin1.dll" elsif OS == 'msys' # Not sure how msys 1.0 behaves, tested on MSYS2. "msys-2.0.dll" else "#{LIBPREFIX}c.#{LIBSUFFIX}" end)
-
LIBPREFIX =
# File 'lib/ffi/platform.rb', line 115FFI.make_shareable(case OS when /windows|msys/ '' when /cygwin/ 'cyg' else 'lib' end)
-
LIBSUFFIX =
# File 'lib/ffi/platform.rb', line 124FFI.make_shareable(case OS when /darwin/ 'dylib' when /linux|bsd|solaris/ 'so' when /windows|cygwin|msys/ 'dll' else # Punt and just assume a sane unix (i.e. anything but AIX) 'so' end)
-
LITTLE_ENDIAN =
# File 'ext/ffi_c/Platform.c', line 721234
-
NAME =
64-bit inodes
FFI.make_shareable("#{ARCH}-#{OS}#{name_version}")
-
OS =
# File 'lib/ffi/platform.rb', line 40FFI.make_shareable(case RbConfig::CONFIG['host_os'].downcase when /linux/ "linux" when /darwin/ "darwin" when /freebsd/ "freebsd" when /netbsd/ "netbsd" when /openbsd/ "openbsd" when /dragonfly/ "dragonflybsd" when /sunos|solaris/ "solaris" when /mingw|mswin/ "windows" else RbConfig::CONFIG['host_os'].downcase end)
-
OSVERSION =
# File 'lib/ffi/platform.rb', line 61RbConfig::CONFIG['host_os'].gsub(/[^\d]/, '').to_i
Class Attribute Summary
-
.bsd? ⇒ Boolean
readonly
Test if current OS is a *BSD (include MAC).
-
.mac? ⇒ Boolean
readonly
Test if current OS is Mac OS.
- .solaris? ⇒ Boolean readonly
- .unix? ⇒ Boolean readonly
-
.windows? ⇒ Boolean
readonly
Test if current OS is Windows.
Class Method Summary
-
.is_os(os) ⇒ Boolean
private
Test if current OS is
os
.
Class Attribute Details
.bsd? ⇒ Boolean
(readonly)
Test if current OS is a *BSD (include MAC)
# File 'lib/ffi/platform.rb', line 158
def self.bsd? IS_BSD end
.mac? ⇒ Boolean
(readonly)
Test if current OS is Mac OS
# File 'lib/ffi/platform.rb', line 170
def self.mac? IS_MAC end
.solaris? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'lib/ffi/platform.rb', line 176
def self.solaris? IS_SOLARIS end
.unix? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'lib/ffi/platform.rb', line 182
def self.unix? !IS_WINDOWS end
.windows? ⇒ Boolean
(readonly)
Test if current OS is Windows
# File 'lib/ffi/platform.rb', line 164
def self.windows? IS_WINDOWS end
Class Method Details
.is_os(os) ⇒ Boolean
(private)
Test if current OS is os
.
# File 'lib/ffi/platform.rb', line 92
def self.is_os(os) OS == os end