Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
86acdf1a
Commit
86acdf1a
authored
6 years ago
by
Jeremy Schlatter
Committed by
Péter Szilágyi
6 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vendor: update rjeczalik/notify so that it compiles on go1.11 (#17467)
parent
355fc47d
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
143 additions
and
82 deletions
+143
-82
README.md
vendor/github.com/rjeczalik/notify/README.md
+1
-0
appveyor.yml
vendor/github.com/rjeczalik/notify/appveyor.yml
+8
-4
debug_debug.go
vendor/github.com/rjeczalik/notify/debug_debug.go
+2
-2
debug_nodebug.go
vendor/github.com/rjeczalik/notify/debug_nodebug.go
+2
-2
watcher_fsevents_cgo.go
vendor/github.com/rjeczalik/notify/watcher_fsevents_cgo.go
+8
-4
watcher_fsevents_go1.10.go
...or/github.com/rjeczalik/notify/watcher_fsevents_go1.10.go
+14
-0
watcher_fsevents_go1.11.go
...or/github.com/rjeczalik/notify/watcher_fsevents_go1.11.go
+9
-0
watcher_notimplemented.go
vendor/github.com/rjeczalik/notify/watcher_notimplemented.go
+15
-0
watcher_readdcw.go
vendor/github.com/rjeczalik/notify/watcher_readdcw.go
+73
-50
watcher_stub.go
vendor/github.com/rjeczalik/notify/watcher_stub.go
+6
-16
watcher_trigger.go
vendor/github.com/rjeczalik/notify/watcher_trigger.go
+2
-1
vendor.json
vendor/vendor.json
+3
-3
No files found.
vendor/github.com/rjeczalik/notify/README.md
View file @
86acdf1a
...
...
@@ -19,3 +19,4 @@ Filesystem event notification library on steroids. (under active development)
-
[
github.com/cortesi/devd
](
https://github.com/cortesi/devd
)
-
[
github.com/cortesi/modd
](
https://github.com/cortesi/modd
)
-
[
github.com/syncthing/syncthing-inotify
](
https://github.com/syncthing/syncthing-inotify
)
-
[
github.com/OrlovEvgeny/TinyJPG
](
https://github.com/OrlovEvgeny/TinyJPG
)
This diff is collapsed.
Click to expand it.
vendor/github.com/rjeczalik/notify/appveyor.yml
View file @
86acdf1a
...
...
@@ -7,16 +7,20 @@ clone_folder: c:\projects\src\github.com\rjeczalik\notify
environment
:
PATH
:
c:\projects\bin;%PATH%
GOPATH
:
c:\projects
NOTIFY_TIMEOUT
:
5s
NOTIFY_TIMEOUT
:
10s
GOVERSION
:
1.10.3
install
:
-
rmdir c:\go /s /q
-
appveyor DownloadFile https://storage.googleapis.com/golang/go%GOVERSION%.windows-amd64.zip
-
7z x go%GOVERSION%.windows-amd64.zip -y -oC:\ > NUL
-
cd %APPVEYOR_BUILD_FOLDER%
-
go version
-
go get -v -t ./...
build_script
:
-
go tool vet -all .
-
go build ./...
-
go test -v -timeout
6
0s -race ./...
-
go test -v -timeout
12
0s -race ./...
test
:
off
...
...
This diff is collapsed.
Click to expand it.
vendor/github.com/rjeczalik/notify/debug_debug.go
View file @
86acdf1a
// Copyright (c) 2014-201
5
The Notify Authors. All rights reserved.
// Copyright (c) 2014-201
8
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.
...
...
@@ -6,4 +6,4 @@
package
notify
var
debugTag
bool
=
true
var
debugTag
=
true
This diff is collapsed.
Click to expand it.
vendor/github.com/rjeczalik/notify/debug_nodebug.go
View file @
86acdf1a
// Copyright (c) 2014-201
5
The Notify Authors. All rights reserved.
// Copyright (c) 2014-201
8
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.
...
...
@@ -6,4 +6,4 @@
package
notify
var
debugTag
bool
=
false
var
debugTag
=
false
This diff is collapsed.
Click to expand it.
vendor/github.com/rjeczalik/notify/watcher_fsevents_cgo.go
View file @
86acdf1a
...
...
@@ -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
),
})
...
...
@@ -90,6 +90,10 @@ func gostream(_, info uintptr, n C.size_t, paths, flags, ids uintptr) {
if
n
==
0
{
return
}
fn
:=
streamFuncs
.
get
(
info
)
if
fn
==
nil
{
return
}
ev
:=
make
([]
FSEvent
,
0
,
int
(
n
))
for
i
:=
uintptr
(
0
);
i
<
uintptr
(
n
);
i
++
{
switch
flags
:=
*
(
*
uint32
)(
unsafe
.
Pointer
((
flags
+
i
*
offflag
)));
{
...
...
@@ -104,7 +108,7 @@ func gostream(_, info uintptr, n C.size_t, paths, flags, ids uintptr) {
}
}
streamFuncs
.
get
(
info
)
(
ev
)
fn
(
ev
)
}
// StreamFunc is a callback called when stream receives file events.
...
...
@@ -162,8 +166,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
{
...
...
This diff is collapsed.
Click to expand it.
vendor/github.com/rjeczalik/notify/watcher_fsevents_go1.10.go
0 → 100644
View file @
86acdf1a
// Copyright (c) 2018 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.11
package
notify
/*
#include <CoreServices/CoreServices.h>
*/
import
"C"
var
refZero
=
(
*
C
.
struct___CFAllocator
)(
nil
)
This diff is collapsed.
Click to expand it.
vendor/github.com/rjeczalik/notify/watcher_fsevents_go1.11.go
0 → 100644
View file @
86acdf1a
// Copyright (c) 2018 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.11
package
notify
const
refZero
=
0
This diff is collapsed.
Click to expand it.
vendor/github.com/rjeczalik/notify/watcher_notimplemented.go
0 → 100644
View file @
86acdf1a
// Copyright (c) 2014-2018 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,!linux,!freebsd,!dragonfly,!netbsd,!openbsd,!windows
// +build !kqueue,!solaris
package
notify
import
"errors"
// newWatcher stub.
func
newWatcher
(
chan
<-
EventInfo
)
watcher
{
return
watcherStub
{
errors
.
New
(
"notify: not implemented"
)}
}
This diff is collapsed.
Click to expand it.
vendor/github.com/rjeczalik/notify/watcher_readdcw.go
View file @
86acdf1a
// Copyright (c) 2014-201
5
The Notify Authors. All rights reserved.
// Copyright (c) 2014-201
8
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.
...
...
@@ -22,7 +22,7 @@ import (
const
readBufferSize
=
4096
// Since all operations which go through the Windows completion routine are done
// asynchronously, filter may set one of the constants belo
r
. They were defined
// asynchronously, filter may set one of the constants belo
w
. They were defined
// in order to distinguish whether current folder should be re-registered in
// ReadDirectoryChangesW function or some control operations need to be executed.
const
(
...
...
@@ -109,8 +109,13 @@ func (g *grip) register(cph syscall.Handle) (err error) {
// buffer. Directory changes that occur between calls to this function are added
// to the buffer and then, returned with the next call.
func
(
g
*
grip
)
readDirChanges
()
error
{
handle
:=
syscall
.
Handle
(
atomic
.
LoadUintptr
((
*
uintptr
)(
&
g
.
handle
)))
if
handle
==
syscall
.
InvalidHandle
{
return
nil
// Handle was closed.
}
return
syscall
.
ReadDirectoryChanges
(
g
.
handle
,
handle
,
&
g
.
buffer
[
0
],
uint32
(
unsafe
.
Sizeof
(
g
.
buffer
)),
g
.
recursive
,
...
...
@@ -220,12 +225,27 @@ func (wd *watched) updateGrip(idx int, cph syscall.Handle, reset bool,
// returned from the operating system kernel.
func
(
wd
*
watched
)
closeHandle
()
(
err
error
)
{
for
_
,
g
:=
range
wd
.
digrip
{
if
g
!=
nil
&&
g
.
handle
!=
syscall
.
InvalidHandle
{
switch
suberr
:=
syscall
.
CloseHandle
(
g
.
handle
);
{
case
suberr
==
nil
:
g
.
handle
=
syscall
.
InvalidHandle
case
err
==
nil
:
err
=
suberr
if
g
==
nil
{
continue
}
for
{
handle
:=
syscall
.
Handle
(
atomic
.
LoadUintptr
((
*
uintptr
)(
&
g
.
handle
)))
if
handle
==
syscall
.
InvalidHandle
{
break
// Already closed.
}
e
:=
syscall
.
CloseHandle
(
handle
)
if
e
!=
nil
&&
err
==
nil
{
err
=
e
}
// Set invalid handle even when CloseHandle fails. This will leak
// the handle but, since we can't close it anyway, there won't be
// any difference.
if
atomic
.
CompareAndSwapUintptr
((
*
uintptr
)(
&
g
.
handle
),
(
uintptr
)(
handle
),
(
uintptr
)(
syscall
.
InvalidHandle
))
{
break
}
}
}
...
...
@@ -272,50 +292,49 @@ func (r *readdcw) RecursiveWatch(path string, event Event) error {
// watch inserts a directory to the group of watched folders. If watched folder
// already exists, function tries to rewatch it with new filters(NOT VALID). Moreover,
// watch starts the main event loop goroutine when called for the first time.
func
(
r
*
readdcw
)
watch
(
path
string
,
event
Event
,
recursive
bool
)
(
err
error
)
{
func
(
r
*
readdcw
)
watch
(
path
string
,
event
Event
,
recursive
bool
)
error
{
if
event
&^
(
All
|
fileNotifyChangeAll
)
!=
0
{
return
errors
.
New
(
"notify: unknown event"
)
}
r
.
Lock
()
wd
,
ok
:=
r
.
m
[
path
]
r
.
Unlock
()
if
!
ok
{
if
err
=
r
.
lazyinit
();
err
!=
nil
{
return
}
r
.
Lock
()
defer
r
.
Unlock
()
if
wd
,
ok
=
r
.
m
[
path
];
ok
{
dbgprint
(
"watch: exists already"
)
return
}
if
wd
,
err
=
newWatched
(
r
.
cph
,
uint32
(
event
),
recursive
,
path
);
err
!=
nil
{
return
}
r
.
m
[
path
]
=
wd
dbgprint
(
"watch: new watch added"
)
}
else
{
dbgprint
(
"watch: exists already"
)
defer
r
.
Unlock
()
if
wd
,
ok
:=
r
.
m
[
path
];
ok
{
dbgprint
(
"watch: already exists"
)
wd
.
filter
&^=
stateUnwatch
return
nil
}
if
err
:=
r
.
lazyinit
();
err
!=
nil
{
return
err
}
wd
,
err
:=
newWatched
(
r
.
cph
,
uint32
(
event
),
recursive
,
path
)
if
err
!=
nil
{
return
err
}
r
.
m
[
path
]
=
wd
dbgprint
(
"watch: new watch added"
)
return
nil
}
// lazyinit creates an I/O completion port and starts the main event processing
// loop. This method uses Double-Checked Locking optimization.
// lazyinit creates an I/O completion port and starts the main event loop.
func
(
r
*
readdcw
)
lazyinit
()
(
err
error
)
{
invalid
:=
uintptr
(
syscall
.
InvalidHandle
)
if
atomic
.
LoadUintptr
((
*
uintptr
)(
&
r
.
cph
))
==
invalid
{
r
.
Lock
()
defer
r
.
Unlock
()
if
atomic
.
LoadUintptr
((
*
uintptr
)(
&
r
.
cph
))
==
invalid
{
cph
:=
syscall
.
InvalidHandle
if
cph
,
err
=
syscall
.
CreateIoCompletionPort
(
cph
,
0
,
0
,
0
);
err
!=
nil
{
return
}
r
.
cph
,
r
.
start
=
cph
,
true
go
r
.
loop
()
cph
:=
syscall
.
InvalidHandle
if
cph
,
err
=
syscall
.
CreateIoCompletionPort
(
cph
,
0
,
0
,
0
);
err
!=
nil
{
return
}
r
.
cph
,
r
.
start
=
cph
,
true
go
r
.
loop
()
}
return
}
...
...
@@ -364,6 +383,7 @@ func (r *readdcw) loopstate(overEx *overlappedEx) {
overEx
.
parent
.
parent
.
recreate
(
r
.
cph
)
case
stateUnwatch
:
dbgprint
(
"loopstate unwatch"
)
overEx
.
parent
.
parent
.
closeHandle
()
delete
(
r
.
m
,
syscall
.
UTF16ToString
(
overEx
.
parent
.
pathw
))
case
stateCPClose
:
default
:
...
...
@@ -495,27 +515,30 @@ func (r *readdcw) RecursiveUnwatch(path string) error {
// TODO : pknap
func
(
r
*
readdcw
)
unwatch
(
path
string
)
(
err
error
)
{
var
wd
*
watched
r
.
Lock
()
defer
r
.
Unlock
()
if
wd
,
err
=
r
.
nonStateWatchedLocked
(
path
);
err
!=
nil
{
return
}
wd
.
filter
|=
stateUnwatch
if
err
=
wd
.
closeHandle
();
err
!=
nil
{
wd
.
filter
&^=
stateUnwatch
return
}
dbgprint
(
"unwatch: set unwatch state"
)
if
_
,
attrErr
:=
syscall
.
GetFileAttributes
(
&
wd
.
pathw
[
0
]);
attrErr
!=
nil
{
for
_
,
g
:=
range
wd
.
digrip
{
if
g
!=
nil
{
dbgprint
(
"unwatch: posting"
)
if
err
=
syscall
.
PostQueuedCompletionStatus
(
r
.
cph
,
0
,
0
,
(
*
syscall
.
Overlapped
)(
unsafe
.
Pointer
(
g
.
ovlapped
)));
err
!=
nil
{
wd
.
filter
&^=
stateUnwatch
return
}
if
g
==
nil
{
continue
}
dbgprint
(
"unwatch: posting"
)
if
err
=
syscall
.
PostQueuedCompletionStatus
(
r
.
cph
,
0
,
0
,
(
*
syscall
.
Overlapped
)(
unsafe
.
Pointer
(
g
.
ovlapped
)));
err
!=
nil
{
wd
.
filter
&^=
stateUnwatch
return
}
}
}
return
}
...
...
This diff is collapsed.
Click to expand it.
vendor/github.com/rjeczalik/notify/watcher_stub.go
View file @
86acdf1a
// Copyright (c) 2014-201
5
The Notify Authors. All rights reserved.
// Copyright (c) 2014-201
8
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,!linux,!freebsd,!dragonfly,!netbsd,!openbsd,!windows
// +build !kqueue,!solaris
package
notify
import
"errors"
type
stub
struct
{
error
}
// newWatcher stub.
func
newWatcher
(
chan
<-
EventInfo
)
watcher
{
return
stub
{
errors
.
New
(
"notify: not implemented"
)}
}
type
watcherStub
struct
{
error
}
// Following methods implement notify.watcher interface.
func
(
s
s
tub
)
Watch
(
string
,
Event
)
error
{
return
s
}
func
(
s
s
tub
)
Rewatch
(
string
,
Event
,
Event
)
error
{
return
s
}
func
(
s
s
tub
)
Unwatch
(
string
)
(
err
error
)
{
return
s
}
func
(
s
s
tub
)
Close
()
error
{
return
s
}
func
(
s
watcherS
tub
)
Watch
(
string
,
Event
)
error
{
return
s
}
func
(
s
watcherS
tub
)
Rewatch
(
string
,
Event
,
Event
)
error
{
return
s
}
func
(
s
watcherS
tub
)
Unwatch
(
string
)
(
err
error
)
{
return
s
}
func
(
s
watcherS
tub
)
Close
()
error
{
return
s
}
This diff is collapsed.
Click to expand it.
vendor/github.com/rjeczalik/notify/watcher_trigger.go
View file @
86acdf1a
...
...
@@ -106,7 +106,8 @@ func newWatcher(c chan<- EventInfo) watcher {
}
t
.
t
=
newTrigger
(
t
.
pthLkp
)
if
err
:=
t
.
t
.
Init
();
err
!=
nil
{
panic
(
err
)
t
.
Close
()
return
watcherStub
{
fmt
.
Errorf
(
"failed setting up watcher: %v"
,
err
)}
}
go
t
.
monitor
()
return
t
...
...
This diff is collapsed.
Click to expand it.
vendor/vendor.json
View file @
86acdf1a
...
...
@@ -370,10 +370,10 @@
"revisionTime"
:
"2017-08-14T17:01:13Z"
},
{
"checksumSHA1"
:
"
28UVHMmHx0iqO0XiJsjx+fwILyI
="
,
"checksumSHA1"
:
"
D8AVDI39CJ+jvw0HOotYU2gz54c
="
,
"path"
:
"github.com/rjeczalik/notify"
,
"revision"
:
"
c31e5f2cb22b3e4ef3f882f413847669bf2652b9
"
,
"revisionTime"
:
"2018-0
2-03T14:01:1
5Z"
"revision"
:
"
4e54e7fd043e865c50bda93359fb78813a8d165b
"
,
"revisionTime"
:
"2018-0
8-08T20:39:2
5Z"
},
{
"checksumSHA1"
:
"5uqO4ITTDMklKi3uNaE/D9LQ5nM="
,
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment