module KQueue

The root module of the library, which is laid out as so:

Constants

VERSION

Public Class Methods

handle_error(errno = FFI.errno) click to toggle source

Raise an exception for a native kqueue error.

@param errno [Fixnum] The errno identifying the sort of error.

This is usually C's `errno` variable,
but is sometimes set in a kevent struct

@raise [SystemCallError] @private

# File lib/rb-kqueue.rb, line 25
def self.handle_error(errno = FFI.errno)
  raise SystemCallError.new(
    "KQueue failed" +
    case errno
    when Errno::EFAULT::Errno; ": There was an error reading or writing the kevent structure."
    when Errno::EBADF::Errno; ": The specified descriptor is invalid."
    when Errno::EINTR::Errno; ": A signal was delivered before the timeout expired and before any events were placed on the kqueue for return."
    when Errno::EINVAL::Errno; ": The specified time limit or filter is invalid."
    when Errno::ENOENT::Errno; ": The event could not be found to be modified or deleted."
    when Errno::ENOMEM::Errno; ": No memory was available to register the event."
    when Errno::ESRCH::Errno; ": The specified process to attach to does not exist."
    else; ""
    end,
    errno)
end