module KQueue::Native::Flags
A module containing all the C-level integer flags that are used with kqueue.
@private
Constants
- EVFILT_AIO
- EVFILT_FS
- EVFILT_LIO
- EVFILT_MACHPORT
- EVFILT_PROC
- EVFILT_PROCDESC
- EVFILT_READ
- EVFILT_SENDFILE
- EVFILT_SESSION
- EVFILT_SIGNAL
- EVFILT_SYSCOUNT
- EVFILT_TIMER
- EVFILT_USER
- EVFILT_VNODE
- EVFILT_WRITE
- EV_ADD
Actions
- EV_CLEAR
- EV_DELETE
- EV_DISABLE
- EV_DISPATCH
- EV_ENABLE
- EV_EOF
Returned values
- EV_ERROR
- EV_ONESHOT
- EV_RECEIPT
- NOTE_PROC_CHILD
- NOTE_PROC_EXEC
- NOTE_PROC_EXIT
For ‘EVFILT_PROC`
- NOTE_PROC_FORK
- NOTE_PROC_REAP
- NOTE_PROC_SIGNAL
- NOTE_PROC_TRACK
- NOTE_PROC_TRACKERR
- NOTE_READ_LOWAT
For ‘EVFILT_{READ,WRITE}`
- NOTE_TIMER_ABSOLUTE
- NOTE_TIMER_NSECONDS
- NOTE_TIMER_SECONDS
For ‘EVFILT_TIMER`
- NOTE_TIMER_USECONDS
- NOTE_VNODE_ATTRIB
- NOTE_VNODE_DELETE
For ‘EVFILT_VNODE`
- NOTE_VNODE_EXTEND
- NOTE_VNODE_LINK
- NOTE_VNODE_RENAME
- NOTE_VNODE_REVOKE
- NOTE_VNODE_WRITE
Public Class Methods
Converts an integer from the C API into a flag.
@param prefix [String] The prefix for the C names of the flags @param flag [Fixnum] @return [Symbol]
# File lib/rb-kqueue/native/flags.rb, line 142 def self.from_flag(prefix, flag) re = /^#{Regexp.quote prefix}_/ constants.each do |sym| c = sym.to_s next unless c =~ re return c.to_s.sub("#{prefix}_", "").downcase.to_sym if const_get(c) == flag end raise FlagNotFound end
Converts a bitmask from the C API into a list of flags.
@param prefix [String] The prefix for the C names of the flags @param mask [Fixnum] @return [Array<Symbol>]
# File lib/rb-kqueue/native/flags.rb, line 119 def self.from_mask(prefix, mask) re = /^#{Regexp.quote prefix}_/ constants.select do |sym| c = sym.to_s next false unless c =~ re const_get(c) & mask != 0 end.map {|c| c.to_s.sub("#{prefix}_", "").downcase.to_sym} end
Converts a flag to the integer that the C API expects.
@param prefix [String] The prefix for the C names of the flags @param flag [Symbol] @return [Fixnum]
# File lib/rb-kqueue/native/flags.rb, line 133 def self.to_flag(prefix, flag) const_get("#{prefix}_#{flag.to_s.upcase}") end
Converts a list of flags to the bitmask that the C API expects.
@param prefix [String] The prefix for the C names of the flags @param flags [Array<Symbol>] @return [Fixnum]
# File lib/rb-kqueue/native/flags.rb, line 109 def self.to_mask(prefix, flags) flags.map {|flag| const_get("#{prefix}_#{flag.to_s.upcase}")}. inject(0) {|mask, flag| mask | flag} end