aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/rjeczalik/notify
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/rjeczalik/notify')
-rw-r--r--vendor/github.com/rjeczalik/notify/.gitignore88
-rw-r--r--vendor/github.com/rjeczalik/notify/.travis.yml29
-rw-r--r--vendor/github.com/rjeczalik/notify/event_fen.go29
-rw-r--r--vendor/github.com/rjeczalik/notify/event_kqueue.go2
-rw-r--r--vendor/github.com/rjeczalik/notify/notify.go6
-rw-r--r--vendor/github.com/rjeczalik/notify/watcher_fen.go18
-rw-r--r--vendor/github.com/rjeczalik/notify/watcher_fen_cgo.go10
-rw-r--r--vendor/github.com/rjeczalik/notify/watcher_fsevents_cgo.go2
-rw-r--r--vendor/github.com/rjeczalik/notify/watcher_kqueue.go13
-rw-r--r--vendor/github.com/rjeczalik/notify/watcher_trigger.go18
-rw-r--r--vendor/github.com/rjeczalik/notify/watchpoint_other.go2
11 files changed, 52 insertions, 165 deletions
diff --git a/vendor/github.com/rjeczalik/notify/.gitignore b/vendor/github.com/rjeczalik/notify/.gitignore
deleted file mode 100644
index 86d4fa8b1..000000000
--- a/vendor/github.com/rjeczalik/notify/.gitignore
+++ /dev/null
@@ -1,88 +0,0 @@
-# Created by https://www.gitignore.io
-
-### OSX ###
-.DS_Store
-.AppleDouble
-.LSOverride
-
-# Icon must end with two \r
-Icon
-
-# Thumbnails
-._*
-
-# Files that might appear on external disk
-.Spotlight-V100
-.Trashes
-
-# Directories potentially created on remote AFP share
-.AppleDB
-.AppleDesktop
-Network Trash Folder
-Temporary Items
-.apdisk
-
-
-### Windows ###
-# Windows image file caches
-Thumbs.db
-ehthumbs.db
-
-# Folder config file
-Desktop.ini
-
-# Recycle Bin used on file shares
-$RECYCLE.BIN/
-
-# Windows Installer files
-*.cab
-*.msi
-*.msm
-*.msp
-
-# Windows shortcuts
-*.lnk
-
-
-### Linux ###
-*~
-
-# KDE directory preferences
-.directory
-
-
-### Go ###
-# Compiled Object files, Static and Dynamic libs (Shared Objects)
-*.o
-*.a
-*.so
-
-# Folders
-_obj
-_test
-
-# Architecture specific extensions/prefixes
-*.[568vq]
-[568vq].out
-
-*.cgo1.go
-*.cgo2.c
-_cgo_defun.c
-_cgo_gotypes.go
-_cgo_export.*
-
-_testmain.go
-
-*.exe
-*.test
-*.prof
-
-
-### vim ###
-[._]*.s[a-w][a-z]
-[._]s[a-w][a-z]
-*.un~
-Session.vim
-.netrwhist
-*~
-
diff --git a/vendor/github.com/rjeczalik/notify/.travis.yml b/vendor/github.com/rjeczalik/notify/.travis.yml
deleted file mode 100644
index c92863d50..000000000
--- a/vendor/github.com/rjeczalik/notify/.travis.yml
+++ /dev/null
@@ -1,29 +0,0 @@
-language: go
-
-go:
- - 1.4.3
- - 1.6
-
-os:
- - linux
- - osx
-
-matrix:
- include:
- - os: osx
- go: 1.6
- env:
- - GOFLAGS="-tags kqueue"
-
-env:
- global:
- - GOBIN=$HOME/bin
- - PATH=$HOME/bin:$PATH
-
-install:
- - go get -t -v ./...
-
-script:
- - "(go version | grep -q 1.4) || go tool vet -all ."
- - go install $GOFLAGS ./...
- - go test -v -race $GOFLAGS ./...
diff --git a/vendor/github.com/rjeczalik/notify/event_fen.go b/vendor/github.com/rjeczalik/notify/event_fen.go
index a3079385d..767f04fa8 100644
--- a/vendor/github.com/rjeczalik/notify/event_fen.go
+++ b/vendor/github.com/rjeczalik/notify/event_fen.go
@@ -20,16 +20,27 @@ const (
)
const (
- FileAccess = fileAccess
- FileModified = fileModified
- FileAttrib = fileAttrib
- FileDelete = fileDelete
- FileRenameTo = fileRenameTo
+ // FileAccess is an event reported when monitored file/directory was accessed.
+ FileAccess = fileAccess
+ // FileModified is an event reported when monitored file/directory was modified.
+ FileModified = fileModified
+ // FileAttrib is an event reported when monitored file/directory's ATTRIB
+ // was changed.
+ FileAttrib = fileAttrib
+ // FileDelete is an event reported when monitored file/directory was deleted.
+ FileDelete = fileDelete
+ // FileRenameTo to is an event reported when monitored file/directory was renamed.
+ FileRenameTo = fileRenameTo
+ // FileRenameFrom is an event reported when monitored file/directory was renamed.
FileRenameFrom = fileRenameFrom
- FileTrunc = fileTrunc
- FileNoFollow = fileNoFollow
- Unmounted = unmounted
- MountedOver = mountedOver
+ // FileTrunc is an event reported when monitored file/directory was truncated.
+ FileTrunc = fileTrunc
+ // FileNoFollow is an flag to indicate not to follow symbolic links.
+ FileNoFollow = fileNoFollow
+ // Unmounted is an event reported when monitored filesystem was unmounted.
+ Unmounted = unmounted
+ // MountedOver is an event reported when monitored file/directory was mounted on.
+ MountedOver = mountedOver
)
var osestr = map[Event]string{
diff --git a/vendor/github.com/rjeczalik/notify/event_kqueue.go b/vendor/github.com/rjeczalik/notify/event_kqueue.go
index 82e2d8cca..422ac87f6 100644
--- a/vendor/github.com/rjeczalik/notify/event_kqueue.go
+++ b/vendor/github.com/rjeczalik/notify/event_kqueue.go
@@ -26,7 +26,7 @@ const (
)
const (
- // NoteDelete is an even reported when the unlink() system call was called
+ // NoteDelete is an event reported when the unlink() system call was called
// on the file referenced by the descriptor.
NoteDelete = Event(syscall.NOTE_DELETE)
// NoteWrite is an event reported when a write occurred on the file
diff --git a/vendor/github.com/rjeczalik/notify/notify.go b/vendor/github.com/rjeczalik/notify/notify.go
index dbf1e7bc2..7d2eec3a2 100644
--- a/vendor/github.com/rjeczalik/notify/notify.go
+++ b/vendor/github.com/rjeczalik/notify/notify.go
@@ -4,7 +4,7 @@
// BUG(rjeczalik): Notify does not collect watchpoints, when underlying watches
// were removed by their os-specific watcher implementations. Instead users are
-// advised to listen on persistant paths to have guarantee they receive events
+// advised to listen on persistent paths to have guarantee they receive events
// for the whole lifetime of their applications (to discuss see #69).
// BUG(ppknap): Linux (inotify) does not support watcher behavior masks like
@@ -58,7 +58,7 @@ var defaultTree = newTree()
// If a directory which path was used to create recursive watch under Windows
// gets deleted, the OS will not report such event. It is advised to keep in
// mind this limitation while setting recursive watchpoints for your application,
-// e.g. use persistant paths like %userprofile% or watch additionally parent
+// e.g. use persistent paths like %userprofile% or watch additionally parent
// directory of a recursive watchpoint in order to receive delete events for it.
func Watch(path string, c chan<- EventInfo, events ...Event) error {
return defaultTree.Watch(path, c, events...)
@@ -67,7 +67,7 @@ func Watch(path string, c chan<- EventInfo, events ...Event) error {
// Stop removes all watchpoints registered for c. All underlying watches are
// also removed, for which c was the last channel listening for events.
//
-// Stop does not close c. When Stop returns, it is guranteed that c will
+// Stop does not close c. When Stop returns, it is guaranteed that c will
// receive no more signals.
func Stop(c chan<- EventInfo) {
defaultTree.Stop(c)
diff --git a/vendor/github.com/rjeczalik/notify/watcher_fen.go b/vendor/github.com/rjeczalik/notify/watcher_fen.go
index 60e9a36da..dd069f2a2 100644
--- a/vendor/github.com/rjeczalik/notify/watcher_fen.go
+++ b/vendor/github.com/rjeczalik/notify/watcher_fen.go
@@ -45,7 +45,7 @@ type watched struct {
// Stop implements trigger.
func (f *fen) Stop() error {
- return f.cf.port_alert(f.p)
+ return f.cf.portAlert(f.p)
}
// Close implements trigger.
@@ -92,7 +92,7 @@ func (f *fen) Watched(n interface{}) (*watched, int64, error) {
// init initializes FEN.
func (f *fen) Init() (err error) {
- f.p, err = f.cf.port_create()
+ f.p, err = f.cf.portCreate()
return
}
@@ -106,12 +106,12 @@ func fi2fo(fi os.FileInfo, p string) FileObj {
// Unwatch implements trigger.
func (f *fen) Unwatch(w *watched) error {
- return f.cf.port_dissociate(f.p, FileObj{Name: w.p})
+ return f.cf.portDissociate(f.p, FileObj{Name: w.p})
}
// Watch implements trigger.
func (f *fen) Watch(fi os.FileInfo, w *watched, e int64) error {
- return f.cf.port_associate(f.p, fi2fo(fi, w.p), int(e))
+ return f.cf.portAssociate(f.p, fi2fo(fi, w.p), int(e))
}
// Wait implements trigger.
@@ -120,7 +120,7 @@ func (f *fen) Wait() (interface{}, error) {
pe PortEvent
err error
)
- err = f.cf.port_get(f.p, &pe)
+ err = f.cf.portGet(f.p, &pe)
return pe, err
}
@@ -130,16 +130,14 @@ func (f *fen) IsStop(n interface{}, err error) bool {
}
func init() {
- encode = func(e Event) (o int64) {
+ encode = func(e Event, dir bool) (o int64) {
// Create event is not supported by FEN. Instead FileModified event will
// be registered. If this event will be reported on dir which is to be
// monitored for Create, dir will be rescanned and Create events will
// be generated and returned for new files. In case of files,
// if not requested FileModified event is reported, it will be ignored.
- if e&Create != 0 {
- o = (o &^ int64(Create)) | int64(FileModified)
- }
- if e&Write != 0 {
+ o = int64(e &^ Create)
+ if (e&Create != 0 && dir) || e&Write != 0 {
o = (o &^ int64(Write)) | int64(FileModified)
}
// Following events are 'exception events' and as such cannot be requested
diff --git a/vendor/github.com/rjeczalik/notify/watcher_fen_cgo.go b/vendor/github.com/rjeczalik/notify/watcher_fen_cgo.go
index 58ac8e8c6..8ec8ead34 100644
--- a/vendor/github.com/rjeczalik/notify/watcher_fen_cgo.go
+++ b/vendor/github.com/rjeczalik/notify/watcher_fen_cgo.go
@@ -67,7 +67,7 @@ func unix2C(sec int64, nsec int64) (C.time_t, C.long) {
return C.time_t(sec), C.long(nsec)
}
-func (c *cfen) port_associate(p int, fo FileObj, e int) (err error) {
+func (c *cfen) portAssociate(p int, fo FileObj, e int) (err error) {
cfo := C.newFo()
cfo.fo_atime.tv_sec, cfo.fo_atime.tv_nsec = unix2C(fo.Atim.Unix())
cfo.fo_mtime.tv_sec, cfo.fo_mtime.tv_nsec = unix2C(fo.Mtim.Unix())
@@ -78,7 +78,7 @@ func (c *cfen) port_associate(p int, fo FileObj, e int) (err error) {
return
}
-func (c *cfen) port_dissociate(port int, fo FileObj) (err error) {
+func (c *cfen) portDissociate(port int, fo FileObj) (err error) {
cfo, ok := c.p2fo[fo.Name]
if !ok {
return errNotWatched
@@ -104,7 +104,7 @@ func cfo2fo(cfo *C.struct_file_obj) *FileObj {
return &fo
}
-func (c *cfen) port_get(port int, pe *PortEvent) (err error) {
+func (c *cfen) portGet(port int, pe *PortEvent) (err error) {
cpe := C.newPe()
if _, err = C.port_get(C.int(port), cpe, nil); err != nil {
C.free(unsafe.Pointer(cpe))
@@ -118,12 +118,12 @@ func (c *cfen) port_get(port int, pe *PortEvent) (err error) {
return
}
-func (c *cfen) port_create() (int, error) {
+func (c *cfen) portCreate() (int, error) {
p, err := C.port_create()
return int(p), err
}
-func (c *cfen) port_alert(p int) (err error) {
+func (c *cfen) portAlert(p int) (err error) {
_, err = C.port_alert(C.int(p), alertSet, C.int(666), nil)
return
}
diff --git a/vendor/github.com/rjeczalik/notify/watcher_fsevents_cgo.go b/vendor/github.com/rjeczalik/notify/watcher_fsevents_cgo.go
index ee9631a61..5be64632e 100644
--- a/vendor/github.com/rjeczalik/notify/watcher_fsevents_cgo.go
+++ b/vendor/github.com/rjeczalik/notify/watcher_fsevents_cgo.go
@@ -144,7 +144,7 @@ type stream struct {
}
// NewStream creates a stream for given path, listening for file events and
-// calling fn upon receving any.
+// calling fn upon receiving any.
func newStream(path string, fn streamFunc) *stream {
return &stream{
path: path,
diff --git a/vendor/github.com/rjeczalik/notify/watcher_kqueue.go b/vendor/github.com/rjeczalik/notify/watcher_kqueue.go
index d5f7788c4..6d500b700 100644
--- a/vendor/github.com/rjeczalik/notify/watcher_kqueue.go
+++ b/vendor/github.com/rjeczalik/notify/watcher_kqueue.go
@@ -157,14 +157,15 @@ func (k *kq) IsStop(n interface{}, err error) bool {
}
func init() {
- encode = func(e Event) (o int64) {
+ encode = func(e Event, dir bool) (o int64) {
// Create event is not supported by kqueue. Instead NoteWrite event will
- // be registered. If this event will be reported on dir which is to be
- // monitored for Create, dir will be rescanned and Create events will
- // be generated and returned for new files. In case of files,
- // if not requested NoteRename event is reported, it will be ignored.
+ // be registered for a directory. If this event will be reported on dir
+ // which is to be monitored for Create, dir will be rescanned
+ // and Create events will be generated and returned for new files.
+ // In case of files, if not requested NoteRename event is reported,
+ // it will be ignored.
o = int64(e &^ Create)
- if e&Write != 0 {
+ if (e&Create != 0 && dir) || e&Write != 0 {
o = (o &^ int64(Write)) | int64(NoteWrite)
}
if e&Rename != 0 {
diff --git a/vendor/github.com/rjeczalik/notify/watcher_trigger.go b/vendor/github.com/rjeczalik/notify/watcher_trigger.go
index f25a6fcbf..d079d59b0 100644
--- a/vendor/github.com/rjeczalik/notify/watcher_trigger.go
+++ b/vendor/github.com/rjeczalik/notify/watcher_trigger.go
@@ -58,7 +58,7 @@ type trigger interface {
// encode Event to native representation. Implementation is to be provided by
// platform specific implementation.
-var encode func(Event) int64
+var encode func(Event, bool) int64
var (
// nat2not matches native events to notify's ones. To be initialized by
@@ -145,13 +145,7 @@ func (t *trg) singlewatch(p string, e Event, direct mode, fi os.FileInfo) (err e
w.eDir |= e
w.eNonDir |= e
}
- var ee int64
- // Native Write event is added to wait for Create events (Write event on
- // directory triggers it's rescan).
- if e&Create != 0 && fi.IsDir() {
- ee = int64(not2nat[Write])
- }
- if err = t.t.Watch(fi, w, encode(w.eDir|w.eNonDir)|ee); err != nil {
+ if err = t.t.Watch(fi, w, encode(w.eDir|w.eNonDir, fi.IsDir())); err != nil {
return
}
if !ok {
@@ -290,7 +284,7 @@ func (t *trg) dir(w *watched, n interface{}, e, ge Event) (evn []event) {
// However events for rename must be generated for all monitored files
// inside of moved directory, because native impl does not report it independently
// for each file descriptor being moved in result of move action on
- // parent dirLiczba dostępnych dni urlopowych: 0ectory.
+ // parent directory.
if (ge & (not2nat[Rename] | not2nat[Remove])) != 0 {
// Write is reported also for Remove on directory. Because of that
// we have to filter it out explicitly.
@@ -399,7 +393,7 @@ func (t *trg) monitor() {
}
}
-// process event returned by port_get call.
+// process event returned by native call.
func (t *trg) process(n interface{}) (evn []event) {
t.Lock()
w, ge, err := t.t.Watched(n)
@@ -414,13 +408,13 @@ func (t *trg) process(n interface{}) (evn []event) {
switch fi, err := os.Stat(w.p); {
case err != nil:
default:
- if err = t.t.Watch(fi, w, (encode(w.eDir | w.eNonDir))); err != nil {
+ if err = t.t.Watch(fi, w, encode(w.eDir|w.eNonDir, fi.IsDir())); err != nil {
dbgprintf("trg: %q is no longer watched: %q", w.p, err)
t.t.Del(w)
}
}
}
- if e == Event(0) {
+ if e == Event(0) && (!w.fi.IsDir() || (ge&int64(not2nat[Write])) == 0) {
t.Unlock()
return
}
diff --git a/vendor/github.com/rjeczalik/notify/watchpoint_other.go b/vendor/github.com/rjeczalik/notify/watchpoint_other.go
index 881631c99..9bb381db7 100644
--- a/vendor/github.com/rjeczalik/notify/watchpoint_other.go
+++ b/vendor/github.com/rjeczalik/notify/watchpoint_other.go
@@ -15,7 +15,7 @@ func eventmask(ei EventInfo, extra Event) Event {
// matches reports a match only when:
//
// - for user events, when event is present in the given set
-// - for internal events, when additionaly both event and set have omit bit set
+// - for internal events, when additionally both event and set have omit bit set
//
// Internal events must not be sent to user channels and vice versa.
func matches(set, event Event) bool {