<commit_before>require 'ffi'

module KQueue
  # This module contains the low-level foreign-function interface code
  # for dealing with the kqueue C APIs.
  # It's an implementation detail, and not meant for users to deal with.
  #
  # @private
  module Native
    extend FFI::Library

    # The C struct describing a kqueue event.
    #
    # @private
    class KEvent < FFI::Struct
      layout(
        :ident,  :uintptr_t,
        :filter, :int16,
        :flags,  :uint16,
        :fflags, :uint32,
        :data,   :intptr_t,
        :udata,  :pointer)
    end

    # The C struct describing a timeout.
    #
    # @private
    class TimeSpec < FFI::Struct
      layout(
        :tv_sec, :time_t,
        :tv_nsec, :long)
    end

    attach_function :kqueue, [], :int
    attach_function :kevent, [:int, :pointer, :int, :pointer, :int, :pointer], :int

    attach_function :open, [:string, :int], :int
    attach_function :close, [:int], :int
  end
end
<commit_msg>Instruct FFI to use libc<commit_after>require 'ffi'

module KQueue
  # This module contains the low-level foreign-function interface code
  # for dealing with the kqueue C APIs.
  # It's an implementation detail, and not meant for users to deal with.
  #
  # @private
  module Native
    extend FFI::Library

    # The C struct describing a kqueue event.
    #
    # @private
    class KEvent < FFI::Struct
      layout(
        :ident,  :uintptr_t,
        :filter, :int16,
        :flags,  :uint16,
        :fflags, :uint32,
        :data,   :intptr_t,
        :udata,  :pointer)
    end

    # The C struct describing a timeout.
    #
    # @private
    class TimeSpec < FFI::Struct
      layout(
        :tv_sec, :time_t,
        :tv_nsec, :long)
    end

    ffi_lib FFI::Library::LIBC

    attach_function :kqueue, [], :int
    attach_function :kevent, [:int, :pointer, :int, :pointer, :int, :pointer], :int

    attach_function :open, [:string, :int], :int
    attach_function :close, [:int], :int
  end
end

{'fraction_non_alphanumeric': 0.11071967790639155, 'fraction_numerical': 0.006039255158530448, 'mean_word_length': 2.4755244755244754, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4002701', 'n_tokens_mistral': 680, 'n_tokens_neox': 659, 'n_words': 206}