refactor inotify implementation

This commit is contained in:
Dominic Breuker
2018-02-26 09:29:06 +01:00
committed by Dominic Breuker
parent 2750defb63
commit 94a12cf031
9 changed files with 154 additions and 235 deletions

View File

@@ -4,7 +4,6 @@ import (
"fmt"
"github.com/dominicbreuker/pspy/internal/fswatcher/inotify"
isys "github.com/dominicbreuker/pspy/internal/fswatcher/inotify/sys"
"github.com/dominicbreuker/pspy/internal/fswatcher/walker"
)
@@ -17,7 +16,7 @@ func (iw *InotifyWatcher) Close() {
}
func NewInotifyWatcher() (*InotifyWatcher, error) {
i, err := inotify.NewInotify(&isys.InotifySyscallsUNIX{})
i, err := inotify.NewInotify()
if err != nil {
return nil, fmt.Errorf("setting up inotify: %v", err)
}
@@ -27,7 +26,7 @@ func NewInotifyWatcher() (*InotifyWatcher, error) {
}
func (iw *InotifyWatcher) Setup(rdirs, dirs []string, errCh chan error) (chan struct{}, chan string, error) {
maxWatchers, err := getLimit()
maxWatchers, err := inotify.GetMaxWatchers()
if err != nil {
errCh <- fmt.Errorf("Can't get inotify watcher limit...: %v\n", err)
maxWatchers = -1