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