]> go.fuhry.dev Git - fsnotify.git/commitdiff
Darwin - Use EVT_ONLY flag on open file.
authorChris Howey <chris@howey.me>
Thu, 23 May 2013 23:06:06 +0000 (18:06 -0500)
committerChris Howey <chris@howey.me>
Thu, 23 May 2013 23:06:06 +0000 (18:06 -0500)
fsnotify_bsd.go
fsnotify_open_bsd.go [new file with mode: 0644]
fsnotify_open_darwin.go [new file with mode: 0644]

index 7a16b3e829822521998dc419e7a56b99b9a6a0e3..4d15a1134856f08ddf865ff513e0cce68d11c018 100644 (file)
@@ -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 (file)
index 0000000..bb4faed
--- /dev/null
@@ -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 (file)
index 0000000..859ee2c
--- /dev/null
@@ -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