Skip to content

Commit

Permalink
kqueue: remove calls to os.NewSyscallError
Browse files Browse the repository at this point in the history
calling os.NewSyscallError would silently break comparisons with the syscall constants. it didn't really add much value either, besides the "Kevent" prefix.

http://play.golang.org/p/YKbmygNDu4
  • Loading branch information
nathany committed Sep 24, 2014
1 parent f93f2ee commit 71b4293
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions kqueue.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func (w *Watcher) addWatch(name string, flags uint32) error {

watchfd, err = syscall.Open(name, openMode, 0700)
if watchfd == -1 {
return os.NewSyscallError("Open", err)
return err
}

isDir = fi.IsDir()
Expand Down Expand Up @@ -246,7 +246,7 @@ func (w *Watcher) readEvents() {
case <-w.done:
err := syscall.Close(w.kq)
if err != nil {
w.Errors <- os.NewSyscallError("close", err)
w.Errors <- err
}
close(w.Events)
close(w.Errors)
Expand All @@ -258,7 +258,7 @@ func (w *Watcher) readEvents() {
kevents, err := read(w.kq, eventBuffer, &keventWaitTime)
// EINTR is okay, the syscall was interrupted before timeout expired.
if err != nil && err != syscall.EINTR {
w.Errors <- os.NewSyscallError("Kevent", err)
w.Errors <- err
continue
}

Expand Down Expand Up @@ -419,7 +419,7 @@ func (w *Watcher) internalWatch(name string, fileInfo os.FileInfo) error {
func kqueue() (kq int, err error) {
kq, err = syscall.Kqueue()
if kq == -1 {
return kq, os.NewSyscallError("Kqueue", err)
return kq, err
}
return kq, nil
}
Expand All @@ -437,7 +437,7 @@ func register(kq int, fds []int, flags int, fflags uint32) error {
// register the events
success, err := syscall.Kevent(kq, changes, nil, nil)
if success == -1 {
return os.NewSyscallError("Kevent", err)
return err
}
return nil
}
Expand Down

0 comments on commit 71b4293

Please sign in to comment.