event_kqueue.go 2.0 KB

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