Skip to content

Commit

Permalink
Properly separate out fflags for different filters.
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3 committed Feb 8, 2010
1 parent fa547ae commit 2ad9b16
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion lib/rb-kqueue/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def watcher
#
# @return [Array<Symbol>]
def flags
@fflags ||= Native::Flags.from_mask("NOTE", @native[:fflags])
@fflags ||= Native::Flags.from_mask("NOTE_#{filter.to_s.upcase}", @native[:fflags])
end

# Returns whether the end-of-file flag has been set for this event.
Expand Down
26 changes: 13 additions & 13 deletions lib/rb-kqueue/native/flags.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,23 @@ module Flags


# For `EVFILT_{READ,WRITE}`
NOTE_LOWAT = 0x00000001 # Low water mark
NOTE_READ_LOWAT = NOTE_WRITE_LOWAT = 0x00000001 # Low water mark

# For `EVFILT_VNODE`
NOTE_DELETE = 0x00000001 # Vnode was removed
NOTE_WRITE = 0x00000002 # Data contents changed
NOTE_EXTEND = 0x00000004 # Size increased
NOTE_ATTRIB = 0x00000008 # Attributes changed
NOTE_LINK = 0x00000010 # Link count changed
NOTE_RENAME = 0x00000020 # Vnode was renamed
NOTE_REVOKE = 0x00000040 # Vnode access was revoked
NOTE_VNODE_DELETE = 0x00000001 # Vnode was removed
NOTE_VNODE_WRITE = 0x00000002 # Data contents changed
NOTE_VNODE_EXTEND = 0x00000004 # Size increased
NOTE_VNODE_ATTRIB = 0x00000008 # Attributes changed
NOTE_VNODE_LINK = 0x00000010 # Link count changed
NOTE_VNODE_RENAME = 0x00000020 # Vnode was renamed
NOTE_VNODE_REVOKE = 0x00000040 # Vnode access was revoked

# For `EVFILT_PROC`
NOTE_EXIT = 0x80000000 # Process exited
NOTE_FORK = 0x40000000 # Process forked
NOTE_EXEC = 0x20000000 # Process exec'd
NOTE_REAP = 0x10000000 # Process reaped
NOTE_SIGNAL = 0x08000000 # Received signal
NOTE_PROC_EXIT = 0x80000000 # Process exited
NOTE_PROC_FORK = 0x40000000 # Process forked
NOTE_PROC_EXEC = 0x20000000 # Process exec'd
NOTE_PROC_REAP = 0x10000000 # Process reaped
NOTE_PROC_SIGNAL = 0x08000000 # Received signal


# Converts a list of flags to the bitmask that the C API expects.
Expand Down
2 changes: 1 addition & 1 deletion lib/rb-kqueue/watcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def native(flags)
native[:ident] = @ident
native[:filter] = Native::Flags.to_flag("EVFILT", @filter)
native[:flags] = Native::Flags.to_mask("EV", @flags | flags)
native[:fflags] = Native::Flags.to_mask("NOTE", @fflags)
native[:fflags] = Native::Flags.to_mask("NOTE_#{@filter.to_s.upcase}", @fflags)
native[:data] = @data if @data
native
end
Expand Down

0 comments on commit 2ad9b16

Please sign in to comment.