From: Chris Howey Date: Thu, 23 May 2013 23:06:06 +0000 (-0500) Subject: Darwin - Use EVT_ONLY flag on open file. X-Git-Tag: v1.7.2~366 X-Git-Url: https://go.fuhry.dev/?a=commitdiff_plain;h=51d76615d2eda89230dccd9878e383fc015f462b;p=fsnotify.git Darwin - Use EVT_ONLY flag on open file. --- diff --git a/fsnotify_bsd.go b/fsnotify_bsd.go index 7a16b3e..4d15a11 100644 --- a/fsnotify_bsd.go +++ b/fsnotify_bsd.go @@ -152,7 +152,7 @@ func (w *Watcher) addWatch(path string, flags uint32) error { } } - fd, errno := syscall.Open(path, syscall.O_NONBLOCK|syscall.O_RDONLY, 0700) + fd, errno := syscall.Open(path, OPEN_FLAGS, 0700) if fd == -1 { return errno } diff --git a/fsnotify_open_bsd.go b/fsnotify_open_bsd.go new file mode 100644 index 0000000..bb4faed --- /dev/null +++ b/fsnotify_open_bsd.go @@ -0,0 +1,11 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build freebsd openbsd netbsd + +package fsnotify + +import "syscall" + +const OPEN_FLAGS = syscall.O_NONBLOCK | syscall.O_RDONLY diff --git a/fsnotify_open_darwin.go b/fsnotify_open_darwin.go new file mode 100644 index 0000000..859ee2c --- /dev/null +++ b/fsnotify_open_darwin.go @@ -0,0 +1,11 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build darwin + +package fsnotify + +import "syscall" + +const OPEN_FLAGS = syscall.O_EVTONLY