github.com/mattolenik/notify@v0.9.1/event_kqueue.go (about)

     1  // Copyright (c) 2014-2015 The Notify Authors. All rights reserved.
     2  // Use of this source code is governed by the MIT license that can be
     3  // found in the LICENSE file.
     4  
     5  // +build darwin,kqueue dragonfly freebsd netbsd openbsd
     6  
     7  package notify
     8  
     9  import "syscall"
    10  
    11  // TODO(pblaszczyk): ensure in runtime notify built-in event values do not
    12  // overlap with platform-defined ones.
    13  
    14  // Platform independent event values.
    15  const (
    16  	osSpecificCreate Event = 0x0100 << iota
    17  	osSpecificRemove
    18  	osSpecificWrite
    19  	osSpecificRename
    20  	// internal
    21  	// recursive is used to distinguish recursive eventsets from non-recursive ones
    22  	recursive
    23  	// omit is used for dispatching internal events; only those events are sent
    24  	// for which both the event and the watchpoint has omit in theirs event sets.
    25  	omit
    26  )
    27  
    28  const (
    29  	// NoteDelete is an event reported when the unlink() system call was called
    30  	// on the file referenced by the descriptor.
    31  	NoteDelete = Event(syscall.NOTE_DELETE)
    32  	// NoteWrite is an event reported when a write occurred on the file
    33  	// referenced by the descriptor.
    34  	NoteWrite = Event(syscall.NOTE_WRITE)
    35  	// NoteExtend is an event reported when the file referenced by the
    36  	// descriptor was extended.
    37  	NoteExtend = Event(syscall.NOTE_EXTEND)
    38  	// NoteAttrib is an event reported when the file referenced
    39  	// by the descriptor had its attributes changed.
    40  	NoteAttrib = Event(syscall.NOTE_ATTRIB)
    41  	// NoteLink is an event reported when the link count on the file changed.
    42  	NoteLink = Event(syscall.NOTE_LINK)
    43  	// NoteRename is an event reported when the file referenced
    44  	// by the descriptor was renamed.
    45  	NoteRename = Event(syscall.NOTE_RENAME)
    46  	// NoteRevoke is an event reported when access to the file was revoked via
    47  	// revoke(2) or	the underlying file system was unmounted.
    48  	NoteRevoke = Event(syscall.NOTE_REVOKE)
    49  )
    50  
    51  var osestr = map[Event]string{
    52  	NoteDelete: "notify.NoteDelete",
    53  	NoteWrite:  "notify.NoteWrite",
    54  	NoteExtend: "notify.NoteExtend",
    55  	NoteAttrib: "notify.NoteAttrib",
    56  	NoteLink:   "notify.NoteLink",
    57  	NoteRename: "notify.NoteRename",
    58  	NoteRevoke: "notify.NoteRevoke",
    59  }