mirror of
https://github.com/syncthing/syncthing.git
synced 2024-11-16 10:28:49 -07:00
vendor: Update github.com/zillode/notify
This commit is contained in:
parent
ece1defb2f
commit
57eb1710e9
50
vendor/github.com/zillode/notify/debug.go
generated
vendored
50
vendor/github.com/zillode/notify/debug.go
generated
vendored
@ -2,10 +2,52 @@
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// +build !debug
|
||||
|
||||
package notify
|
||||
|
||||
func dbgprint(...interface{}) {}
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func dbgprintf(string, ...interface{}) {}
|
||||
var dbgprint func(...interface{})
|
||||
|
||||
var dbgprintf func(string, ...interface{})
|
||||
|
||||
var dbgcallstack func(max int) []string
|
||||
|
||||
func init() {
|
||||
if _, ok := os.LookupEnv("NOTIFY_DEBUG"); ok || debugTag {
|
||||
log.SetOutput(os.Stdout)
|
||||
log.SetFlags(log.Ldate | log.Ltime | log.Lmicroseconds)
|
||||
dbgprint = func(v ...interface{}) {
|
||||
v = append([]interface{}{"[D] "}, v...)
|
||||
log.Println(v...)
|
||||
}
|
||||
dbgprintf = func(format string, v ...interface{}) {
|
||||
format = "[D] " + format
|
||||
log.Printf(format, v...)
|
||||
}
|
||||
dbgcallstack = func(max int) []string {
|
||||
pc, stack := make([]uintptr, max), make([]string, 0, max)
|
||||
runtime.Callers(2, pc)
|
||||
for _, pc := range pc {
|
||||
if f := runtime.FuncForPC(pc); f != nil {
|
||||
fname := f.Name()
|
||||
idx := strings.LastIndex(fname, string(os.PathSeparator))
|
||||
if idx != -1 {
|
||||
stack = append(stack, fname[idx+1:])
|
||||
} else {
|
||||
stack = append(stack, fname)
|
||||
}
|
||||
}
|
||||
}
|
||||
return stack
|
||||
}
|
||||
return
|
||||
}
|
||||
dbgprint = func(v ...interface{}) {}
|
||||
dbgprintf = func(format string, v ...interface{}) {}
|
||||
dbgcallstack = func(max int) []string { return nil }
|
||||
}
|
||||
|
36
vendor/github.com/zillode/notify/debug_debug.go
generated
vendored
36
vendor/github.com/zillode/notify/debug_debug.go
generated
vendored
@ -6,38 +6,4 @@
|
||||
|
||||
package notify
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func dbgprint(v ...interface{}) {
|
||||
fmt.Printf("[D] ")
|
||||
fmt.Print(v...)
|
||||
fmt.Printf("\n\n")
|
||||
}
|
||||
|
||||
func dbgprintf(format string, v ...interface{}) {
|
||||
fmt.Printf("[D] ")
|
||||
fmt.Printf(format, v...)
|
||||
fmt.Printf("\n\n")
|
||||
}
|
||||
|
||||
func dbgcallstack(max int) []string {
|
||||
pc, stack := make([]uintptr, max), make([]string, 0, max)
|
||||
runtime.Callers(2, pc)
|
||||
for _, pc := range pc {
|
||||
if f := runtime.FuncForPC(pc); f != nil {
|
||||
fname := f.Name()
|
||||
idx := strings.LastIndex(fname, string(os.PathSeparator))
|
||||
if idx != -1 {
|
||||
stack = append(stack, fname[idx+1:])
|
||||
} else {
|
||||
stack = append(stack, fname)
|
||||
}
|
||||
}
|
||||
}
|
||||
return stack
|
||||
}
|
||||
var debugTag bool = true
|
||||
|
9
vendor/github.com/zillode/notify/debug_nodebug.go
generated
vendored
Normal file
9
vendor/github.com/zillode/notify/debug_nodebug.go
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
// Copyright (c) 2014-2015 The Notify Authors. All rights reserved.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// +build !debug
|
||||
|
||||
package notify
|
||||
|
||||
var debugTag bool = false
|
7
vendor/github.com/zillode/notify/node.go
generated
vendored
7
vendor/github.com/zillode/notify/node.go
generated
vendored
@ -6,7 +6,6 @@ package notify
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@ -71,7 +70,11 @@ Traverse:
|
||||
case errSkip:
|
||||
continue Traverse
|
||||
default:
|
||||
return fmt.Errorf("error while traversing %q: %v", nd.Name, err)
|
||||
return &os.PathError{
|
||||
Op: "error while traversing",
|
||||
Path: nd.Name,
|
||||
Err: err,
|
||||
}
|
||||
}
|
||||
// TODO(rjeczalik): tolerate open failures - add failed names to
|
||||
// AddDirError and notify users which names are not added to the tree.
|
||||
|
6
vendor/github.com/zillode/notify/watcher_fsevents_cgo.go
generated
vendored
6
vendor/github.com/zillode/notify/watcher_fsevents_cgo.go
generated
vendored
@ -48,7 +48,7 @@ var wg sync.WaitGroup // used to wait until the runloop starts
|
||||
// started and is ready via the wg. It also serves purpose of a dummy source,
|
||||
// thanks to it the runloop does not return as it also has at least one source
|
||||
// registered.
|
||||
var source = C.CFRunLoopSourceCreate(nil, 0, &C.CFRunLoopSourceContext{
|
||||
var source = C.CFRunLoopSourceCreate(refZero, 0, &C.CFRunLoopSourceContext{
|
||||
perform: (C.CFRunLoopPerformCallBack)(C.gosource),
|
||||
})
|
||||
|
||||
@ -159,8 +159,8 @@ func (s *stream) Start() error {
|
||||
return nil
|
||||
}
|
||||
wg.Wait()
|
||||
p := C.CFStringCreateWithCStringNoCopy(nil, C.CString(s.path), C.kCFStringEncodingUTF8, nil)
|
||||
path := C.CFArrayCreate(nil, (*unsafe.Pointer)(unsafe.Pointer(&p)), 1, nil)
|
||||
p := C.CFStringCreateWithCStringNoCopy(refZero, C.CString(s.path), C.kCFStringEncodingUTF8, refZero)
|
||||
path := C.CFArrayCreate(refZero, (*unsafe.Pointer)(unsafe.Pointer(&p)), 1, nil)
|
||||
ctx := C.FSEventStreamContext{}
|
||||
ref := C.EventStreamCreate(&ctx, C.uintptr_t(s.info), path, C.FSEventStreamEventId(atomic.LoadUint64(&since)), latency, flags)
|
||||
if ref == nilstream {
|
||||
|
9
vendor/github.com/zillode/notify/watcher_fsevents_go1.10.go
generated
vendored
Normal file
9
vendor/github.com/zillode/notify/watcher_fsevents_go1.10.go
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
// Copyright (c) 2017 The Notify Authors. All rights reserved.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// +build darwin,!kqueue,go1.10
|
||||
|
||||
package notify
|
||||
|
||||
const refZero = 0
|
14
vendor/github.com/zillode/notify/watcher_fsevents_go1.9.go
generated
vendored
Normal file
14
vendor/github.com/zillode/notify/watcher_fsevents_go1.9.go
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// Copyright (c) 2017 The Notify Authors. All rights reserved.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// +build darwin,!kqueue,cgo,!go1.10
|
||||
|
||||
package notify
|
||||
|
||||
/*
|
||||
#include <CoreServices/CoreServices.h>
|
||||
*/
|
||||
import "C"
|
||||
|
||||
var refZero = (*C.struct___CFAllocator)(nil)
|
2
vendor/manifest
vendored
2
vendor/manifest
vendored
@ -449,7 +449,7 @@
|
||||
"importpath": "github.com/zillode/notify",
|
||||
"repository": "https://github.com/zillode/notify",
|
||||
"vcs": "git",
|
||||
"revision": "54e3093eb7377fd139c4605f475cc78e83610b9d",
|
||||
"revision": "8fff849a2026ce7a59f67ed9747dd9c7adc8bd0b",
|
||||
"branch": "master",
|
||||
"notests": true
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user