Sha256: acf2cdda09366d03ef04f8df78dedd5f884a87213df079c6e5812098550afb14
Contents?: true
Size: 512 Bytes
Versions: 33
Compression:
Stored size: 512 Bytes
Contents
require 'ffi' require 'ffi/tools/const_generator' module Sysconf extend FFI::Library ffi_lib ["c"] fcg = FFI::ConstGenerator.new do |gen| gen.include 'unistd.h' %w[ _SC_PAGE_SIZE _SC_VERSION ].each do |const| ruby_name = const.sub(/^_SC_/, '').downcase.to_sym gen.const(const, "%d", nil, ruby_name, &:to_i) end end CONF = enum(*fcg.constants.map{|_, const| [const.ruby_name, const.converted_value] }.flatten) attach_function :sysconf, [CONF], :long end
Version data entries
33 entries across 33 versions & 2 rubygems