Extracted from #521; we want to do this no matter what.
Fixes #383
up as a fsnotify.Write event. This is never useful, and could result in many
spurious Write events.
+- windows: return ErrEventOverflow if the buffer is full ([#525])
+
+ Before it would merely return "short read", making it hard to detect this
+ error.
+
- all: return ErrClosed on Add() when the watcher is closed ([#516])
[#516]: https://github.com/fsnotify/fsnotify/pull/516
[#518]: https://github.com/fsnotify/fsnotify/pull/518
[#520]: https://github.com/fsnotify/fsnotify/pull/520
+[#525]: https://github.com/fsnotify/fsnotify/pull/525
## [1.6.0] - 2022-10-13
Events chan Event
// Errors sends any errors.
+ //
+ // [ErrEventOverflow] is used to indicate ther are too many events:
+ //
+ // - inotify: there are too many queued events (fs.inotify.max_queued_events sysctl)
+ // - windows: The buffer size is too small.
+ // - kqueue, fen: not used.
Errors chan error
mu sync.Mutex
Events chan Event
// Errors sends any errors.
+ //
+ // [ErrEventOverflow] is used to indicate ther are too many events:
+ //
+ // - inotify: there are too many queued events (fs.inotify.max_queued_events sysctl)
+ // - windows: The buffer size is too small.
+ // - kqueue, fen: not used.
Errors chan error
// Store fd here as os.File.Read() will no longer return on close after
Events chan Event
// Errors sends any errors.
+ //
+ // [ErrEventOverflow] is used to indicate ther are too many events:
+ //
+ // - inotify: there are too many queued events (fs.inotify.max_queued_events sysctl)
+ // - windows: The buffer size is too small.
+ // - kqueue, fen: not used.
Errors chan error
done chan struct{}
Events chan Event
// Errors sends any errors.
+ //
+ // [ErrEventOverflow] is used to indicate ther are too many events:
+ //
+ // - inotify: there are too many queued events (fs.inotify.max_queued_events sysctl)
+ // - windows: The buffer size is too small.
+ // - kqueue, fen: not used.
Errors chan error
port windows.Handle // Handle to completion port
var offset uint32
for {
if n == 0 {
- w.sendError(errors.New("short read in readEvents()"))
+ w.sendError(ErrEventOverflow)
break
}
// Common errors that can be reported.
var (
ErrNonExistentWatch = errors.New("fsnotify: can't remove non-existent watcher")
- ErrEventOverflow = errors.New("fsnotify: queue overflow")
+ ErrEventOverflow = errors.New("fsnotify: queue or buffer overflow")
ErrClosed = errors.New("fsnotify: watcher already closed")
)
errors=$(<<EOF
// Errors sends any errors.
+ //
+ // [ErrEventOverflow] is used to indicate ther are too many events:
+ //
+ // - inotify: there are too many queued events (fs.inotify.max_queued_events sysctl)
+ // - windows: The buffer size is too small.
+ // - kqueue, fen: not used.
EOF
)